mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Remove some uses of atLeastPython3 (#1191)
There are a number of call sites that would behave differently depending on Python 2 or 3. A fair amount of them are left over from Python 3.2 or Python 2.6 were the current versions, and it was much harder to write compatible code for both versions. Happily, that is now in the past, so refactor some of them out.
This commit is contained in:
@@ -39,9 +39,6 @@ import github.GithubObject
|
||||
import github.Repository
|
||||
|
||||
|
||||
atLeastPython3 = sys.hexversion >= 0x03000000
|
||||
|
||||
|
||||
class ContentFile(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
This class represents ContentFiles. The reference can be found here https://developer.github.com/v3/repos/contents/#get-contents
|
||||
@@ -61,11 +58,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject):
|
||||
@property
|
||||
def decoded_content(self):
|
||||
assert self.encoding == "base64", "unsupported encoding: %s" % self.encoding
|
||||
if atLeastPython3:
|
||||
content = bytearray(self.content, "utf-8") # pragma no cover (covered by tests with Python 3.2)
|
||||
else:
|
||||
content = self.content
|
||||
return base64.b64decode(content)
|
||||
return base64.b64decode(bytearray(self.content, "utf-8"))
|
||||
|
||||
@property
|
||||
def download_url(self):
|
||||
|
||||
Reference in New Issue
Block a user