Skip to content

Commit

Permalink
autopep8 action fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
egede authored Apr 10, 2024
1 parent 2a6bc14 commit 62cf5f1
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 47 deletions.
27 changes: 17 additions & 10 deletions doc/fill_gpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def indent(s, depth=''):
"""
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())

Check failure on line 52 in doc/fill_gpi.py

View workflow job for this annotation

GitHub Actions / Linting

E741 ambiguous variable name 'l'


def reindent(docstring, depth=''):
Expand Down Expand Up @@ -84,23 +84,29 @@ def signature(func, name=None):
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 @@ -154,7 +160,7 @@ def signature(func, name=None):

# 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 @@ -163,7 +169,7 @@ def signature(func, name=None):

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 @@ -175,7 +181,8 @@ def signature(func, name=None):
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 @@ -186,7 +193,7 @@ def signature(func, name=None):
# 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 Down
11 changes: 7 additions & 4 deletions ganga/GangaCore/Utility/Runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from GangaCore.Utility.util import importName

#from GangaCore.Utility.external.ordereddict import oDict
# from GangaCore.Utility.external.ordereddict import oDict
from GangaCore.Utility.external.OrderedDict import OrderedDict as oDict
allRuntimes = oDict()

Expand Down Expand Up @@ -64,7 +64,7 @@ def getScriptPath(name="", searchPath=""):
def getSearchPath(configPar="SCRIPTS_PATH"):
"""Determine search path from configuration parameter
Argument:
Argument:
configPar : Name of configuration parameter defining search path
Return value: Search path"""
Expand Down Expand Up @@ -145,7 +145,10 @@ def __init__(self, path):
if self.syspath:
if self.modpath.find(self.syspath) == -1:
logger.warning(
"runtime '%s' imported from '%s' but specified path is '%s'. You might be getting different code than expected!", self.name, self.modpath, self.syspath)
"runtime '%s' imported from '%s' but specified path is '%s'. You might be getting different code than expected!",

Check failure on line 148 in ganga/GangaCore/Utility/Runtime.py

View workflow job for this annotation

GitHub Actions / Linting

E501 line too long (137 > 127 characters)
self.name,
self.modpath,
self.syspath)
else:
logger.debug(
"runtime package %s imported from %s", self.name, self.modpath)
Expand Down Expand Up @@ -204,7 +207,7 @@ def loadNamedTemplates(self, globals, file_ext='tpl', pickle_files=False):
'Ganga'),
file_ext=file_ext,
pickle_files=pickle_files)
except:
except BaseException:
logger.debug('failed to load named template registry')
raise

Expand Down
2 changes: 1 addition & 1 deletion ganga/GangaCore/test/GPI/TestStartUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def testStartUp():
assert os.path.isfile(os.path.join(homeDir, this_file))

# No way known to mimic IPython starting up in a simple way
#assert os.path.isdir(os.path.join(homeDir, '.ipython-ganga'))
# assert os.path.isdir(os.path.join(homeDir, '.ipython-ganga'))

for this_folder in ['repository', ]:
assert os.path.isdir(os.path.join(this_dir, this_folder))
Expand Down
11 changes: 4 additions & 7 deletions ganga/GangaCore/testlib/GangaUnitTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def start_ganga(gangadir_for_test, repositorytype="LocalXML", extra_opts=[], ext
extra_opts (list): A list of tuples which are used to pass command line style options to Ganga
"""

import GangaCore.PACKAGE
GangaCore.PACKAGE.standardSetup()

# End taken from the ganga binary

import GangaCore.Runtime
Expand Down Expand Up @@ -206,17 +203,17 @@ def emptyRepositories():
for j in jobs:
try:
j.remove()
except:
except BaseException:
pass
for t in templates:
try:
t.remove()
except:
except BaseException:
pass
for t in tasks:
try:
t.remove(remove_jobs=True)
except:
except BaseException:
pass
if hasattr(jobs, 'clean'):
jobs.clean(confirm=True, force=True)
Expand Down Expand Up @@ -258,7 +255,7 @@ def stop_ganga(force_cleanup=False):
logger.info("Shutting Down Internal Services")

# Disable internal services such as monitoring and other tasks
#from GangaCore.Core.InternalServices import Coordinator
# from GangaCore.Core.InternalServices import Coordinator
# if Coordinator.servicesEnabled:
# Coordinator.disableInternalServices()
# Coordinator.servicesEnabled = False
Expand Down
16 changes: 8 additions & 8 deletions ganga/GangaGaudi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if not _after_bootstrap:

configGaudi = GangaCore.Utility.Config.makeConfig(
'GAUDI', 'Generic GAUDI based parameters')
'GAUDI', 'Generic GAUDI based parameters')

dscrpt = 'The command used to make a CMT application.'
configGaudi.addOption('make_cmd', 'make', dscrpt)
Expand All @@ -25,11 +25,11 @@ def standardSetup():


def loadPlugins(config=None):
#import Lib.Backends
#import Lib.Checkers
# import Lib.Backends
# import Lib.Checkers
pass
#import Lib.Applications
#import Lib.RTHandlers
#import Lib.Datasets
#import Lib.Datafiles
#import Lib.Splitters
# import Lib.Applications
# import Lib.RTHandlers
# import Lib.Datasets
# import Lib.Datafiles
# import Lib.Splitters
14 changes: 4 additions & 10 deletions ganga/GangaLHCb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ def _store_root_version():
# _store_root_version()


