Skip to content

Commit 57f51cd

Browse files
committed
Begin fixing docs
1 parent df149be commit 57f51cd

File tree

2 files changed

+46
-40
lines changed

2 files changed

+46
-40
lines changed

docs/entities.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,21 @@ GogsUser
1010
--------
1111

1212
.. autoclass:: gogs_client.entities::GogsUser()
13-
:members:
13+
14+
.. autoattribute:: id
15+
:annotation:
16+
17+
.. autoattribute:: username
18+
:annotation:
19+
20+
.. autoattribute:: email
21+
:annotation:
22+
23+
.. autoattribute:: full_name
24+
:annotation:
25+
26+
.. autoattribute:: avatar_url
27+
:annotation:
1428

1529
GogsRepo
1630
--------

gogs_client/entities.py

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Various immutable classes that represent Gogs entities.
33
"""
44

5+
from collections import OrderedDict
6+
7+
import attr
8+
59

610
def json_get(parsed_json, key):
711
"""
@@ -12,13 +16,11 @@ def json_get(parsed_json, key):
1216
raise ValueError("JSON does not contain a {} field".format(key))
1317
return parsed_json[key]
1418

15-
import attr
16-
17-
from collections import OrderedDict
1819

1920
@attr.s
2021
class GogsEntity(object):
2122
json = attr.ib()
23+
2224
@classmethod
2325
def from_json(cls, parsed_json):
2426
# with introspection, get arguments of the constructor
@@ -44,40 +46,31 @@ class GogsUser(GogsEntity):
4446
An immutable representation of a Gogs user
4547
"""
4648

47-
"""
48-
The user's id
49-
50-
:rtype: int
51-
"""
49+
#: The user's id
50+
#:
51+
#: :rtype: int
5252
id = attr.ib()
53-
user_id = property(lambda self: self.id)
5453

55-
"""
56-
The user's username
54+
user_id = property(lambda self: self.id)
5755

58-
:rtype: str
59-
"""
56+
#: The user's username
57+
#:
58+
#: :rtype: str
6059
username = attr.ib()
6160

62-
"""
63-
The user's full name
64-
65-
:rtype: str
66-
"""
61+
#: The user's full name
62+
#:
63+
#: :rtype: str
6764
full_name = attr.ib()
6865

69-
"""
70-
The user's email address. Can be empty as a result of invalid authentication
71-
72-
:rtype: str
73-
"""
66+
#: The user's email address. Can be empty as a result of invalid authentication
67+
#:
68+
#: :rtype: str
7469
email = attr.ib(default=None)
7570

76-
"""
77-
The user's avatar URL
78-
79-
:rtype: str
80-
"""
71+
#: The user's avatar URL
72+
#:
73+
#: :rtype: str
8174
avatar_url = attr.ib(default=None)
8275

8376

@@ -100,7 +93,7 @@ class GogsRepo(GogsEntity):
10093
10194
:rtype: entities.GogsUser
10295
"""
103-
owner = attr.ib(convert=lambda parsed_json:GogsUser.from_json(parsed_json))
96+
owner = attr.ib(convert=lambda parsed_json: GogsUser.from_json(parsed_json))
10497

10598
"""
10699
The full name of the repository
@@ -130,31 +123,30 @@ class GogsRepo(GogsEntity):
130123
"""
131124
default_branch = attr.ib()
132125

133-
"""
134-
URLs of the repository
135-
136-
:rtype: GogsRepo.Urls
137-
"""
138-
_ssh_url = attr.ib()
139126
_html_url = attr.ib()
140127
_clone_url = attr.ib()
128+
_ssh_url = attr.ib()
129+
130+
#: URLs of the repository
131+
#:
132+
#: :rtype: GogsRepo.Urls
141133
@property
142134
def urls(self):
143-
return GogsRepo.Urls(self._html_url, self._clone_url,self._ssh_url)
135+
return GogsRepo.Urls(self._html_url, self._clone_url, self._ssh_url)
144136

145137
"""
146138
Permissions for the repository
147139
148140
:rtype: GogsRepo.Permissions
149141
"""
150-
permissions = attr.ib(convert=lambda data:GogsRepo.Permissions.from_json(data))
142+
permissions = attr.ib(convert=lambda data: GogsRepo.Permissions.from_json(data))
151143

152144
"""
153145
Gets the repository's parent, when a fork
154146
155147
:rtype: GogsRepo
156148
"""
157-
parent = attr.ib(convert=lambda data:GogsRepo.from_json(data) if data else None, default=None)
149+
parent = attr.ib(convert=lambda data: GogsRepo.from_json(data) if data else None, default=None)
158150

159151
"""
160152
Whether the repository is empty
@@ -357,6 +349,7 @@ class GogsOrg(GogsEntity):
357349
"""
358350
location = attr.ib()
359351

352+
360353
@attr.s(frozen=True)
361354
class GogsTeam(GogsEntity):
362355
"""
@@ -391,4 +384,3 @@ class GogsTeam(GogsEntity):
391384
:rtype: int
392385
"""
393386
permission = attr.ib()
394-

0 commit comments

Comments
 (0)