8000 And just when I thought I was doing it right. · doismellburning/github3.py@43b0ce2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 43b0ce2

Browse files
committed
And just when I thought I was doing it right.
1 parent 22d2536 commit 43b0ce2

File tree

9 files changed

+179
-102
lines changed

9 files changed

+179
-102
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Testing
3030

3131
- expecter_ by Gary Bernhardt
3232
- mock_ by Michael Foord
33-
- (optional) coverage_ by Ned Batchelder
33+
- coverage_ by Ned Batchelder
3434

3535
.. _expecter: https://github.com/garybernhardt/expecter
3636
.. _coverage: http://nedbatchelder.com/code/coverage/

github3/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
77
"""
88

9-
from github3.models import GitHubCore
9+
from github3.models import GitHubObject
1010

1111

12-
class Event(GitHubCore):
12+
class Event(GitHubObject):
1313
"""The :class:`Event <Event>` object. It structures and handles the data
1414
returned by via the `Events <http://developer.github.com/v3/events>`_
1515
section of the GitHub API.

github3/models.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,15 @@ def _build_url(self, *args, **kwargs):
136136
__url_cache__[key] = '/'.join(parts)
137137
return __url_cache__[key]
138138

139-
@property
140-
def _api(self):
139+
def _api_getter(self):
141140
return "{0.scheme}://{0.netloc}{0.path}".format(self._uri)
142141

143-
@_api.setter
144-
def _api(self, uri):
142+
def _api_setter(self, uri):
145143
self._uri = urlparse(uri)
146144

145+
_api = property(_api_getter, _api_setter)
146+
del(_api_getter, _api_setter)
147+
147148
def _iter(self, count, url, cls, params=None):
148149
"""Generic iterator for this project.
149150
@@ -183,11 +184,6 @@ def refresh(self):
183184
json = self._json(self._get(self._api), 200)
184185
self.__init__(json, self._session)
185186

186-
@classmethod
187-
def from_json(cls, json):
188-
"""Return an instance of ``cls`` formed from ``json``."""
189-
return cls(json, None)
190-
191187

192188
class BaseComment(GitHubCore):
193189
"""The :class:`BaseComment <BaseComment>` object. A basic class for Gist,

run_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
TEST_DIR = 'tests'
1010

1111
if __name__ == "__main__":
12-
cov = coverage.coverage(source=['github3', 'tests'])
12+
cov = coverage.coverage(source=['github3'])
1313
cov.start()
1414

1515
# list files in directory tests/
@@ -23,3 +23,4 @@
2323

2424
cov.stop()
2525
cov.save()
26+
cov.report(show_missing=False)

tests/json/emails

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
['user@example.com']

tests/json/event

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"created_at": "2012-10-18T01:44:11Z", "actor": {"url": "https://api.github.com/users/steve-rs", "login": "steve-rs", "avatar_url": "https://secure.gravatar.com/avatar/e85ade4f025de0d23046166811840dbc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "id": 1381384, "gravatar_id": "e85ade4f025de0d23046166811840dbc"}, "public": true, "repo": {"url": "https://api.github.com/repos/steve-rs/default", "id": 4259329, "name": "steve-rs/default"}, "id": "1613091092", "type": "PushEvent", "payload": {"size": 1, "head": "1eb1699516dd4003a157a200bf16daeab71bed3f", "commits": [{"distinct": true, "url": "https://api.github.com/repos/steve-rs/default/commits/1eb1699516dd4003a157a200bf16daeab71bed3f", "message": "..", "sha": "1eb1699516dd4003a157a200bf16daeab71bed3f", "author": {"name": "Stephen Bylo", "email": "steve@rightscale.com"}}], "push_id": 112451614, "ref": "refs/heads/master", "before": "a6139aa730a6c71d164f71aa01dc3c49fd40349f"}}

tests/json/user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"public_repos": 22, "public_gists": 5, "name": "Tadas Vilkeliskis", "bio": "", "url": "https://api.github.com/users/tadasv", "created_at": "2008-04-12T14:03:41Z", "html_url": "https://github.com/tadasv", "id": 6939, "blog": "http://tadas.vilkeliskis.com", "company": "Chartbeat, Inc", "avatar_url": "https://secure.gravatar.com/avatar/406bde80fb83ce0322edec4ba710696e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", "_links": {"self": {"href": "https://api.github.com/users/tadasv"}}, "location": "USA", "gravatar_id": "406bde80fb83ce0322edec4ba710696e", "following": 12, "followers": 10, "hireable": false, "type": "User", "email": "vilkeliskis.t@gmail.com", "login": "tadasv"}

0 commit comments

Comments
 (0)
0