forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbranch.py
More file actions
23 lines (20 loc) · 845 Bytes
/
Copy pathbranch.py
File metadata and controls
23 lines (20 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from github3.models import GitHubCore
from github3.repos.commit import RepoCommit
class Branch(GitHubCore):
"""The :class:`Branch <Branch>` object. It holds the information GitHub
returns about a branch on a
:class:`Repository <github3.repos.repo.Repository>`.
"""
def __init__(self, branch, session=None):
super(Branch, self).__init__(branch, session)
#: Name of the branch.
self.name = branch.get('name')
#: Returns the branch's :class:`RepoCommit <RepoCommit>` or
# ``None``.
self.commit = branch.get('commit')
if self.commit:
self.commit = RepoCommit(self.commit, self._session)
#: Returns '_links' attribute.
self.links = branch.get('_links', {})
def __repr__(self):
return '<Repository Branch [{0}]>'.format(self.name)