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

Commit878f0bb

Browse files
committed
We're not support py2.5 so to the future.
The old method of string formatting (using %) is the way of the past and usingstr.format() is the way of the future so why not use it?
1 parent80191b1 commit878f0bb

File tree

10 files changed

+39
-39
lines changed

10 files changed

+39
-39
lines changed

‎github3/event.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, event, session=None):
3333
Organization(self._org,self._session)
3434

3535
def__repr__(self):
36-
return'<Event [%s]>'%self._type[:-5]
36+
return'<Event [{0}]>'.format(self._type[:-5])
3737

3838
@property
3939
defactor(self):

‎github3/gist.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, attributes):
2626
self._content=attributes.get('content')
2727

2828
def__repr__(self):
29-
return'<Gist File [%s]>'%self._name
29+
return'<Gist File [{0}]>'.format(self._name)
3030

3131
@property
3232
defcontent(self):
@@ -63,7 +63,7 @@ def __init__(self, comment, session=None):
6363
super(GistComment,self).__init__(comment,session)
6464

6565
def__repr__(self):
66-
return'<Gist Comment [%s]>'%self._user.login
66+
return'<Gist Comment [{0}]>'.format(self._user.login)
6767

6868

6969
classGist(GitHubCore):
@@ -79,7 +79,7 @@ def __init__(self, data, session=None):
7979
self._update_(data)
8080

8181
def__repr__(self):
82-
return'<Gist [%s]>'%self._id
82+
return'<Gist [{0}]>'.format(self._id)
8383

8484
def_update_(self,data):
8585
self._json_data=data

‎github3/git.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, blob):
2424
self._decoded=self._content
2525

2626
def__repr__(self):
27-
return'<Blob [%0.10s]>'%self._decoded
27+
return'<Blob [{0:.10}]>'.format(self._decoded)
2828

2929
@property
3030
defcontent(self):
@@ -53,7 +53,7 @@ def __init__(self, data, session=None):
5353
self._api=data.get('url')
5454

5555
def__repr__(self):
56-
return'<github3-gitdata at 0x%x>'%id(self)
56+
return'<github3-gitdata at 0x{0:x}>'.format(id(self))
5757

5858
@property
5959
defsha(self):
@@ -93,7 +93,7 @@ def __init__(self, commit, session=None):
9393
self._tree=Tree(commit.get('tree'),self._session)
9494

9595
def__repr__(self):
96-
return'<Commit [%s:%s]>'%(self._author_name,self._sha)
96+
return'<Commit [{0}:{1}]>'.format(self._author_name,self._sha)
9797

9898
@property
9999
defauthor(self):
@@ -120,7 +120,7 @@ def __init__(self, ref, session=None):
120120
self._update_(ref)
121121

122122
def__repr__(self):
123-
return'<Reference [%s]>'%self._ref
123+
return'<Reference [{0}]>'.format(self._ref)
124124

125125
def_update_(self,ref):
126126
self._ref=ref.get('ref')
@@ -169,7 +169,7 @@ def __init__(self, obj):
169169
self._type=obj.get('type')
170170

171171
def__repr__(self):
172-
return'<Git Object [%s]>'%self._sha
172+
return'<Git Object [{0}]>'.format(self._sha)
173173

174174
@property
175175
deftype(self):
@@ -188,7 +188,7 @@ def __init__(self, tag):
188188
self._obj=GitObject(tag.get('object'))
189189

190190
def__repr__(self):
191-
return'<Tag [%s]>'%self._tag
191+
return'<Tag [{0}]>'.format(self._tag)
192192

193193
@property
194194
defmessage(self):
@@ -214,7 +214,7 @@ def __init__(self, tree, session=None):
214214
self._tree= [Hash(t)fortintree.get('tree', [])]
215215

216216
def__repr__(self):
217-
return'<Tree [%s]>'%self._sha
217+
return'<Tree [{0}]>'.format(self._sha)
218218

