8000 No longer require session on some classes. · sigmavirus24/github3.py@622cd65 · GitHub
[go: up one dir, main page]

Skip to content

Commit 622cd65

Browse files
committed
No longer require session on some classes.
GitHubCore handles it as part of work towards issue #3.
1 parent d1ce44c commit 622cd65

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

github3/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Event(GitHubCore):
1414
returned by via the `Events <http://developer.github.com/v3/events>`_
1515
section of the GitHub API.
1616
"""
17-
def __init__(self, event, session):
17+
def __init__(self, event, session=None):
1818
super(Event, self).__init__(session)
1919
from .user import User
2020
from .org import Organization

github3/gist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class GistComment(BaseComment):
5959
on a gist.
6060
"""
6161

62-
def __init__(self, comment, session):
62+
def __init__(self, comment, session=None):
6363
super(GistComment, self).__init__(comment, session)
6464

6565
def __repr__(self):
@@ -74,7 +74,7 @@ class Gist(GitHubCore):
7474
have authenticated).
7575
"""
7676

77-
def __init__(self, data, session):
77+
def __init__(self, data, session=None):
7878
super(Gist, self).__init__(session)
7979

8080
self._update_(data)

github3/git.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class GitData(GitHubCore):
4747
the user (developer) ever. This is used to prevent duplication of some
4848
common items among other Git Data objects.
4949
"""
50-
def __init__(self, data, session):
50+
def __init__(self, data, session=None):
5151
super(GitData, self).__init__(session)
5252
self._sha = data.get('sha')
5353
self._api = data.get('url')
@@ -65,7 +65,7 @@ class Commit(BaseCommit):
6565
"""The :class:`Commit <Commit>` object. This represents a commit made in a
6666
repository.
6767
"""
68-
def __init__(self, commit, session):
68+
def __init__(self, commit, session=None):
6969
super(Commit, self).__init__(commit, session)
7070

7171
self._author = ''
@@ -115,7 +115,7 @@ class Reference(GitHubCore):
115115
"""The :class:`Reference <Reference>` object. This represents a reference
116116
created on a repository.
117117
"""
118-
def __init__(self, ref, session):
118+
def __init__(self, ref, session=None):
119119
super(Reference, self).__init__(session)
120120
self._update_(ref)
121121

@@ -208,7 +208,7 @@ def tagger(self):
208208

209209
class Tree(GitData):
210210
"""The :class:`Tree <Tree>` object."""
211-
def __init__(self, tree, session):
211+
def __init__(self, tree, session=None):
212212
super(Tree, self).__init__(tree, session)
213213
self._tree = [Hash(t) for t in tree.get('tree', [])]
214214

github3/issue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Label(GitHubCore):
1616
"""The :class:`Label <Label>` object. Succintly represents a label that
1717
exists in a repository."""
18-
def __init__(self, label, session):
18+
def __init__(self, label, session=None):
1919
super(Label, self).__init__(session)
2020
self._update_(label)
2121

@@ -69,7 +69,7 @@ class Milestone(GitHubCore):
6969
"""The :class:`Milestone <Milestone>` object. This is a small class to
7070
handle information about milestones on repositories and issues.
7171
"""
72-
def __init__(self, mile, session):
72+
def __init__(self, mile, session=None):
7373
super(Milestone, self).__init__(session)
7474
self._update_(mile)
7575

@@ -184,7 +184,7 @@ class Issue(GitHubCore):
184184
returned via the `Issues <http://developer.github.com/v3/issues>`_ section
185185
of the GitHub API.
186186
"""
187-
def __init__(self, issue, session):
187+
def __init__(self, issue, session=None):
188188
super(Issue, self).__init__(session)
189189
self._update_(issue)
190190

@@ -450,7 +450,7 @@ class IssueComment(BaseComment):
450450
"""The :class:`IssueComment <IssueComment>` object. This structures and
451451
handles the comments on issues specifically.
452452
"""
453-
def __init__(self, comment, session):
453+
def __init__(self, comment, session=None):
454454
super(IssueComment, self).__init__(comment, session)
455455
self._user = User(comment.get('user'), self._session)
456456

github3/legacy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LegacyIssue(GitHubCore):
1818
<github3.github.GitHub.search_issues>`. Unfortunately, GitHub hasn't
1919
updated the search functionality to use the objects as they exist now.
2020
"""
21-
def __init__(self, issue, session):
21+
def __init__(self, issue, session=None):
2222
super(LegacyIssue, self).__init__(session)
2323
self._gravid = issue.get('gravatar_id', '')
2424
self._pos = issue.get('position', 0)
@@ -112,7 +112,7 @@ def votes(self):
112112
class LegacyRepo(GitHubCore):
113113
"""The :class:`LegacyRepo <LegacyRepo>` object. This wraps data returned
114114
using the :func:`search_repos <github3.github.GitHub.search_repos>`"""
115-
def __init__(self, repo, session):
115+
def __init__(self, repo, session=None):
116116
super(LegacyRepo, self).__init__(session)
117117
self._created = None
118118
if repo.get('created'):
@@ -260,7 +260,7 @@ class LegacyUser(GitHubCore):
260260
"""The :class:`LegacyUser <LegacyUser>` object. This handles information
261261
returned by :func:`search_users <github3.github.GitHub.search_users>`.
262262
"""
263-
def __init__(self, user, session):
263+
def __init__(self, user, session=None):
264264
super(LegacyUser, self).__init__(session)
265265
self._created = None
266266
if user.get('created'):

github3/org.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class Team(GitHubCore):
17-
def __init__(self, team, session):
17+
def __init__(self, team, session=None):
1818
super(Team, self).__init__(session)
1919
self._update_(team)
2020

@@ -199,7 +199,7 @@ def repos_count(self):
199199

200200
class Organization(BaseAccount):
201201
"""The :class:`Organization <Organization>` object."""
202-
def __init__(self, org, session):
202+
def __init__(self, org, session=None):
203203
super(Organization, self).__init__(org, session)
204204
self._update_(org)
205205
if not self._type:

github3/pulls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def status(self):
123123

124124
class PullRequest(GitHubCore):
125125
"""The :class:`PullRequest <PullRequest>` object."""
126-
def __init__(self, pull, session):
126+
def __init__(self, pull, session=None):
127127
super(PullRequest, self).__init__(session)
128128
self._update_(pull)
129129

@@ -353,7 +353,7 @@ class ReviewComment(BaseComment):
353353
"""The :class:`ReviewComment <ReviewComment>` object. This is used to
354354
represent comments on pull requests.
355355
"""
356-
def __init__(self, comment, session):
356+
def __init__(self, comment, session=None):
357357
super(ReviewComment, self).__init__(comment, session)
358358

359359
def __repr__(self):

0 commit comments

Comments
 (0)
0