|
7 | 7 |
|
8 | 8 |
|
9 | 9 | 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 | + """ |
10 | 14 | date_without_tz = " ".join(github_date.strip().split()[:2]) |
11 | 15 | return datetime.strptime(date_without_tz, GITHUB_DATE_FORMAT) |
12 | 16 |
|
13 | 17 |
|
14 | 18 | def datetime_to_ghdate(datetime_): |
| 19 | + """Convert Python datetime to Github date string |
| 20 | +
|
| 21 | + :param str datetime_: datetime object to convert |
| 22 | + """ |
15 | 23 | date_without_tz = datetime_.strftime(GITHUB_DATE_FORMAT) |
16 | 24 | return " ".join([date_without_tz, GITHUB_TIMEZONE]) |
17 | 25 |
|
18 | 26 |
|
19 | 27 | 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 | + """ |
20 | 32 | date_without_tz = commit_date[:-6] |
21 | 33 | return datetime.strptime(date_without_tz, COMMIT_DATE_FORMAT) |
22 | 34 |
|
23 | 35 |
|
24 | 36 | def datetime_to_commitdate(datetime_): |
| 37 | + """Convert Python datetime to Github date string |
| 38 | +
|
| 39 | + :param str datetime_: datetime object to convert |
| 40 | + """ |
25 | 41 | date_without_tz = datetime_.strftime(COMMIT_DATE_FORMAT) |
26 | 42 | return "".join([date_without_tz, GITHUB_TIMEZONE]) |
27 | 43 |
|
@@ -67,6 +83,11 @@ def get_values(self, *args, **kwargs): |
67 | 83 |
|
68 | 84 |
|
69 | 85 | 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 | + """ |
70 | 91 | docstring = docstring or "" |
71 | 92 |
|
72 | 93 | def section(title): |
|
0 commit comments