PyLinks 0.0.0.dev42__py3-none-any.whl → 0.0.0.dev44__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyLinks
3
- Version: 0.0.0.dev42
3
+ Version: 0.0.0.dev44
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: requests <3,>=2.31.0
6
- Requires-Dist: ExceptionMan ==0.0.0.dev29
7
- Requires-Dist: MDit ==0.0.0.dev29
6
+ Requires-Dist: ExceptionMan ==0.0.0.dev31
7
+ Requires-Dist: MDit ==0.0.0.dev31
8
8
 
@@ -6,7 +6,7 @@ pylinks/string.py,sha256=yoORoiILKAKzzfDw-bwePBTwb3Shr_RvOSB2tdEZuSU,1397
6
6
  pylinks/url.py,sha256=4YzmNn0U1nzWmcdzEW6RKaZd5uu-MZRimHGl5Xi60Cg,7815
7
7
  pylinks/api/__init__.py,sha256=q7hhZabjTajBYxDxzJy44y8Rx_-5sye9VnVnkytIua8,488
8
8
  pylinks/api/doi.py,sha256=7YnMqy4_Ct2sw9Wz4mQC5S4xAahwh6fMUPKAx_qqj-M,5899
9
- pylinks/api/github.py,sha256=_2l9jh0p26bsfYd5ioLqKqvTiBuGsH03pzgAC0uJXRY,73874
9
+ pylinks/api/github.py,sha256=dYBkDvzkTdQMigtvec9wJYR5pItQY1aGgSBrlEgKhxc,74882
10
10
  pylinks/api/orcid.py,sha256=e0DAuziq7HdGJ4BJOI28mo1emB4_7gPsLxR7VsYPYMA,1377
11
11
  pylinks/api/zenodo.py,sha256=LZwpwwb24rSFqIMpSrflnkcMP1_y8Co4apVGD4PGKNU,5150
12
12
  pylinks/exception/__init__.py,sha256=tU-LvaYi4NsLEZeeUN-JjemhefJ6R_DG37fIMoaZ5a4,89
@@ -23,7 +23,7 @@ pylinks/site/pypi.py,sha256=-NSglDo-k55bALi-aN0iF2I6z1WXsjYOIVDyjNUxuuU,1944
23
23
  pylinks/site/readthedocs.py,sha256=_s27ETa3oRoeDdQvFrrtuSh2my6cjWEIEVhwHz0yZ90,1797
24
24
  pylinks/uri/__init__.py,sha256=W38fMHGgV7mg8uPWC8IMWGgmlCQO9VHIqNpInG2NS2I,29
25
25
  pylinks/uri/data.py,sha256=uD1CipMo4oFpxH8liOY24PsxMyuR5kEH2a0XDkO1dgI,6380
26
- PyLinks-0.0.0.dev42.dist-info/METADATA,sha256=qzr7NHsSXSBEN8pCp8nXM6MgpBV5_adAVqBf6iLaRSg,194
27
- PyLinks-0.0.0.dev42.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
28
- PyLinks-0.0.0.dev42.dist-info/top_level.txt,sha256=LlaTHnPw89VppYU3vCciF81IOSzvc16RkdNkOCqhAcs,8
29
- PyLinks-0.0.0.dev42.dist-info/RECORD,,
26
+ PyLinks-0.0.0.dev44.dist-info/METADATA,sha256=TH_VrNfqNr73rifLAxF6F6QZjfPZn4XfqbwS08AEhKc,194
27
+ PyLinks-0.0.0.dev44.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
28
+ PyLinks-0.0.0.dev44.dist-info/top_level.txt,sha256=LlaTHnPw89VppYU3vCciF81IOSzvc16RkdNkOCqhAcs,8
29
+ PyLinks-0.0.0.dev44.dist-info/RECORD,,
pylinks/api/github.py CHANGED
@@ -31,6 +31,10 @@ class GitHub:
31
31
  def user(self, username) -> "User":
32
32
  return User(username=username, token=self._token)
33
33
 
34
+ def user_from_id(self, user_id) -> "User":
35
+ user_data = self.rest_query(f"user/{user_id}")
36
+ return User(username=user_data["login"], token=self._token)
37
+
34
38
  def graphql_query(
35
39
  self,
36
40
  query: str,
@@ -606,6 +610,35 @@ class Repo:
606
610
  """
607
611
  return self._rest_query(f"pulls/{number}")
608
612
 
613
+ def pull_commits(self, number: int) -> list[dict]:
614
+ """
615
+ Get a list of commits for a pull request.
616
+
617
+ Parameters
618
+ ----------
619
+ number : int
620
+ Pull request number.
621
+
622
+ Returns
623
+ -------
624
+ list[dict]
625
+ A list of commits as dictionaries.
626
+ Commits are ordered by ascending commit date.
627
+
628
+ References
629
+ ----------
630
+ - [GitHub API Docs](https://docs.github.com/en/rest/pulls/commits?apiVersion=2022-11-28#list-commits-on-a-pull-request)
631
+ """
632
+ commits = []
633
+ page = 1
634
+ while True:
635
+ response = self._rest_query(f"pulls/{number}/commits?per_page=100&page={page}")
636
+ commits.extend(response)
637
+ page += 1
638
+ if len(response) < 100:
639
+ break
640
+ return commits
641
+
609
642
  def pull_create(
610
643
  self,
611
644
  head: str,