def standardSetup():

from . import PACKAGE
PACKAGE.standardSetup()


def loadPlugins(config=None):
logger.debug("Importing Backends")
from .Lib import Backends
Expand Down Expand Up @@ -150,10 +144,10 @@ def postBootstrapHook():
#
# This will be nice to re-add once there is lazy loading support passed to the display for the 'jobs' command 09/2015 rcurrie
#
#from GangaCore.GPIDev.Lib.Registry.JobRegistry import config as display_config
#display_config.setSessionValue( 'jobs_columns', ('fqid', 'status', 'name', 'subjobs', 'application', 'backend', 'backend.actualCE', 'backend.extraInfo', 'comment') )
#display_config.setSessionValue( 'jobs_columns_functions', {'comment': 'lambda j: j.comment', 'backend.extraInfo': 'lambda j : j.backend.extraInfo ', 'subjobs': 'lambda j: len(j.subjobs)', 'backend.actualCE': 'lambda j:j.backend.actualCE', 'application': 'lambda j: j.application._name', 'backend': 'lambda j:j.backend._name'} )
#display_config.setSessionValue('jobs_columns_width', {'fqid': 8, 'status': 10, 'name': 10, 'application': 15, 'backend.extraInfo': 30, 'subjobs': 8, 'backend.actualCE': 17, 'comment': 20, 'backend': 15} )
# from GangaCore.GPIDev.Lib.Registry.JobRegistry import config as display_config
# display_config.setSessionValue( 'jobs_columns', ('fqid', 'status', 'name', 'subjobs', 'application', 'backend', 'backend.actualCE', 'backend.extraInfo', 'comment') )

Check failure on line 148 in ganga/GangaLHCb/__init__.py

View workflow job for this annotation

GitHub Actions / Linting

E501 line too long (167 > 127 characters)
# display_config.setSessionValue( 'jobs_columns_functions', {'comment': 'lambda j: j.comment', 'backend.extraInfo': 'lambda j : j.backend.extraInfo ', 'subjobs': 'lambda j: len(j.subjobs)', 'backend.actualCE': 'lambda j:j.backend.actualCE', 'application': 'lambda j: j.application._name', 'backend': 'lambda j:j.backend._name'} )
# display_config.setSessionValue('jobs_columns_width', {'fqid': 8, 'status': 10, 'name': 10, 'application': 15, 'backend.extraInfo': 30, 'subjobs': 8, 'backend.actualCE': 17, 'comment': 20, 'backend': 15} )

from GangaCore.Core.GangaThread.WorkerThreads import getQueues
queue = getQueues()
Expand Down
1 change: 0 additions & 1 deletion ganga/GangaND280/BOOT.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ def getEnvironment(c):

def loadPlugins(c):
pass

12 changes: 6 additions & 6 deletions ganga/GangaTest/Framework/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def start(config=myConfig, test_selection='GangaCore.test.*', logger=myLogger):
"""
"""
import os
#rtconfig = getConfig('TestingFramework')
# rtconfig = getConfig('TestingFramework')
my_full_path = os.path.abspath(os.path.dirname(__file__))
#sys.stdout = UnbufferedStdout(sys.stdout)
#sys.stderr = UnbufferedStdout(sys.stderr)
# sys.stdout = UnbufferedStdout(sys.stdout)
# sys.stderr = UnbufferedStdout(sys.stderr)

# configure Ganga TestLoader

Expand All @@ -117,7 +117,7 @@ def start(config=myConfig, test_selection='GangaCore.test.*', logger=myLogger):
# loader args
pytf_loader_args = []
pytf_loader_args.append('--loader-args=%s' % config['Config'])
#pytf_loader_args.append( '--loader-args=%s/python' % gangaReleaseTopDir)
# pytf_loader_args.append( '--loader-args=%s/python' % gangaReleaseTopDir)
pytf_loader_args.append('--loader-args=%s' % gangaReleaseTopDir)
pytf_loader_args.append('--loader-args=%s' % int(config['ReleaseTesting']))
# output_dir
Expand All @@ -131,7 +131,7 @@ def start(config=myConfig, test_selection='GangaCore.test.*', logger=myLogger):
# pass the schmema version (if any) to test
pytf_loader_args.append('--loader-args=%s' % config['SchemaTesting'])

#print("PYTF path %s config: %s" % (pytf_loader_path, pytf_loader_args))
# print("PYTF path %s config: %s" % (pytf_loader_path, pytf_loader_args))
import sys
sys.path.append(os.getenv('PYTF_TOP_DIR', '').split(':')[0])
sys.path.append(os.path.join(os.getenv('PYTF_TOP_DIR', '').split(':')[0], 'pytf'))
Expand All @@ -145,7 +145,7 @@ def start(config=myConfig, test_selection='GangaCore.test.*', logger=myLogger):

try:
rc = runTests.main(logger, runner_args)
except:
except BaseException:
rc = -9999
return rc

Expand Down

0 comments on commit 62cf5f1

Please sign in to comment.