Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e55354

Browse files
committed
Merge tag '0.9.5' into debian
Release v0.9.5
2 parentsff65242 +c4c3fc3 commit6e55354

File tree

13 files changed

+124
-59
lines changed

13 files changed

+124
-59
lines changed

‎AUTHORS.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ Contributors
8080
- Marc Abramowitz (@msabramo)
8181

8282
- Adrian Moisey (@adrianmoisey)
83+
84+
- Lars Holm Nielsen (@larshankat)
85+

‎HISTORY.rst‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
History/Changelog
22
-----------------
33

4+
0.9.5: 2016-02-15
5+
~~~~~~~~~~~~~~~~~
6+
7+
- Fix Validation Error stemming from ``Repository#create_status`` having
8+
poorly chosen default arguments and not removing ``None`` values from the
9+
body of the request.
10+
11+
0.9.4: 2015-04-17
12+
~~~~~~~~~~~~~~~~~
13+
14+
- In ``PullRequest#create_review_comment`` coerce the position argument to an
15+
integer instead of coercing it to a string. Reported by Paul Tagliamonte in
16+
#374.
17+
18+
- Backport support for the ``context`` parameter in
19+
``Repository#create_status``
20+
21+
- Add support for ``Repository.permissions`` attribute
22+
23+
- Backport of support for allowing ``Event``\s to keep the same session as
24+
other objects.
25+
26+
- Skip objects that are ``None`` while iterating over them (see issues #304
27+
and #305) reported by Marc Abramowitz
28+
29+
- Fix URL regular expression for GitHub Enterprise instances by Marc
30+
Abramowitz
31+
432
0.9.3: 2014-11-04
533
~~~~~~~~~~~~~~~~~
634

‎github3/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
__author__='Ian Cordasco'
1515
__license__='Modified BSD'
1616
__copyright__='Copyright 2012-2014 Ian Cordasco'
17-
__version__='0.9.3'
17+
__version__='0.9.5'
1818
__version_info__=tuple(int(i)foriin__version__.split('.'))
1919

2020
from .apiimport*

‎github3/events.py‎

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"""
99
from __future__importunicode_literals
1010

11-
from .modelsimportGitHubObject
11+
from .modelsimportGitHubCore
1212

1313

14-
classEvent(GitHubObject):
14+
classEvent(GitHubCore):
1515

1616
"""The :class:`Event <Event>` object. It structures and handles the data
1717
returned by via the `Events <http://developer.github.com/v3/events>`_
@@ -29,8 +29,8 @@ class Event(GitHubObject):
2929
3030
"""
3131

32-
def__init__(self,event):
33-
super(Event,self).__init__(event)
32+
def__init__(self,event,session=None):
33+
super(Event,self).__init__(event,session)
3434
from .usersimportUser
3535
from .orgsimportOrganization
3636
#: :class:`User <github3.users.User>` object representing the actor.
@@ -48,7 +48,7 @@ def __init__(self, event):
4848
handler=_payload_handlers.get(self.type,identity)
4949
#: Dictionary with the payload. Payload structure is defined by type_.
5050
# _type: http://developer.github.com/v3/events/types
51-
self.payload=handler(event.get('payload'))
51+
self.payload=handler(event.get('payload'),self)
5252
#: Return ``tuple(owner, repository_name)``
5353
self.repo=event.get('repo')
5454
ifself.repoisnotNone:
@@ -74,94 +74,102 @@ def is_public(self):
7474
returnself.public
7575

7676

77-
def_commitcomment(payload):
77+
def_commitcomment(payload,session):
7878
from .repos.commentimportRepoComment
7979
ifpayload.get('comment'):
80-
payload['comment']=RepoComment(payload['comment'],None)
80+
payload['comment']=RepoComment(payload['comment'],session)
8181
returnpayload
8282

8383

84-
def_follow(payload):
84+
def_follow(payload,session):
8585
from .usersimportUser
8686
ifpayload.get('target'):
87-
payload['target']=User(payload['target'],None)
87+
payload['target']=User(payload['target'],session)
8888
returnpayload
8989

9090

91-
def_forkev(payload):
91+
def_forkev(payload,session):
9292
from .reposimportRepository
9393
ifpayload.get('forkee'):
94-
payload['forkee']=Repository(payload['forkee'],None)
94+
payload['forkee']=Repository(payload['forkee'],session)
9595
returnpayload
9696

9797

98-
def_gist(payload):
98+
def_gist(payload,session):
9999
from .gistsimportGist
100100
ifpayload.get('gist'):
101-
payload['gist']=Gist(payload['gist'],None)
101+
payload['gist']=Gist(payload['gist'],session)
102102
returnpayload
103103

104104

105-
def_issuecomm(payload):
105+
def_issuecomm(payload,session):
106106
from .issuesimportIssue
107107
from .issues.commentimportIssueComment
108108
ifpayload.get('issue'):
109-
payload['issue']=Issue(payload['issue'],None)
109+
payload['issue']=Issue(payload['issue'],session)
110110
ifpayload.get('comment'):
111-
payload['comment']=IssueComment(payload['comment'],None)
111+
payload['comment']=IssueComment(payload['comment'],session)
112112
returnpayload
113113

114114

115-
def_issueevent(payload):
115+
def_issueevent(payload,session):
116116
from .issuesimportIssue
117117
ifpayload.get('issue'):
118-
payload['issue']=Issue(payload['issue'],None)
118+
payload['issue']=Issue(payload['issue'],session)
119119
returnpayload
120120

121121

122-
def_member(payload):
122+
def_member(payload,session):
123123
from .usersimportUser
124124
ifpayload.get('member'):
125-
payload['member']=User(payload['member'],None)
125+
payload['member']=User(payload['member'],session)
126126
returnpayload
127127

128128

129-
def_pullreqev(payload):
129+
def_pullreqev(payload,session):
130130
from .pullsimportPullRequest
131131
ifpayload.get('pull_request'):
132-
payload['pull_request']=PullRequest(payload['pull_request'],None)
132+
payload['pull_request']=PullRequest(payload['pull_request'],
133+
session)
133134
returnpayload
134135

135136

136-
def_pullreqcomm(payload):
137-
from .pullsimportReviewComment
138-
ifpayload.get('comment'):
139-
payload['comment']=ReviewComment(payload['comment'],None)
137+
def_pullreqcomm(payload,session):
138+
from .pullsimportPullRequest,ReviewComment
139+
# Transform the Pull Request attribute
140+
pull=payload.get('pull_request')
141+
ifpull:
142+
payload['pull_request']=PullRequest(pull,session)
143+
144+
# Transform the Comment attribute
145+
comment=payload.get('comment')
146+
ifcomment:
147+
payload['comment']=ReviewComment(comment,session)
140148
returnpayload
141149

142150

143-
def_release(payload):
151+
def_release(payload,session):
144152
from .repos.releaseimportRelease
145153
release=payload.get('release')
146154
ifrelease:
147-
payload['release']=Release(release)
155+
payload['release']=Release(release,session)
148156
returnpayload
149157

150158

151-
def_team(payload):
159+
def_team(payload,session):
152160
from .orgsimportTeam
153161
from .reposimportRepository
154162
from .usersimportUser
155163
ifpayload.get('team'):
156-
payload['team']=Team(payload['team'],None)
164+
payload['team']=Team(payload['team'],session)
157165
ifpayload.get('repo'):
158-
payload['repo']=Repository(payload['repo'],None)
166+
payload['repo']=Repository(payload['repo'],session)
159167
ifpayload.get('sender'):
160-
payload['sender']=User(payload['sender'],None)
168+
payload['sender']=User(payload['sender'],session)
161169
returnpayload
162170

163171

164-
defidentity(x):
172+
defidentity(x,session):
165173
returnx
166174

167175

@@ -177,7 +185,7 @@ def identity(x):
177185
'IssueCommentEvent':_issuecomm,
178186
'IssuesEvent':_issueevent,
179187
'MemberEvent':_member,
180-
'PublicEvent':lambdax:'',
188+
'PublicEvent':identity,
181189
'PullRequestEvent':_pullreqev,
182190
'PullRequestReviewCommentEvent':_pullreqcomm,
183191
'PushEvent':identity,

‎github3/github.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ def pubsubhubbub(self, mode, topic, callback, secret=''):
10001000
:returns: bool
10011001
"""
10021002
fromreimportmatch
1003-
m=match('https://[\w\d\-\.\:]+/\w+/[\w\._-]+/events/\w+',topic)
1003+
m=match('https?://[\w\d\-\.\:]+/\w+/[\w\._-]+/events/\w+',topic)
10041004
status=False
10051005
ifmodeandtopicandcallbackandm:
10061006
data= [('hub.mode',mode), ('hub.topic',topic),
@@ -1478,7 +1478,7 @@ def zen(self):
14781478
classGitHubEnterprise(GitHub):
14791479
"""For GitHub Enterprise users, this object will act as the public API to
14801480
your instance. You must provide the URL to your instance upon
1481-
initializaiton and can provide the rest of the login details just like in
1481+
initialization and can provide the rest of the login details just like in
14821482
the :class:`GitHub <GitHub>` object.
14831483
14841484
There is no need to provide the end of the url (e.g., /api/v3/), that will

‎github3/issues/issue.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, issue, session=None):
7777
self.number=issue.get('number')
7878
#: Dictionary URLs for the pull request (if they exist)
7979
self.pull_request=issue.get('pull_request')
80-
m=match('https://[\w\d\-\.\:]+/(\S+)/(\S+)/(?:issues|pull)/\d+',
80+
m=match('https?://[\w\d\-\.\:]+/(\S+)/(\S+)/(?:issues|pull)/\d+',
8181
self.html_url)
8282
#: Returns ('owner', 'repository') this issue was filed on.
8383
self.repository=m.groups()

‎github3/pulls.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __init__(self, pull, session=None):
183183
#: GitHub.com url for review comments (not a template)
184184
self.review_comments_url=pull.get('review_comments_url')
185185

186-
m=match('https://[\w\d\-\.\:]+/(\S+)/(\S+)/(?:issues|pull)?/\d+',
186+
m=match('https?://[\w\d\-\.\:]+/(\S+)/(\S+)/(?:issues|pull)?/\d+',
187187
self.issue_url)
188188
#: Returns ('owner', 'repository') this issue was filed on.
189189
self.repository=m.groups()
@@ -233,7 +233,7 @@ def create_review_comment(self, body, commit_id, path, position):
233233
"""
234234
url=self._build_url('comments',base_url=self._api)
235235
data= {'body':body,'commit_id':commit_id,'path':path,
236-
'position':str(position)}
236+
'position':int(position)}
237237
json=self._json(self._post(url,data=data),201)
238238
returnReviewComment(json,self)ifjsonelseNone
239239

@@ -300,18 +300,18 @@ def iter_issue_comments(self, number=-1, etag=None):
300300
returnself._iter(int(number),url,IssueComment,etag=etag)
301301

302302
@requires_auth
303-
defmerge(self,commit_message=''):
303+
defmerge(self,commit_message='',sha=None):
304304
"""Merge this pull request.
305305
306306
:param str commit_message: (optional), message to be used for the
307307
merge commit
308308
:returns: bool
309309
"""
310-
data=None
311-
ifcommit_message:
312-
data=dumps({'commit_message':commit_message})
310+
parameters={'commit_message':commit_message}
311+
ifsha:
312+
parameters['sha']=sha
313313
url=self._build_url('merge',base_url=self._api)
314-
json=self._json(self._put(url,data=data),200)
314+
json=self._json(self._put(url,data=dumps(parameters)),200)
315315
self.merge_commit_sha=json['sha']
316316
returnjson['merged']
317317

‎github3/repos/repo.py‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ def __init__(self, repo, session=None):
122122

123123
#: Is this repository private?
124124
self.private=repo.get('private')
125+
126+
#: Permissions for this repository
127+
self.permissions=repo.get('permissions')
128+
125129
#: ``datetime`` object representing the last time commits were pushed
126130
#: to the repository.
127131
self.pushed_at=self._strptime(repo.get('pushed_at'))
@@ -782,20 +786,26 @@ def create_release(self, tag_name, target_commitish=None, name=None,
782786
returnRelease(json,self)
783787

784788
@requires_auth
785-
defcreate_status(self,sha,state,target_url='',description=''):
789+
defcreate_status(self,sha,state,target_url=None,description=None,
790+
context='default'):
786791
"""Create a status object on a commit.
787792
788793
:param str sha: (required), SHA of the commit to create the status on
789794
:param str state: (required), state of the test; only the following
790795
are accepted: 'pending', 'success', 'error', 'failure'
791796
:param str target_url: (optional), URL to associate with this status.
792797
:param str description: (optional), short description of the status
798+
:param str context: (optional), A string label to differentiate this
799+
status from the status of other systems
800+
:returns: the status created if successful
801+
:rtype: :class:`~github3.repos.status.Status`
793802
"""
794-
json={}
803+
json=None
795804
ifshaandstate:
796805
data= {'state':state,'target_url':target_url,
797-
'description':description}
806+
'description':description,'context':context}
798807
url=self._build_url('statuses',sha,base_url=self._api)
808+
self._remove_none(data)
799809
json=self._json(self._post(url,data=data),201)
800810
returnStatus(json)ifjsonelseNone
801811

‎github3/structs.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def __iter__(self):
7979
json=json.items()
8080

8181
foriinjson:
82+
ifiisNone:# Temporary fix for GitHub Enterprise and #304
83+
continue
8284
yieldcls(i,self)ifissubclass(cls,GitHubCore)elsecls(i)
8385
self.count-=1ifself.count>0else0
8486
ifself.count==0:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp