Skip to content

Commit 5659877

Browse files
committed
Update Labels for consistency
1 parent ad6e03f commit 5659877

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

github3/issues/label.py

+28-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
"""Module containing the logic for labels."""
23
from __future__ import unicode_literals
34

45
from json import dumps
@@ -7,18 +8,25 @@
78

89

910
class Label(GitHubCore):
10-
"""The :class:`Label <Label>` object. Succintly represents a label that
11-
exists in a repository.
11+
"""A representation of a label object defined on a repository.
1212
1313
See also: http://developer.github.com/v3/issues/labels/
14+
15+
This object has the following attributes::
16+
17+
.. attribute:: color
18+
19+
The hexadecimeal representation of the background color of this label.
20+
21+
.. attribute:: name
22+
23+
The name (display label) for this label.
1424
"""
15-
def _update_attributes(self, label):
16-
self._api = self._get_attribute(label, 'url')
17-
#: Color of the label, e.g., 626262
18-
self.color = self._get_attribute(label, 'color')
19-
#: Name of the label, e.g., 'bug'
20-
self.name = self._get_attribute(label, 'name')
2125

26+
def _update_attributes(self, label):
27+
self._api = label['url']
28+
self.color = label['color']
29+
self.name = label['name']
2230
self._uniq = self._api
2331

2432
def _repr(self):
@@ -31,17 +39,25 @@ def __str__(self):
3139
def delete(self):
3240
"""Delete this label.
3341
34-
:returns: bool
42+
:returns:
43+
True if successfully deleted, False otherwise
44+
:rtype:
45+
bool
3546
"""
3647
return self._boolean(self._delete(self._api), 204, 404)
3748

3849
@requires_auth
3950
def update(self, name, color):
4051
"""Update this label.
4152
42-
:param str name: (required), new name of the label
43-
:param str color: (required), color code, e.g., 626262, no leading '#'
44-
:returns: bool
53+
:param str name:
54+
(required), new name of the label
55+
:param str color:
56+
(required), color code, e.g., 626262, no leading '#'
57+
:returns:
58+
True if successfully updated, False otherwise
59+
:rtype:
60+
bool
4561
"""
4662
json = None
4763

0 commit comments

Comments
 (0)