Skip to content

Commit 1a7f672

Browse files
author
Gauvain Pocentek
committed
Rework documentation
1 parent 2a0afc5 commit 1a7f672

File tree

5 files changed

+61
-44
lines changed

5 files changed

+61
-44
lines changed

docs/api/gitlab.rst

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,48 @@
11
gitlab package
22
==============
33

4-
Module contents
5-
---------------
4+
Subpackages
5+
-----------
66

7-
.. automodule:: gitlab
7+
.. toctree::
8+
9+
gitlab.v3
10+
gitlab.v4
11+
12+
Submodules
13+
----------
14+
15+
gitlab.base module
16+
------------------
17+
18+
.. automodule:: gitlab.base
819
:members:
920
:undoc-members:
1021
:show-inheritance:
11-
:exclude-members: Hook, UserProject, Group, Issue, Team, User,
12-
all_projects, owned_projects, search_projects
1322

14-
gitlab.base
15-
-----------
23+
gitlab.cli module
24+
-----------------
1625

17-
.. automodule:: gitlab.base
26+
.. automodule:: gitlab.cli
1827
:members:
1928
:undoc-members:
2029
:show-inheritance:
2130

22-
gitlab.v3.objects module
23-
------------------------
31+
gitlab.config module
32+
--------------------
2433

25-
.. automodule:: gitlab.v3.objects
34+
.. automodule:: gitlab.config
2635
:members:
2736
:undoc-members:
2837
:show-inheritance:
29-
:exclude-members: Branch, Commit, Content, Event, File, Hook, Issue, Key,
30-
Label, Member, MergeRequest, Milestone, Note, Snippet,
31-
Tag, canGet, canList, canUpdate, canCreate, canDelete,
32-
requiredUrlAttrs, requiredListAttrs, optionalListAttrs,
33-
optionalGetAttrs, requiredGetAttrs, requiredDeleteAttrs,
34-
requiredCreateAttrs, optionalCreateAttrs,
35-
requiredUpdateAttrs, optionalUpdateAttrs, getRequiresId,
36-
shortPrintAttr, idAttr
3738

38-
gitlab.v4.objects module
39-
------------------------
39+
gitlab.const module
40+
-------------------
4041

41-
.. automodule:: gitlab.v4.objects
42+
.. automodule:: gitlab.const
4243
:members:
4344
:undoc-members:
4445
:show-inheritance:
45-
:exclude-members: Branch, Commit, Content, Event, File, Hook, Issue, Key,
46-
Label, Member, MergeRequest, Milestone, Note, Snippet,
47-
Tag, canGet, canList, canUpdate, canCreate, canDelete,
48-
requiredUrlAttrs, requiredListAttrs, optionalListAttrs,
49-
optionalGetAttrs, requiredGetAttrs, requiredDeleteAttrs,
50-
requiredCreateAttrs, optionalCreateAttrs,
51-
requiredUpdateAttrs, optionalUpdateAttrs, getRequiresId,
52-
shortPrintAttr, idAttr
5346

5447
gitlab.exceptions module
5548
------------------------
@@ -58,3 +51,28 @@ gitlab.exceptions module
5851
:members:
5952
:undoc-members:
6053
:show-inheritance:
54+
55+
gitlab.mixins module
56+
--------------------
57+
58+
.. automodule:: gitlab.mixins
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
gitlab.utils module
64+
-------------------
65+
66+
.. automodule:: gitlab.utils
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:
70+
71+
72+
Module contents
73+
---------------
74+
75+
.. automodule:: gitlab
76+
:members:
77+
:undoc-members:
78+
:show-inheritance:

docs/api/modules.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/ext/docstrings.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111

1212
def classref(value, short=True):
13+
return value
14+
1315
if not inspect.isclass(value):
1416
return ':class:%s' % value
1517
tilde = '~' if short else ''
@@ -46,8 +48,13 @@ def _build_doc(self, tmpl, **kwargs):
4648

4749
return output.split('\n')
4850

49-
def __init__(self, *args, **kwargs):
50-
super(GitlabDocstring, self).__init__(*args, **kwargs)
51+
def __init__(self, docstring, config=None, app=None, what='', name='',
52+
obj=None, options=None):
53+
super(GitlabDocstring, self).__init__(docstring, config, app, what,
54+
name, obj, options)
55+
56+
if name and name.startswith('gitlab.v4.objects'):
57+
return
5158

5259
if getattr(self._obj, '__name__', None) == 'Gitlab':
5360
mgrs = []
@@ -57,9 +64,12 @@ def __init__(self, *args, **kwargs):
5764
mgrs.append(item)
5865
self._parsed_lines.extend(self._build_doc('gl_tmpl.j2',
5966
mgrs=sorted(mgrs)))
67+
68+
# BaseManager
6069
elif hasattr(self._obj, 'obj_cls') and self._obj.obj_cls is not None:
6170
self._parsed_lines.extend(self._build_doc('manager_tmpl.j2',
6271
cls=self._obj.obj_cls))
72+
# GitlabObject
6373
elif hasattr(self._obj, 'canUpdate') and self._obj.canUpdate:
6474
self._parsed_lines.extend(self._build_doc('object_tmpl.j2',
6575
obj=self._obj))

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Contents:
1616
api-usage
1717
switching-to-v4
1818
api-objects
19-
api/modules
19+
api/gitlab
2020
release_notes
2121
changelog
2222

gitlab/v4/objects.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,6 @@ class ProjectMilestoneManager(RetrieveMixin, CreateMixin, DeleteMixin,
996996
class ProjectLabel(SubscribableMixin, SaveMixin, ObjectDeleteMixin,
997997
RESTObject):
998998
_id_attr = 'name'
999-
requiredCreateAttrs = ['name', 'color']
1000-
optionalCreateAttrs = ['description', 'priority']
1001-
requiredUpdateAttrs = ['name']
1002-
optionalUpdateAttrs = ['new_name', 'color', 'description', 'priority']
1003999

10041000

10051001
class ProjectLabelManager(GetFromListMixin, CreateMixin, UpdateMixin,

0 commit comments

Comments
 (0)