Skip to content

Commit 876ff10

Browse files
authored
Sync GitBlob class with API spec (#3125)
Fixes schemas list and code style.
1 parent a69f1d6 commit 876ff10

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

github/GitBlob.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
# #
3737
################################################################################
3838

39-
from typing import Any, Dict
39+
from __future__ import annotations
40+
41+
from typing import Any
4042

4143
from github.GithubObject import Attribute, CompletableGithubObject, NotSet
4244

@@ -49,9 +51,7 @@ class GitBlob(CompletableGithubObject):
4951
https://docs.github.com/en/rest/reference/git#blobs
5052
5153
The OpenAPI schema can be found at
52-
- /components/schemas/repository-rule-violation-error
5354
- /components/schemas/short-blob
54-
- /components/schemas/validation-error
5555
5656
"""
5757

@@ -90,7 +90,7 @@ def url(self) -> str:
9090
self._completeIfNotSet(self._url)
9191
return self._url.value
9292

93-
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
93+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
9494
if "content" in attributes: # pragma no branch
9595
self._content = self._makeStringAttribute(attributes["content"])
9696
if "encoding" in attributes: # pragma no branch

tests/GitBlob.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
# #
3434
################################################################################
3535

36+
from __future__ import annotations
37+
3638
from . import Framework
3739

3840

@@ -54,12 +56,12 @@ def testAttributes(self):
5456
)
5557
self.assertEqual(len(self.blob.content), 1757)
5658
self.assertEqual(self.blob.encoding, "base64")
57-
self.assertEqual(self.blob.size, 1295)
5859
self.assertEqual(self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667")
5960
self.assertEqual(
6061
self.blob.url,
6162
"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667",
6263
)
64+
self.assertEqual(self.blob.size, 1295)
6365
self.assertEqual(
6466
repr(self.blob),
6567
'GitBlob(sha="53bce9fa919b4544e67275089b3ec5b44be20667")',

0 commit comments

Comments
 (0)