Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.devtools
Merge requests
!188
Add a sphinx command to help with migrating to sphinx 3
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add a sphinx command to help with migrating to sphinx 3
sphinx-cli
into
master
Overview
0
Commits
4
Pipelines
4
Changes
5
Merged
Amir MOHAMMADI
requested to merge
sphinx-cli
into
master
4 years ago
Overview
0
Commits
4
Pipelines
4
Changes
5
Expand
0
0
Merge request reports
Compare
master
version 3
7cc8257d
4 years ago
version 2
398df15d
4 years ago
version 1
65c14c46
4 years ago
master (base)
and
latest version
latest version
20946d50
4 commits,
4 years ago
version 3
7cc8257d
3 commits,
4 years ago
version 2
398df15d
2 commits,
4 years ago
version 1
65c14c46
1 commit,
4 years ago
5 files
+
211
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
bob/devtools/scripts/sphinx.py
0 → 100644
+
198
−
0
Options
import
click
@click.group
()
def
sphinx
():
pass
@sphinx.command
()
@click.argument
(
"
sphix_configurations
"
,
type
=
click
.
Path
(
exists
=
True
,
dir_okay
=
False
),
required
=
False
,
nargs
=-
1
,
)
def
migrate_autodoc_flags
(
sphix_configurations
):
if
not
sphix_configurations
:
sphix_configurations
=
[
"
doc/conf.py
"
]
for
sphinx_config
in
sphix_configurations
:
with
open
(
sphinx_config
)
as
f
:
config
=
f
.
read
()
config
=
config
.
replace
(
"""
autodoc_default_flags = [
'
members
'
,
'
undoc-members
'
,
'
show-inheritance
'
,
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
# another variant
config
=
config
.
replace
(
"""
autodoc_default_flags = [
"
members
"
,
"
undoc-members
"
,
"
show-inheritance
"
,
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
# another variant
config
=
config
.
replace
(
"""
autodoc_default_flags = [
'
members
'
,
'
undoc-members
'
,
'
show-inheritance
'
,
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
# another variant
config
=
config
.
replace
(
"""
autodoc_default_flags = [
'
members
'
,
'
undoc-members
'
,
'
inherited-members
'
,
'
show-inheritance
'
,
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
inherited-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
# another variant
config
=
config
.
replace
(
"""
autodoc_default_flags = [
"
members
"
,
"
undoc-members
"
,
"
show-inheritance
"
]
"""
,
"""
autodoc_default_options = {
"
members
"
: True,
"
undoc-members
"
: True,
"
show-inheritance
"
: True,
}
"""
,
)
config
=
config
.
replace
(
"""
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = [
'
__array__
'
]
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] ==
'
_
'
:
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit privat functions that are not in the list of accepted private functions
return skip
else:
# test if the method is documented
if not hasattr(obj,
'
__doc__
'
) or not obj.__doc__:
return skip
return False
def setup(app):
app.connect(
'
autodoc-skip-member
'
, member_function_test)
"""
,
""
,
)
# another variant
config
=
config
.
replace
(
"""
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = [
'
__array__
'
]
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] ==
'
_
'
:
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit privat functions that are not in the list of accepted private functions
return skip
else:
# test if the method is documented
if not hasattr(obj,
'
__doc__
'
) or not obj.__doc__:
return skip
return False
def setup(app):
app.connect(
'
autodoc-skip-member
'
, member_function_test)
"""
,
""
,
)
# another variant
config
=
config
.
replace
(
"""
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = [
"
__array__
"
]
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] ==
"
_
"
:
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit privat functions that are not in the list of accepted private functions
return skip
else:
# test if the method is documented
if not hasattr(obj,
"
__doc__
"
) or not obj.__doc__:
return skip
return False
def setup(app):
app.connect(
"
autodoc-skip-member
"
, member_function_test)
"""
,
""
,
)
# another variant
config
=
config
.
replace
(
"""
# We want to remove all private (i.e. _. or __.__) members
# that are not in the list of accepted functions
accepted_private_functions = [
"
__array__
"
]
def member_function_test(app, what, name, obj, skip, options):
# test if we have a private function
if len(name) > 1 and name[0] ==
"
_
"
:
# test if this private function should be allowed
if name not in accepted_private_functions:
# omit private functions that are not in the list of accepted private
# functions
return skip
else:
# test if the method is documented
if not hasattr(obj,
"
__doc__
"
) or not obj.__doc__:
return skip
return False
def setup(app):
app.connect(
"
autodoc-skip-member
"
, member_function_test)
"""
,
""
,
)
with
open
(
sphinx_config
,
"
w
"
)
as
f
:
f
.
write
(
config
)
Loading