Skip to content

Commit e9c0e9a

Browse files
committed
Documented core.py functions.
1 parent 6c5d6f9 commit e9c0e9a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

github2/core.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,37 @@
77

88

99
def ghdate_to_datetime(github_date):
10+
"""Convert Github date string to Python datetime
11+
12+
:param str github_date: date string to parse
13+
"""
1014
date_without_tz = " ".join(github_date.strip().split()[:2])
1115
return datetime.strptime(date_without_tz, GITHUB_DATE_FORMAT)
1216

1317

1418
def datetime_to_ghdate(datetime_):
19+
"""Convert Python datetime to Github date string
20+
21+
:param str datetime_: datetime object to convert
22+
"""
1523
date_without_tz = datetime_.strftime(GITHUB_DATE_FORMAT)
1624
return " ".join([date_without_tz, GITHUB_TIMEZONE])
1725

1826

1927
def commitdate_to_datetime(commit_date):
28+
"""Convert commit date string to Python datetime
29+
30+
:param str github_date: date string to parse
31+
"""
2032
date_without_tz = commit_date[:-6]
2133
return datetime.strptime(date_without_tz, COMMIT_DATE_FORMAT)
2234

2335

2436
def datetime_to_commitdate(datetime_):
37+
"""Convert Python datetime to Github date string
38+
39+
:param str datetime_: datetime object to convert
40+
"""
2541
date_without_tz = datetime_.strftime(COMMIT_DATE_FORMAT)
2642
return "".join([date_without_tz, GITHUB_TIMEZONE])
2743

@@ -67,6 +83,11 @@ def get_values(self, *args, **kwargs):
6783

6884

6985
def doc_generator(docstring, attributes):
86+
"""Utility function to augment BaseDataType docstring
87+
88+
:param str docstring: docstring to augment
89+
:param dict attributes: attributes to add to docstring
90+
"""
7091
docstring = docstring or ""
7192

7293
def section(title):

0 commit comments

Comments
 (0)