mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
fix wrong expectance on requestJsonAndCheck() returning {} if no data
When there's no data, requestJsonAndCheck(), or rather
__structuredFromJson() returns None rather than {}.
As both None & {} evaluates to false, 'if not data:' will give the
correct behaviour regardless of returning {} or None.
This commit is contained in:
@@ -1797,7 +1797,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
"GET",
|
||||
self.url + "/stats/contributors"
|
||||
)
|
||||
if data == {}:
|
||||
if not data:
|
||||
return None
|
||||
else:
|
||||
return [
|
||||
@@ -1814,7 +1814,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
"GET",
|
||||
self.url + "/stats/commit_activity"
|
||||
)
|
||||
if data == {}:
|
||||
if not data:
|
||||
return None
|
||||
else:
|
||||
return [
|
||||
@@ -1831,7 +1831,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
"GET",
|
||||
self.url + "/stats/code_frequency"
|
||||
)
|
||||
if data == {}:
|
||||
if not data:
|
||||
return None
|
||||
else:
|
||||
return [
|
||||
@@ -1848,7 +1848,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
"GET",
|
||||
self.url + "/stats/participation"
|
||||
)
|
||||
if data == {}:
|
||||
if not data:
|
||||
return None
|
||||
else:
|
||||
return github.StatsParticipation.StatsParticipation(self._requester, headers, data, completed=True)
|
||||
@@ -1862,7 +1862,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
"GET",
|
||||
self.url + "/stats/punch_card"
|
||||
)
|
||||
if data == {}:
|
||||
if not data:
|
||||
return None
|
||||
else:
|
||||
return github.StatsPunchCard.StatsPunchCard(self._requester, headers, data, completed=True)
|
||||
|
||||
Reference in New Issue
Block a user