Skip to content

Commit ad56d5a

Browse files
committed
Update github3.repos.tag for consistency
1 parent dcace1d commit ad56d5a

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

github3/repos/tag.py

+38-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,52 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
github3.repos.tag
4-
=================
2+
"""This module contains the RepoTag object for GitHub's tag API."""
3+
from __future__ import unicode_literals
54

6-
This module contains the RepoTag object for GitHub's tag API.
5+
from . import commit
6+
from .. import models
77

8-
"""
9-
from __future__ import unicode_literals
108

11-
from ..models import GitHubCore
9+
class RepoTag(models.GitHubCore):
10+
"""Representation of a tag made on a GitHub repository.
1211
12+
.. note::
1313
14-
class RepoTag(GitHubCore):
15-
"""The :class:`RepoTag <RepoTag>` object. This stores the information
16-
representing a tag that was created on a repository.
14+
This is distinct from :class:`~github3.git.Tag`. This object
15+
has information specific to a tag on a *GitHub* repository.
16+
That includes URLs to the tarball and zipball files auto-generated
17+
by GitHub.
1718
1819
See also: http://developer.github.com/v3/repos/#list-tags
19-
"""
20-
def _update_attributes(self, tag):
21-
#: Name of the tag.
22-
self.name = self._get_attribute(tag, 'name')
2320
24-
#: URL for the GitHub generated zipball associated with the tag.
25-
self.zipball_url = self._get_attribute(tag, 'zipball_url')
21+
This object has the following attributes:
22+
23+
.. attribute:: commit
24+
25+
.. versionchanged:: 1.0.0
26+
27+
This attribute used to be a two item dictionary.
28+
29+
A :class:`~github3.repos.commit.MiniCommit` object representing the
30+
commit this tag references.
2631
27-
#: URL for the GitHub generated tarball associated with the tag.
28-
self.tarball_url = self._get_attribute(tag, 'tarball_url')
32+
.. attribute:: name
2933
30-
#: Dictionary containing the SHA and URL of the commit.
31-
self.commit = self._get_attribute(tag, 'commit', {})
34+
The name of this tag, e.g., ``v1.0.0``.
35+
36+
.. attribute:: tarball_url
37+
38+
The URL for the tarball file generated by GitHub for this tag.
39+
40+
.. attribute:: zipball_url
41+
42+
The URL for the zipball file generated by GitHub for this tag.
43+
"""
44+
45+
def _update_attributes(self, tag):
46+
self.commit = commit.MiniCommit(tag['commit'], self)
47+
self.name = tag['name']
48+
self.tarball_url = tag['tarball_url']
49+
self.zipball_url = tag['zipball_url']
3250

3351
def _repr(self):
3452
return '<Repository Tag [{0}]>'.format(self)

0 commit comments

Comments
 (0)