219219
defrecurse(self):
220220
"""Recurse into the tree.

‎github3/github.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, login='', password=''):
3434
self.login(login,password)
3535

3636
def__repr__(self):
37-
return'<GitHub at 0x%x>'%id(self)
37+
return'<GitHub at 0x{0:x}>'.format(id(self))
3838

3939
def_list_follow(self,which):
4040
url=self._build_url('user',which)
@@ -729,7 +729,7 @@ def __init__(self, auth, session):
729729
self._update_(auth)
730730

731731
def__repr__(self):
732-
return'<Authorization [%s]>'%self._app.get('name','')
732+
return'<Authorization [{0}]>'.format(self._app.get('name',''))
733733

734734
def_update_(self,auth):
735735
self._app=auth.get('app', {})

‎github3/issue.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, label, session=None):
2020
self._update_(label)
2121

2222
def__repr__(self):
23-
return'<Label [%s]>'%self._name
23+
return'<Label [{0}]>'.format(self._name)
2424

2525
def_update_(self,label):
2626
self._json_data=label
@@ -77,7 +77,7 @@ def __init__(self, mile, session=None):
7777
self._update_(mile)
7878

7979
def__repr__(self):
80-
return'<Milestone [%s]>'%self._title
80+
return'<Milestone [{0}]>'.format(self._title)
8181

8282
def_update_(self,mile):
8383
self._json_data=mile
@@ -194,7 +194,7 @@ def __init__(self, issue, session=None):
194194
self._update_(issue)
195195

196196
def__repr__(self):
197-
return'<Issue [%s/%s #%s]>'%(self._repo[0],self._repo[1],
197+
return'<Issue [{0}/{1} #{2}]>'.format(self._repo[0],self._repo[1],
198198
self._num)
199199

200200
def_update_(self,issue):
@@ -468,7 +468,7 @@ def __init__(self, comment, session=None):
468468
self._user=User(comment.get('user'),self._session)
469469

470470
def__repr__(self):
471-
return'<Issue Comment [%s]>'%self._user.login
471+
return'<Issue Comment [{0}]>'.format(self._user.login)
472472

473473
@property
474474
defupdated_at(self):
@@ -521,7 +521,7 @@ def __init__(self, event, issue=None):
521521
self._pull_patch=pull_req.get('patch_url')
522522

523523
def__repr__(self):
524-
return'<Issue Event [#%s -%s -%s]>'% (str(self._issue.number),
524+
return'<Issue Event [#{0} -{1} -{2}]>'.format(self._issue.number,
525525
self._event,self._actor.login)
526526

527527
@property

‎github3/legacy.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, issue, session=None):
4141
self._state=issue.get('state','')
4242

4343
def__repr__(self):
44-
return'<Legacy Issue [%s:%s]>'%(self._user,self._num)
44+
return'<Legacy Issue [{0}:{1}]>'.format(self._user,self._num)
4545

4646
@property
4747
defbody(self):
@@ -143,7 +143,7 @@ def __init__(self, repo, session=None):
143143
self._watchers=repo.get('watchers',0)
144144

145145
def__repr__(self):
146-
return'<Legacy Repo [%s/%s]>'%(self._owner,self._name)
146+
return'<Legacy Repo [{0}/{1}]>'.format(self._owner,self._name)
147147

148148
@property
149149
defcreated(self):
@@ -286,7 +286,7 @@ def __init__(self, user, session=None):
286286
# username: same as login
287287

288288
def__repr__(self):
289-
return'<Legacy User [%s]>'%self._login
289+
return'<Legacy User [{0}]>'.format(self._login)
290290

291291
@property
292292
defcreated(self):

‎github3/models.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, json, ses=None):
2828
self._remaining=5000
2929

3030
def__repr__(self):
31-
return'<github3-core at 0x%x>'%id(self)
31+
return'<github3-core at 0x{0:x}>'.format(id(self))
3232

3333
def_json(self,request,status_code):
3434
ret=None
@@ -130,7 +130,7 @@ def __init__(self, comment, session):
130130
self._update_(comment)
131131

132132
def__repr__(self):
133-
return'<github3-comment at 0x%x>'%id(self)
133+
return'<github3-comment at 0x{0:x}>'.format(id(self))
134134

135135
def_update_(self,comment):
136136
self._json_data=comment
@@ -384,7 +384,7 @@ def __init__(self, resp):
384384
self._errors=error.get('errors')
385385

386386
def__repr__(self):
387-
return'<Error [%s]>'%(self._messageorself._code)
387+
return'<Error [{0}]>'.format(self._messageorself._code)
388388

389389
def__str__(self):
390390
ifnotself._errors:

‎github3/org.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, team, session=None):
1919
self._update_(team)
2020

2121
def__repr__(self):
22-
return'<Team [%s]>'%self._name
22+
return'<Team [{0}]>'.format(self._name)
2323

2424
def_update_(self,team):
2525
self._json_data=team
@@ -212,7 +212,7 @@ def __init__(self, org, session=None):
212212
self._type='Organization'
213213

214214
def__repr__(self):
215-
return'<Organization [%s:%s]>'%(self._login,self._name)
215+
return'<Organization [{0}:{1}]>'.format(self._login,self._name)
216216

217217
def_list_members(self,tail):
218218
"""List members of this organization."""

‎github3/pulls.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, dest, direction):
3030
self._repo_owner=dest['repo']['owner'].get('login')
3131

3232
def__repr__(self):
33-
return'<%s [%s]>'%(self._dir,self._label)
33+
return'<{0} [{1}]>'.format(self._dir,self._label)
3434

3535
@property
3636
deflabel(self):
@@ -73,7 +73,7 @@ def __init__(self, pfile):
7373
self._patch=pfile.get('patch')
7474

7575
def__repr__(self):
76-
return'<Pull Request File [%s]>'%self._name
76+
return'<Pull Request File [{0}]>'.format(self._name)
7777

7878
@property
7979
defadditions(self):
@@ -128,7 +128,7 @@ def __init__(self, pull, session=None):
128128
self._update_(pull)
129129

130130
def__repr__(self):
131-
return'<Pull Request [#%d]>'%self._num
131+
return'<Pull Request [#{0}]>'.format(self._num)
132132

133133
def_update_(self,pull):
134134
self._json_data=pull
@@ -358,7 +358,7 @@ def __init__(self, comment, session=None):
358358
super(ReviewComment,self).__init__(comment,session)
359359

360360
def__repr__(self):
361-
return'<Review Comment [%s]>'%self._user.login
361+
return'<Review Comment [{0}]>'.format(self._user.login)
362362

363363
@property
364364
defcommit_id(self):

‎github3/repo.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, repo, session=None):
2525
self._update_(repo)
2626

2727
def__repr__(self):
28-
return'<Repository [%s/%s]>'%(self._owner.login,self._name)
28+
return'<Repository [{0}/{1}]>'.format(self._owner.login,self._name)
2929

3030
def_update_(self,repo):
3131
self._json_data=repo
@@ -1279,7 +1279,7 @@ def __init__(self, branch, session=None):
12791279
self._links=branch.get('_links', {})
12801280

12811281
def__repr__(self):
1282-
return'<Repository Branch [%s]>'%self._name
1282+
return'<Repository Branch [{0}]>'.format(self._name)
12831283

12841284
@property
12851285
defcommit(self):
@@ -1330,7 +1330,7 @@ def __init__(self, content):
13301330
self._type=content.get('type')
13311331

13321332
def__repr__(self):
1333-
return'<Content [%s]>'%self.path
1333+
return'<Content [{0}]>'.format(self.path)
13341334

13351335
@property
13361336
defcontent(self):
@@ -1400,7 +1400,7 @@ def __init__(self, download, session=None):
14001400
self._type=download.get('content_type')
14011401

14021402
def__repr__(self):
1403-
return'<Download [%s]>'%self.name
1403+
return'<Download [{0}]>'.format(self.name)
14041404

14051405
@property
14061406
defcontent_type(self):
@@ -1465,7 +1465,7 @@ def __init__(self, hook, session=None):
14651465
self._update_(hook)
14661466

14671467
def__repr__(self):
1468-
return'<Hook [%s]>'%self._name
1468+
return'<Hook [{0}]>'.format(self._name)
14691469

14701470
def_update_(self,hook):
14711471
self._json_data=hook
@@ -1586,7 +1586,7 @@ def __init__(self, tag):
15861586
self._commit=tag.get('commit', {})
15871587

15881588
def__repr__(self):
1589-
return'<Repository Tag [%s]>'%self._name
1589+
return'<Repository Tag [{0}]>'.format(self._name)
15901590

15911591
@property
15921592
defcommit(self):
@@ -1619,7 +1619,7 @@ def __init__(self, comment, session=None):
16191619
self._update_(comment)
16201620

16211621
def__repr__(self):
1622-
return'<Repository Comment [%s]>'%self._user.login
1622+
return'<Repository Comment [{0}]>'.format(self._user.login)
16231623

16241624
def_update_(self,comment):
16251625
super(RepoComment,self)._update_(comment)
@@ -1721,7 +1721,7 @@ def __init__(self, commit, session=None):
17211721
append(type('RepoCommit File', (object, ),f))
17221722

17231723
def__repr__(self):
1724-
return'<Repository Commit [%s]>'%self._sha
1724+
return'<Repository Commit [{0}]>'.format(self._sha)
17251725

17261726
@property
17271727
defadditions(self):
@@ -1781,7 +1781,7 @@ def __init__(self, compare):
17811781
self._files=compare.get('files')
17821782

17831783
def__repr__(self):
1784-
return'<Comparison of%d commits>'%self.total_commits
1784+
return'<Comparison of{0} commits>'.format(self.total_commits)
17851785

17861786
@property
17871787
defahead_by(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp