8000 Excise NullObject from github3.py · pythonthings/github3.py@9cab370 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9cab370

Browse files
committed
Excise NullObject from github3.py
As part of on going work to improve the overall design and simplicity, we're removing the NullObject and it's usage. At the present time, it causes a lot of confusion for users (not as much as Empty, but still up there) and there are simpler ways of designing the library than this. Related-to sigmavirus24#670
1 parent 0ace1a7 commit 9cab370

File tree

4 files changed

+3
-69
lines changed

4 files changed

+3
-69
lines changed

github3/api.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def login(username=None, password=None, token=None, two_factor_callback=None):
4747
4848
To allow you to specify either a username and password combination or
4949
a token, none of the parameters are required. If you provide none of
50-
them, you will receive a
51-
:class:`NullObject <github3.null.NullObject>`
50+
them, you will receive ``None``.
5251
5352
:param str username: login name
5453
:param str password: password for the login
@@ -75,8 +74,7 @@ def enterprise_login(username=None, password=None, token=None, url=None,
7574
7675
To allow you to specify either a username and password combination or
7776
a token, none of the parameters are required. If you provide none of
78-
them, you will receive a
79-
:class:`NullObject <github3.structs.NullObject>`
77+
them, you will receive ``None``.
8078
8179
:param str username: login name
8280
:param str password: password for the login

github3/github.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,7 @@ def create_issue(self, owner, repository, title, body=None, assignee=None,
284284
if owner and repository and title:
285285
repo = self.repository(owner, repository)
286286

287-
# repo can be None or a NullObject.
288-
# If repo is None, than one of owner, repository, or title were
289-
# False-y. If repo is a NullObject then owner/repository 404's.
290-
291287
if repo is not None:
292-
# If repo is a NullObject then that's most likely because the
293-
# repository was not found (404). In that case, calling the
294-
# create_issue method will still return <NullObject('Repository')>
295-
# which will ideally help the user understand what went wrong.
296288
return repo.create_issue(title, body, assignee, milestone, labels)
297289

298290
return self._instance_or_null(Issue, None)

github3/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from . import exceptions
1919
from .decorators import requires_auth
20-
from .null import NullObject
2120
from .session import GitHubSession
2221
from .utils import UTC
2322

@@ -198,7 +197,7 @@ def _instance_or_null(self, instance_class, json):
198197
"GitHub's API returned a body that could not be handled", json
199198
)
200199
if not json:
201-
return NullObject(instance_class.__name__)
200+
return None
202201
try:
203202
return instance_class(json, self)
204203
except TypeError: # instance_class is not a subclass of GitHubCore

github3/null.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0