forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbranch.py
More file actions
26 lines (22 loc) · 909 Bytes
/
branch.py
File metadata and controls
26 lines (22 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..models import GitHubCore
from .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 <github3.repos.commit.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)