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