| Total Complexity | 5 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | https://www.pnas.org/doi/10.1073/pnas.0709247105 |
||
| 3 | """ |
||
| 4 | |||
| 5 | from datetime import timedelta |
||
| 6 | |||
| 7 | from _client import github_commits, github_repositories, github_user |
||
| 8 | from github.GitCommit import GitCommit |
||
| 9 | |||
| 10 | |||
| 11 | def commit_interval(user_id: str | None = None, |
||
| 12 | repository_id: str | None = None, |
||
| 13 | commit_id: str | None = None): |
||
| 14 | github_user(user_id) |
||
| 15 | for repo in github_repositories(user_id, repository_id): |
||
| 16 | for commit in github_commits(repo, commit_id): |
||
| 17 | git_commit: GitCommit = commit.commit |
||
| 18 | parents = git_commit.parents |
||
| 19 | parent_git_commit: GitCommit = parents[0] if parents else None |
||
| 20 | author_datetime = git_commit.author.date |
||
| 21 | parent_author_datetime = parent_git_commit.author.date if parent_git_commit else author_datetime |
||
| 22 | interval: timedelta = author_datetime - parent_author_datetime |
||
| 23 | s = interval.total_seconds() |
||
| 24 | yield s |
||
| 25 | |||
| 26 | |||
| 27 | series = list(commit_interval('erivlis', 'graphinate')) |
||
| 28 | series.reverse() |
||
| 29 | |||
| 30 | print(series) |
||
| 31 |