Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP8 fixes for PR #2341 (update-docs) by autopep8 #2345

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions doc/fill_gpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

print('Generating GPI documentation')

## LOADING GANGA ##

Check failure on line 24 in doc/fill_gpi.py

View workflow job for this annotation

GitHub Actions / Linting

E266 too many leading '#' for block comment
import GangaCore.Runtime
gangadir = os.path.expandvars('$HOME/gangadir_sphinx_dummy')
this_argv = [
Expand All @@ -38,7 +38,7 @@
GangaCore.Runtime._prog.configure()
GangaCore.Runtime._prog.initEnvironment()
GangaCore.Runtime._prog.bootstrap(interactive=False)
## FINISHED LOADING GANGA ##

Check failure on line 41 in doc/fill_gpi.py

View workflow job for this annotation

GitHub Actions / Linting

E266 too many leading '#' for block comment


def indent(s, depth=''):
Expand All @@ -46,7 +46,7 @@
"""
Adds `indent` to the beginning of every line
"""
return '\n'.join(depth+l for l in s.splitlines())
return '\n'.join(depth + _l for _l in s.splitlines())


def reindent(docstring, depth=''):
Expand Down Expand Up @@ -81,23 +81,26 @@
for arg, default in arg_pairs:
full_arg = arg
if default is not None:
full_arg += '='+default
full_arg += '=' + default
arg_strings.append(full_arg)
# and append args and kwargs if necessary to get
# arg_strings=['a', 'b', 'a=None', 'd=4', '*args', '**kwargs']
if varargs is not None:
arg_strings.append('*'+varargs)
arg_strings.append('*' + varargs)
if varkw is not None:
arg_strings.append('**'+varkw)
arg_strings.append('**' + varkw)

# Signature is then 'foo(a, b, c=None, d=4, *args, **kwargs)'
return '{name}({args})'.format(name=name or func.__name__, args=', '.join(arg_strings))


# First we get all objects that are in Ganga.GPI and filter out any non-GangaObjects
gpi_classes = [stripProxy(o) for name, o in GangaCore.GPI.__dict__.items() if isinstance(o, type) and issubclass(o, GPIProxyObject)]
gpi_classes = [
stripProxy(o) for name, o in GangaCore.GPI.__dict__.items()
if isinstance(o, type) and issubclass(o, GPIProxyObject)
]

with open(doc_dir+'/GPI/classes.rst', 'w') as cf:
with open(doc_dir + '/GPI/classes.rst', 'w') as cf:

print('GPI classes', file=cf)
print('===========', file=cf)
Expand Down Expand Up @@ -151,7 +154,7 @@

# Looking through the plugin list helps categorise the GPI objects

with open(doc_dir+'/GPI/plugins.rst', 'w') as pf:
with open(doc_dir + '/GPI/plugins.rst', 'w') as pf:
from GangaCore.Utility.Plugin.GangaPlugin import allPlugins

print('Plugins', file=pf)
Expand All @@ -160,7 +163,7 @@

for c, ps in allPlugins.allCategories().items():
print(c, file=pf)
print('-'*len(c), file=pf)
print('-' * len(c), file=pf)
print('', file=pf)

for name, c in ps.items():
Expand All @@ -172,7 +175,8 @@
print('')

# All objects that are not proxied GangaObjects
gpi_objects = dict((name, stripProxy(o)) for name, o in GangaCore.GPI.__dict__.items() if stripProxy(o) not in gpi_classes and not name.startswith('__'))
gpi_objects = dict((name, stripProxy(o)) for name, o in GangaCore.GPI.__dict__.items()
if stripProxy(o) not in gpi_classes and not name.startswith('__'))

# Any objects which are not exposed as proxies (mostly exceptions)
non_proxy_classes = dict((k, v) for k, v in gpi_objects.items() if inspect.isclass(v))
Expand All @@ -183,7 +187,7 @@
# Things which were declared as actual functions
functions = dict((k, v) for k, v in callables.items() if inspect.isfunction(v) or inspect.ismethod(v))

with open(doc_dir+'/GPI/functions.rst', 'w') as ff:
with open(doc_dir + '/GPI/functions.rst', 'w') as ff:

print('Functions', file=ff)
print('=========', file=ff)
Expand All @@ -197,7 +201,7 @@

print('', file=ff)

## EXITING GANGA ##

Check failure on line 204 in doc/fill_gpi.py

View workflow job for this annotation

GitHub Actions / Linting

E266 too many leading '#' for block comment
from GangaCore.Core.InternalServices import ShutdownManager

# make sure we don't have an interactive shutdown policy
Expand All @@ -208,4 +212,4 @@
ShutdownManager._protected_ganga_exitfuncs()

shutil.rmtree(gangadir, ignore_errors=True)
## FINISHED EXITING GANGA ##

Check failure on line 215 in doc/fill_gpi.py

View workflow job for this annotation

GitHub Actions / Linting

E266 too many leading '#' for block comment
Loading