Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit194ed0b

Browse files
author
Gauvain Pocentek
committed
[docs] update the sphinx extension for v4 objects
1 parent5292ffb commit194ed0b

File tree

4 files changed

+32
-132
lines changed

4 files changed

+32
-132
lines changed

‎docs/ext/docstrings.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,6 @@ def __init__(self, docstring, config=None, app=None, what='', name='',
5353
super(GitlabDocstring,self).__init__(docstring,config,app,what,
5454
name,obj,options)
5555

56-
ifnameandname.startswith('gitlab.v4.objects'):
57-
return
58-
59-
ifgetattr(self._obj,'__name__',None)=='Gitlab':
60-
mgrs= []
61-
gl=self._obj('http://dummy',private_token='dummy')
62-
foriteminvars(gl).items():
63-
ifhasattr(item[1],'obj_cls'):
64-
mgrs.append(item)
65-
self._parsed_lines.extend(self._build_doc('gl_tmpl.j2',
66-
mgrs=sorted(mgrs)))
67-
68-
# BaseManager
69-
elifhasattr(self._obj,'obj_cls')andself._obj.obj_clsisnotNone:
56+
ifname.startswith('gitlab.v4.objects')andname.endswith('Manager'):
7057
self._parsed_lines.extend(self._build_doc('manager_tmpl.j2',
71-
cls=self._obj.obj_cls))
72-
# GitlabObject
73-
elifhasattr(self._obj,'canUpdate')andself._obj.canUpdate:
74-
self._parsed_lines.extend(self._build_doc('object_tmpl.j2',
75-
obj=self._obj))
58+
cls=self._obj))

‎docs/ext/gl_tmpl.j2

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

‎docs/ext/manager_tmpl.j2

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,38 @@
1-
Manager for {{ cls | classref() }} objects.
2-
3-
{%ifcls.canUpdate%}
4-
{{ cls | classref() }} objects can be updated.
5-
{%else%}
6-
{{ cls | classref() }} objects **cannot** be updated.
1+
{%ifcls._list_filters%}
2+
**Object listing filters**
3+
{%foritemincls._list_filters%}
4+
- ``{{ item }}``
5+
{%endfor%}
76
{%endif%}
87

9-
{%ifcls.canList%}
10-
.. method:: list(**kwargs)
11-
12-
Returns a list of objects of type {{ cls | classref() }}.
13-
14-
Available keys for ``kwargs`` are:
15-
16-
{%forkincls.requiredListAttrs%}
17-
* ``{{ k }}`` (required)
18-
{%endfor%}
19-
{%forkincls.optionalListAttrs%}
20-
* ``{{ k }}`` (optional)
21-
{%endfor%}
22-
* ``per_page`` (int): number of item per page. May be limited by the server.
23-
* ``page`` (int): page to retrieve
24-
* ``all`` (bool): iterate over all the pages and return all the entries
25-
* ``sudo`` (string or int): run the request as another user (requires admin
26-
permissions)
8+
{%ifcls._create_attrs%}
9+
**Object Creation**
10+
{%ifcls._create_attrs[0]%}
11+
Mandatory attributes:
12+
{%foritemincls._create_attrs[0]%}
13+
- ``{{ item }}``
14+
{%endfor%}
2715
{%endif%}
28-
29-
{%ifcls.canGet%}
30-
{%ifcls.getRequiresId%}
31-
.. method:: get(id, **kwargs)
32-
33-
Get a single object of type {{ cls | classref() }} using its ``id``.
34-
{%else%}
35-
.. method:: get(**kwargs)
36-
37-
Get a single object of type {{ cls | classref() }}.
16+
{%ifcls._create_attrs[1]%}
17+
Optional attributes:
18+
{%foritemincls._create_attrs[1]%}
19+
- ``{{ item }}``
20+
{%endfor%}
3821
{%endif%}
39-
40-
Available keys for ``kwargs`` are:
41-
42-
{%forkincls.requiredGetAttrs%}
43-
* ``{{ k }}`` (required)
44-
{%endfor%}
45-
{%forkincls.optionalGetAttrs%}
46-
* ``{{ k }}`` (optional)
47-
{%endfor%}
48-
* ``sudo`` (string or int): run the request as another user (requires admin
49-
permissions)
5022
{%endif%}
5123

52-
{%ifcls.canCreate%}
53-
.. method:: create(data, **kwargs)
54-
55-
Create an object of type {{ cls | classref() }}.
56-
57-
``data`` is a dict defining the object attributes. Available attributes are:
58-
59-
{%foraincls.requiredUrlAttrs%}
60-
* ``{{ a }}`` (required if not discovered on the parent objects)
61-
{%endfor%}
62-
{%foraincls.requiredCreateAttrs%}
63-
* ``{{ a }}`` (required)
64-
{%endfor%}
65-
{%foraincls.optionalCreateAttrs%}
66-
* ``{{ a }}`` (optional)
67-
{%endfor%}
68-
69-
Available keys for ``kwargs`` are:
70-
71-
* ``sudo`` (string or int): run the request as another user (requires admin
72-
permissions)
24+
{%ifcls._update_attrs%}
25+
**Object update**
26+
{%ifcls._update_attrs[0]%}
27+
Mandatory attributes for object update:
28+
{%foritemincls._update_attrs[0]%}
29+
- ``{{ item }}``
30+
{%endfor%}
31+
{%endif%}
32+
{%ifcls._update_attrs[1]%}
33+
Optional attributes for object update:
34+
{%foritemincls._update_attrs[1]%}
35+
- ``{{ item }}``
36+
{%endfor%}
7337
{%endif%}
74-
75-
{%ifcls.canDelete%}
76-
.. method:: delete(id, **kwargs)
77-
78-
Delete the object with ID ``id``.
79-
80-
Available keys for ``kwargs`` are:
81-
82-
* ``sudo`` (string or int): run the request as another user (requires admin
83-
permissions)
8438
{%endif%}

‎docs/ext/object_tmpl.j2

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp