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

Commitdefee7a

Browse files
committed
Some minor changes.
1 parent99bf2fd commitdefee7a

File tree

3 files changed

+68
-72
lines changed

3 files changed

+68
-72
lines changed

‎HISTORY.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
History/Changelog
22
=================
33

4+
0.3: xxxx-xx-xx
5+
---------------
6+
7+
- In github3.repos.Repository
8+
9+
- is_fork() and fork return the same thing
10+
- is_private() and private return the same thing as well
11+
- has_downloads, has_issues, has_wiki are now straight attributes
12+
13+
- In github3.repos.Hook
14+
15+
- is_active() and active return the same value
16+
417
0.2: 2012-11-21
518
---------------
619

7-
MAJOR API CHANGES:
20+
-MAJOR API CHANGES:
821

9-
- ``GitHub.iter_subscribed`` --> ``GitHub.iter_subscriptions``
10-
- Broken ``list_*`` functions in github3.api have been renamed to the correct
11-
``iter_*`` methods on ``GitHub``.
12-
- Removed ``list_*`` functions from ``Repository``, ``Gist``,
13-
``Organization``, and ``User`` objects
22+
- ``GitHub.iter_subscribed`` --> ``GitHub.iter_subscriptions``
23+
- Broken ``list_*`` functions in github3.api have been renamed to the correct
24+
``iter_*`` methods on ``GitHub``.
25+
- Removed ``list_*`` functions from ``Repository``, ``Gist``,
26+
``Organization``, and ``User`` objects
1427

1528
- Added zen of GitHub method.
1629
- More tests

‎github3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__author__='Ian Cordasco'
1414
__license__='Modified BSD'
1515
__copyright__='Copyright 2012 Ian Cordasco'
16-
__version__='0.3'
16+
__version__='0.3.dev'
1717

1818
fromgithub3.apiimport*
1919
fromgithub3.githubimportGitHub

‎github3/repos.py

Lines changed: 48 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -26,87 +26,90 @@ class Repository(GitHubCore):
2626
def__init__(self,repo,session=None):
2727
super(Repository,self).__init__(repo,session)
2828
#: URL used to clone via HTTPS.
29-
self.clone_url=repo.get('clone_url')
29+
self.clone_url=repo.get('clone_url','')
3030
#: ``datetime`` object representing when the Repository was created.
3131
self.created_at=self._strptime(repo.get('created_at'))
3232
#: Description of the repository.
33-
self.description=repo.get('description')
33+
self.description=repo.get('description','')
3434

3535
# The number of forks
3636
#: The number of forks made of this repository.
37-
self.forks=repo.get('forks')
37+
self.forks=repo.get('forks',0)
3838

39-
# Is this repository a fork?
40-
self._is_fork=repo.get('fork')
39+
#: Is this repository a fork?
40+
self.fork=repo.get('fork')
4141

4242
# Clone url using git, e.g. git://github.com/sigmavirus24/github3.py
4343
#: Plain git url for an anonymous clone.
44-
self.git_url=repo.get('git_url')
45-
self._has_dl=repo.get('has_downloads')
46-
self._has_issues=repo.get('has_issues')
47-
self._has_wiki=repo.get('has_wiki')
44+
self.git_url=repo.get('git_url','')
45+
#: Whether or not this repository has downloads enabled
46+
self.has_downloads=repo.get('has_downloads')
47+
#: Whether or not this repository has an issue tracker
48+
self.has_issues=repo.get('has_issues')
49+
#: Whether or not this repository has the wiki enabled
50+
self.has_wiki=repo.get('has_wiki')
4851

4952
# e.g. https://sigmavirus24.github.com/github3.py
5053
#: URL of the home page for the project.
51-
self.homepage=repo.get('homepage')
54+
self.homepage=repo.get('homepage','')
5255

5356
# e.g. https://github.com/sigmavirus24/github3.py
5457
#: URL of the project at GitHub.
55-
self.html_url=repo.get('html_url')
58+
self.html_url=repo.get('html_url','')
5659
#: Unique id of the repository.
57-
self.id=repo.get('id')
60+
self.id=repo.get('id',0)
5861
#: Language property.
59-
self.language=repo.get('language')
62+
self.language=repo.get('language','')
6063
#: Mirror property.
61-
self.mirror_url=repo.get('mirror_url')
64+
self.mirror_url=repo.get('mirror_url','')
6265

6366
# Repository name, e.g. github3.py
6467
#: Name of the repository.
65-
self.name=repo.get('name')
68+
self.name=repo.get('name','')
6669

6770
# Number of open issues
6871
#: Number of open issues on the repository.
69-
self.open_issues=repo.get('open_issues')
72+
self.open_issues=repo.get('open_issues',0)
7073

7174
# Repository owner's name
7275
#: :class:`User <github3.users.User>` object representing the
7376
# repository owner.
74-
self.owner=User(repo.get('owner'),self._session)
77+
self.owner=User(repo.get('owner', {}),self._session)
7578

76-
# Is this repository private?
77-
self._priv=repo.get('private')
79+
#: Is this repository private?
80+
self.private=repo.get('private')
7881
#: ``datetime`` object representing the last time commits were pushed
7982
# to the repository.
8083
self.pushed_at=self._strptime(repo.get('pushed_at'))
8184
#: Size of the repository.
82-
self.size=repo.get('size')
85+
self.size=repo.get('size',0)
8386

