Skip to content

Commit d5339ed

Browse files
committed
some more type cleanups
1 parent 85fc38c commit d5339ed

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

cwltool/pathmapper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def mark(d):
104104
return dd
105105

106106
def get_listing(fs_access, rec, recursive=True):
107-
# type: (StdFsAccess, Dict[Text, Any], bool) -> None
107+
# type: (StdFsAccess, MutableMapping[Text, Any], bool) -> None
108108
if "listing" in rec:
109109
return
110110
listing = []
@@ -167,16 +167,16 @@ def ensure_writable(path):
167167
j = os.path.join(root, name)
168168
st = os.stat(j)
169169
mode = stat.S_IMODE(st.st_mode)
170-
os.chmod(j, mode|stat.S_IWUSR)
170+
os.chmod(j, mode | stat.S_IWUSR)
171171
for name in dirs:
172172
j = os.path.join(root, name)
173173
st = os.stat(j)
174174
mode = stat.S_IMODE(st.st_mode)
175-
os.chmod(j, mode|stat.S_IWUSR)
175+
os.chmod(j, mode | stat.S_IWUSR)
176176
else:
177177
st = os.stat(path)
178178
mode = stat.S_IMODE(st.st_mode)
179-
os.chmod(path, mode|stat.S_IWUSR)
179+
os.chmod(path, mode | stat.S_IWUSR)
180180

181181
class PathMapper(object):
182182
"""Mapping of files from relative path provided in the file to a tuple of

cwltool/provenance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def start_process(self, process_name, process_run_id=None):
513513
return process_run_id
514514

515515
def declare_file(self, value):
516-
# type: (Dict) -> Tuple[ProvEntity,ProvEntity,str]
516+
# type: (MutableMapping) -> Tuple[ProvEntity,ProvEntity,str]
517517
if value["class"] != "File":
518518
raise ValueError("Must have class:File: %s" % value)
519519
# Need to determine file hash aka RO filename
@@ -585,7 +585,7 @@ def declare_file(self, value):
585585
assert checksum
586586
return file_entity, entity, checksum
587587

588-
def declare_directory(self, value): # type: (Dict) -> ProvEntity
588+
def declare_directory(self, value): # type: (MutableMapping) -> ProvEntity
589589
"""Register any nested files/directories."""
590590
# FIXME: Calculate a hash-like identifier for directory
591591
# so we get same value if it's the same filenames/hashes

cwltool/workflow.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import six
1919
from six import string_types
2020
from six.moves import range
21-
from uuid import UUID # pylint: disable=unused-import
21+
from uuid import UUID # pylint: disable=unused-import
2222

2323
from . import command_line_tool, expression
2424
from .builder import CONTENT_LIMIT
@@ -209,7 +209,7 @@ def __init__(self, workflow, runtimeContext):
209209
# type: (Workflow, RuntimeContext) -> None
210210
self.workflow = workflow
211211
self.prov_obj = None # type: Optional[CreateProvProfile]
212-
self.parent_wf = None # type: Optional[CreateProvProfile]
212+
self.parent_wf = None # type: Optional[CreateProvProfile]
213213
self.tool = workflow.tool
214214
if runtimeContext.research_obj:
215215
self.prov_obj = workflow.provenance_object
@@ -502,8 +502,8 @@ def __init__(self,
502502
toolpath_object, loadingContext)
503503
self.provenance_object = None # type: Optional[CreateProvProfile]
504504
if loadingContext.research_obj:
505-
run_uuid = None # type: Optional[UUID]
506-
is_master = not(loadingContext.prov_obj) # Not yet set
505+
run_uuid = None # type: Optional[UUID]
506+
is_master = not(loadingContext.prov_obj) # Not yet set
507507
if is_master:
508508
run_uuid = loadingContext.research_obj.ro_uuid
509509

@@ -513,8 +513,7 @@ def __init__(self,
513513
orcid=loadingContext.orcid,
514514
host_provenance=loadingContext.host_provenance,
515515
user_provenance=loadingContext.user_provenance,
516-
run_uuid=run_uuid # inherit RO UUID for master wf run
517-
)
516+
run_uuid=run_uuid) # inherit RO UUID for master wf run
518517
# TODO: Is Workflow(..) only called when we are the master workflow?
519518
self.parent_wf = self.provenance_object
520519

@@ -603,6 +602,7 @@ def __init__(self,
603602
loadingContext = loadingContext.copy()
604603

605604
loadingContext.requirements = copy.deepcopy(getdefault(loadingContext.requirements, []))
605+
assert loadingContext.requirements is not None
606606
loadingContext.requirements.extend(toolpath_object.get("requirements", []))
607607
loadingContext.requirements.extend(get_overrides(getdefault(loadingContext.overrides_list, []),
608608
self.id).get("requirements", []))
@@ -613,7 +613,7 @@ def __init__(self,
613613
try:
614614
if isinstance(toolpath_object["run"], MutableMapping):
615615
self.embedded_tool = loadingContext.construct_tool_object(
616-
toolpath_object["run"], loadingContext)
616+
toolpath_object["run"], loadingContext) # type: Process
617617
else:
618618
self.embedded_tool = load_tool(
619619
toolpath_object["run"], loadingContext)
@@ -891,7 +891,7 @@ def nested_crossproduct_scatter(process, # type: WorkflowJobStep
891891
scatter_keys, # type: MutableSequence[Text]
892892
output_callback, # type: Callable[..., Any]
893893
runtimeContext # type: RuntimeContext
894-
): #type: (...) -> Generator
894+
): # type: (...) -> Generator
895895
scatter_key = scatter_keys[0]
896896
jobl = len(joborder[scatter_key])
897897
output = {} # type: Dict[Text, List[Optional[Text]]]

0 commit comments

Comments
 (0)