Skip to content

Commit

Permalink
PEP8 conformance fixes. Fixes E201, E202, E203, E211. #72
Browse files Browse the repository at this point in the history
  • Loading branch information
yadudoc committed Jan 28, 2018
1 parent 5f70311 commit feab61b
Show file tree
Hide file tree
Showing 122 changed files with 1,411 additions and 1,411 deletions.
6 changes: 3 additions & 3 deletions parsl/app/app.py
Expand Up @@ -28,7 +28,7 @@ class AppBase (object):
"""

def __init__ (self, func, executor, walltime=60, sites='all', exec_type="bash"):
def __init__(self, func, executor, walltime=60, sites='all', exec_type="bash"):
''' Constructor for the APP object.
Args:
Expand Down Expand Up @@ -62,13 +62,13 @@ def __init__ (self, func, executor, walltime=60, sites='all', exec_type="bash"):
self.inputs = sig.parameters['inputs'].default if 'inputs' in sig.parameters else []
self.outputs = sig.parameters['outputs'].default if 'outputs' in sig.parameters else []

def __call__ (self, *args, **kwargs):
def __call__(self, *args, **kwargs):
''' The __call__ function must be implemented in the subclasses
'''
raise NotImplemented


def app_wrapper (func):
def app_wrapper(func):

def wrapper(*args, **kwargs):
logger.debug("App wrapper begins")
Expand Down
4 changes: 2 additions & 2 deletions parsl/app/app_factory.py
Expand Up @@ -96,8 +96,8 @@ def __init__(self, name):
object(AppFactory)
'''
self.name = name
self.apps = {'bash' : BashApp,
'python' : PythonApp}
self.apps = {'bash': BashApp,
'python': PythonApp}

def make(self, kind, executor, func, **kwargs):
''' Creates a new App of the kind specified
Expand Down
14 changes: 7 additions & 7 deletions parsl/app/bash_app.py
Expand Up @@ -36,7 +36,7 @@ def remote_side_bash_executor(func, *args, **kwargs):
executable = partial_cmdline.format(*args, **kwargs)

except AttributeError as e:
if partial_cmdline :
if partial_cmdline:
raise pe.AppBadFormatting("[{}] AppFormatting failed during cmd_line resolution {}".format(func_name,
e), None)
else:
Expand All @@ -57,7 +57,7 @@ def remote_side_bash_executor(func, *args, **kwargs):
logging.debug("Stdout : %s", stdout)
logging.debug("Stderr : %s", stderr)

try :
try:
std_out = open(stdout, 'w') if stdout else None
std_err = open(stderr, 'w') if stderr else None
except Exception as e:
Expand All @@ -66,7 +66,7 @@ def remote_side_bash_executor(func, *args, **kwargs):
start_time = time.time()

returncode = None
try :
try:
proc = subprocess.Popen(executable, stdout=std_out, stderr=std_err, shell=True, executable='/bin/bash')
proc.wait(timeout=timeout)
returncode = proc.returncode
Expand Down Expand Up @@ -105,8 +105,8 @@ def remote_side_bash_executor(func, *args, **kwargs):

class BashApp(AppBase):

def __init__ (self, func, executor, walltime=60, sites='all', fn_hash=None):
super().__init__ (func, executor, walltime=60, sites=sites, exec_type="bash")
def __init__(self, func, executor, walltime=60, sites='all', fn_hash=None):
super().__init__(func, executor, walltime=60, sites=sites, exec_type="bash")
self.fn_hash = fn_hash

def __call__(self, *args, **kwargs):
Expand Down Expand Up @@ -136,9 +136,9 @@ def __call__(self, *args, **kwargs):
**self.kwargs)

logger.debug("App[%s] assigned Task_id:[%s]" % (self.func.__name__,
app_fut.tid) )
app_fut.tid))
out_futs = [DataFuture(app_fut, o, parent=app_fut, tid=app_fut.tid)
for o in kwargs.get('outputs', []) ]
for o in kwargs.get('outputs', [])]
app_fut._outputs = out_futs

return app_fut
8 changes: 4 additions & 4 deletions parsl/app/func_future.py
Expand Up @@ -10,8 +10,8 @@ class AppFuture(Future):
''' AppFuture extends the Future class to contain
a list of output futures that are accessible at the return.
'''
def __init__ (self, uid):
super (AppFuture, self).__init__()
def __init__(self, uid):
super(AppFuture, self).__init__()
self.uid = uid

def wait(self, timeout=None):
Expand All @@ -29,7 +29,7 @@ class DataFuture():
''' DataFuture contains/points at the AppFuture that generates the outputs for the future behavior.
The data items
'''
def __init__ (self, app_future, url):
def __init__(self, app_future, url):
#super (AppFuture, self).__init__()
self.app_future = app_future
self.url = url
Expand Down Expand Up @@ -59,7 +59,7 @@ def done(self):
def result(self, timeout=None):
try:
r = self.app_future.results(timeout=timeout)
except concurrent.futures.TimeoutError :
except concurrent.futures.TimeoutError:
logger.error("Timeout expired in waiting for {0}".format(self.url))
raise concurrent.futures.TimeoutError
return
Expand Down
8 changes: 4 additions & 4 deletions parsl/app/python_app.py
Expand Up @@ -13,10 +13,10 @@ class PythonApp(AppBase):
""" Extends AppBase to cover the Python App
"""
def __init__ (self, func, executor, walltime=60, sites='all', fn_hash=None):
def __init__(self, func, executor, walltime=60, sites='all', fn_hash=None):
''' Initialize the super. This bit is the same for both bash & python apps.
'''
super().__init__ (func, executor, walltime=walltime, sites=sites, exec_type="python")
super().__init__(func, executor, walltime=walltime, sites=sites, exec_type="python")
self.fn_hash = fn_hash

def __call__(self, *args, **kwargs):
Expand All @@ -40,9 +40,9 @@ def __call__(self, *args, **kwargs):
**kwargs)

logger.debug("App[%s] assigned Task_id:[%s]" % (self.func.__name__,
app_fut.tid) )
app_fut.tid))
out_futs = [DataFuture(app_fut, o, parent=app_fut, tid=app_fut.tid)
for o in kwargs.get('outputs', []) ]
for o in kwargs.get('outputs', [])]
app_fut._outputs = out_futs

return app_fut
2 changes: 1 addition & 1 deletion parsl/data_provider/files.py
Expand Up @@ -66,7 +66,7 @@ def stage_out(self):
pass


if __name__ == '__main__' :
if __name__ == '__main__':

x = File('./files.py')

54 changes: 27 additions & 27 deletions parsl/dataflow/config_defaults.py
Expand Up @@ -8,7 +8,7 @@

logger = logging.getLogger(__name__)

def pp_config (config):
def pp_config(config):
''' Pretty print the config, this should be part of the
default logging to the debug logs.
Expand All @@ -19,7 +19,7 @@ def pp_config (config):
logger.debug(pprint.pformat(config, indent=2))
return

def recursive_update (template, userdata):
def recursive_update(template, userdata):
''' Recursively update the template with userdata.
If we don't do this the value updates for nested collections
would get simply overwritten rathen than updated.
Expand All @@ -33,14 +33,14 @@ def recursive_update (template, userdata):
'''

for k, v in userdata.items():
if isinstance (v, collections.Mapping):
if isinstance(v, collections.Mapping):
template[k] = recursive_update(template.get(k, {}), v)
else:
template[k] = v

return template

def update_config (config, rundir):
def update_config(config, rundir):
''' Update the config datastructure with defaults. This is the one centralized
location where the default live.
Expand All @@ -51,20 +51,20 @@ def update_config (config, rundir):
- A standardized config dict if a config was passed, else None.
'''

if not config :
if not config:
return None

config_base = { "sites" : [],
"globals" : {
"lazyErrors" : False, # Bool
"usageTracking" : True, # Bool
"strategy" : 'simple', # ('simple',...)
"memoize" : True, # Bool
"checkpointMethod" : None, # ('eager', 'lazy', 'at_exit', None)
"checkpointFiles" : None, # List of checkpoint files
config_base = {"sites": [],
"globals": {
"lazyErrors": False, # Bool
"usageTracking": True, # Bool
"strategy": 'simple', # ('simple',...)
"memoize": True, # Bool
"checkpointMethod": None, # ('eager', 'lazy', 'at_exit', None)
"checkpointFiles": None, # List of checkpoint files
},
"controller" : {
"mode" : "auto"
"controller": {
"mode": "auto"
}
}

Expand All @@ -76,18 +76,18 @@ def update_config (config, rundir):
config_sites = []
for site in sites:
site_base = {
"auth" : {},
"execution" : {
"scriptDir" : rundir,
"block" : {
"nodes" : 1,
"taskBlocks" : 1,
"minBlocks" : 0,
"initBlocks" : 0,
"maxBlocks" : 10,
"parallelism" : 0.75,
"walltime" : "00:20:00",
"options" : {
"auth": {},
"execution": {
"scriptDir": rundir,
"block": {
"nodes": 1,
"taskBlocks": 1,
"minBlocks": 0,
"initBlocks": 0,
"maxBlocks": 10,
"parallelism": 0.75,
"walltime": "00:20:00",
"options": {
}
}
}
Expand Down

0 comments on commit feab61b

Please sign in to comment.