Skip to content

Commit 89ac06d

Browse files
committed
Turn _ratelimit_resource into class attribute
1 parent 246b825 commit 89ac06d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

github3/models.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GitHubCore(object):
3131
basic attributes and methods to other sub-classes that are very useful to
3232
have.
3333
"""
34+
_ratelimit_resource = 'core'
3435

3536
def __init__(self, json, session=None):
3637
if hasattr(session, 'session'):
@@ -42,7 +43,6 @@ def __init__(self, json, session=None):
4243

4344
# set a sane default
4445
self._github_url = 'https://api.github.com'
45-
self._ratelimit_resource = 'core'
4646

4747
if json is not None:
4848
self.etag = json.pop('ETag', None)
@@ -507,6 +507,4 @@ def _repr(self):
507507

508508
class GitHubSearch(GitHubCore):
509509
"""The base object for all search objects."""
510-
def __init__(self, json, session=None):
511-
super(GitHubSearch, self).__init__(json, session)
512-
self._ratelimit_resource = 'search'
510+
_ratelimit_resource = 'search'

github3/structs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class SearchIterator(GitHubIterator):
129129
class. For other members and methods, check its parent class.
130130
131131
"""
132+
_ratelimit_resource = 'search'
132133

133134
def __init__(self, count, url, cls, session, params=None, etag=None,
134135
headers=None):
@@ -138,7 +139,6 @@ def __init__(self, count, url, cls, session, params=None, etag=None,
138139
self.total_count = 0
139140
#: Items array returned in the last request
140141
self.items = []
141-
self._ratelimit_resource = 'search'
142142

143143
def _repr(self):
144144
return '<SearchIterator [{0}, {1}?{2}]>'.format(self.count, self.path,

0 commit comments

Comments
 (0)