Skip to content

Commit 35c74dd

Browse files
Added documentation to methods
1 parent 6e43e5f commit 35c74dd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

remove_times.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import re
22

33
def remove_timespans(text):
4+
"""
5+
Remove timespans from the given text and format it into a specific structure.
6+
7+
Args:
8+
text (str): The input text containing timespans and tasks.
9+
10+
Returns:
11+
str: The formatted text with timespans removed and tasks organized.
12+
13+
"""
414
pattern = r"\b\d{1,2}(:\d{1,2})?-\d{1,2}(:\d{1,2})?\b,? *"
515
result = re.sub(pattern, "", text)
616
lines = result.split('\n')

timesheet_helper.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
from datetime import datetime, timedelta
33

44
def replace_with_duration(text):
5+
"""
6+
Replaces time durations in the given text with their corresponding durations in hours.
7+
8+
Args:
9+
text (str): The input text containing time durations.
10+
11+
Returns:
12+
str: The modified text with time durations replaced by their corresponding durations in hours.
13+
"""
514
pattern = r"(\b\d{1,2})(:\d{1,2})?-(\d{1,2})(:\d{1,2})?\b"
615

716
def duration(match):

0 commit comments

Comments
 (0)