8487
# SSH url e.g. git@github.com/sigmavirus24/github3.py
8588
#: URL to clone the repository via SSH.
86-
self.ssh_url=repo.get('ssh_url')
89+
self.ssh_url=repo.get('ssh_url','')
8790
#: If it exists, url to clone the repository via SVN.
88-
self.svn_url=repo.get('svn_url')
91+
self.svn_url=repo.get('svn_url','')
8992
#: ``datetime`` object representing the last time the repository was
9093
# updated.
9194
self.updated_at=self._strptime(repo.get('updated_at'))
9295
self._api=repo.get('url','')
9396

9497
# The number of watchers
9598
#: Number of users watching the repository.
96-
self.watchers=repo.get('watchers')
99+
self.watchers=repo.get('watchers',0)
97100

98101
#: Parent of this fork, if it exists :class;`Repository`
99-
self.source=repo.get('source',None)
102+
self.source=repo.get('source')
100103
ifself.source:
101104
self.source=Repository(self.source,self)
102105

103106
#: Parent of this fork, if it exists :class:`Repository`
104-
self.parent=repo.get('parent',None)
107+
self.parent=repo.get('parent')
105108
ifself.parent:
106109
self.parent=Repository(self.parent,self)
107110

108111
#: default branch for the repository
109-
self.master_branch=repo.get('master_branch')
112+
self.master_branch=repo.get('master_branch','')
110113

111114
def__repr__(self):
112115
return'<Repository [{0}/{1}]>'.format(self.owner.login,self.name)
@@ -692,14 +695,14 @@ def is_fork(self):
692695
693696
:returns: bool
694697
"""
695-
returnself._is_fork
698+
returnself.fork
696699

697700
defis_private(self):
698701
"""Checks if this repository is private.
699702
700703
:returns: bool
701704
"""
702-
returnself._priv
705+
returnself.private
703706

704707
defgit_commit(self,sha):
705708
"""Get a single (git) commit.
@@ -712,27 +715,6 @@ def git_commit(self, sha):
712715
json=self._json(self._get(url),200)
713716
returnCommit(json,self)ifjsonelseNone
714717

715-
defhas_downloads(self):
716-
"""Checks if this repository has downloads.
717-
718-
:returns: bool
719-
"""
720-
returnself._has_dl
721-
722-
defhas_issues(self):
723-
"""Checks if this repository has issues enabled.
724-
725-
:returns: bool
726-
"""
727-
returnself._has_issues
728-
729-
defhas_wiki(self):
730-
"""Checks if this repository has a wiki.
731-
732-
:returns: bool
733-
"""
734-
returnself._has_wiki
735-
736718
@requires_auth
737719
defhook(self,id_num):
738720
"""Get a single hook.
@@ -1359,11 +1341,11 @@ def __init__(self, content):
13591341

13601342
# should always be 'base64'
13611343
#: Returns encoding used on the content.
1362-
self.encoding=content.get('encoding')
1344+
self.encoding=content.get('encoding','')
13631345

13641346
# content, base64 encoded and decoded
13651347
#: Base64-encoded content of the file.
1366-
self.content=content.get('content')
1348+
self.content=content.get('content','')
13671349

13681350
#: Decoded content of the file.
13691351
self.decoded=self.content
@@ -1372,17 +1354,17 @@ def __init__(self, content):
13721354

13731355
# file name, path, and size
13741356
#: Name of the content.
1375-
self.name=content.get('name')
1357+
self.name=content.get('name','')
13761358
#: Path to the content.
1377-
self.path=content.get('path')
1359+
self.path=content.get('path','')
13781360
#: Size of the content
1379-
self.size=content.get('size')
1361+
self.size=content.get('size',0)
13801362
#: SHA string.
1381-
self.sha=content.get('sha')
1363+
self.sha=content.get('sha','')
13821364

13831365
# should always be 'file'
13841366
#: Type of content.
1385-
self.type=content.get('type')
1367+
self.type=content.get('type','')
13861368

13871369
def__repr__(self):
13881370
return'<Content [{0}]>'.format(self.path)
@@ -1407,19 +1389,19 @@ def __init__(self, download, session=None):
14071389
super(Download,self).__init__(download,session)
14081390
self._api=download.get('url','')
14091391
#: URL of the download at GitHub.
1410-
self.html_url=download.get('html_url')
1392+
self.html_url=download.get('html_url','')
14111393
#: Unique id of the download on GitHub.
1412-
self.id=download.get('id')
1394+
self.id=download.get('id',0)
14131395
#: Name of the download.
1414-
self.name=download.get('name')
1396+
self.name=download.get('name','')
14151397
#: Description of the download.
1416-
self.description=download.get('description')
1398+
self.description=download.get('description','')
14171399
#: Size of the download.
1418-
self.size=download.get('size')
1400+
self.size=download.get('size',0)
14191401
#: How many times this particular file has been downloaded.
1420-
self.download_count=download.get('download_count')
1402+
self.download_count=download.get('download_count',0)
14211403
#: Content type of the download.
1422-
self.content_type=download.get('content_type')
1404+
self.content_type=download.get('content_type','')
14231405

14241406
def__repr__(self):
14251407
return'<Download [{0}]>'.format(self.name)
@@ -1473,7 +1455,8 @@ def __init__(self, hook, session=None):
14731455
self.name=hook.get('name')
14741456
#: Events which trigger the hook.
14751457
self.events=hook.get('events')
1476-
self._active=hook.get('active')
1458+
#: Whether or not this Hook is marked as active on GitHub
1459+
self.active=hook.get('active')
14771460
#: Dictionary containing the configuration for the Hook.
14781461
self.config=hook.get('config')
14791462
#: Unique id of the hook.
@@ -1543,7 +1526,7 @@ def is_active(self):
15431526
15441527
:returns: bool
15451528
"""
1546-
returnself._active
1529+
returnself.active
15471530

15481531
@requires_auth
15491532
deftest(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp