Skip to content

Commit 6ca79fb

Browse files
committed
add missing docstrings
1 parent 3b7360b commit 6ca79fb

12 files changed

+18
-0
lines changed

cwltool/command_line_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ def make_path_mapper(
480480
return PathMapper(reffiles, runtimeContext.basedir, stagedir, separateDirs)
481481

482482
def updatePathmap(self, outdir: str, pathmap: PathMapper, fn: CWLObjectType) -> None:
483+
"""Update a PathMapper with a CWL File or Directory object."""
483484
if not isinstance(fn, MutableMapping):
484485
raise WorkflowException("Expected File or Directory object, was %s" % type(fn))
485486
basename = cast(str, fn["basename"])

cwltool/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(self, kwargs: Optional[Dict[str, Any]] = None) -> None:
5454

5555

5656
def make_tool_notimpl(toolpath_object: CommentedMap, loadingContext: "LoadingContext") -> "Process":
57+
"""Fake implementation of the make tool function."""
5758
raise NotImplementedError()
5859

5960

cwltool/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ def __init__(self) -> None:
668668
super().__init__("[%(asctime)sZ] %(message)s")
669669

670670
def formatTime(self, record: logging.LogRecord, datefmt: Optional[str] = None) -> str:
671+
"""Override the default formatTime to include the timezone."""
671672
formatted_time = time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(float(record.created)))
672673
with_msecs = f"{formatted_time},{record.msecs:03f}"
673674
return with_msecs

cwltool/pathmapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def reversemap(
234234
return None
235235

236236
def update(self, key: str, resolved: str, target: str, ctype: str, stage: bool) -> MapperEnt:
237+
"""Update an existine entry."""
237238
m = MapperEnt(resolved, target, ctype, stage)
238239
self._pathmap[key] = m
239240
return m

cwltool/process.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ def avroize_type(
470470

471471

472472
def get_overrides(overrides: MutableSequence[CWLObjectType], toolid: str) -> CWLObjectType:
473+
"""Combine overrides for the target tool ID."""
473474
req: CWLObjectType = {}
474475
if not isinstance(overrides, MutableSequence):
475476
raise ValidationException("Expected overrides to be a list, but was %s" % type(overrides))
@@ -534,6 +535,8 @@ def eval_resource(
534535

535536
@mypyc_attr(allow_interpreted_subclasses=True)
536537
class Process(HasReqsHints, metaclass=abc.ABCMeta):
538+
"""Abstract CWL Process."""
539+
537540
def __init__(self, toolpath_object: CommentedMap, loadingContext: LoadingContext) -> None:
538541
"""Build a Process object from the provided dictionary."""
539542
super().__init__()
@@ -1029,6 +1032,7 @@ def checkRequirements(
10291032
)
10301033

10311034
def validate_hints(self, avsc_names: Names, hints: List[CWLObjectType], strict: bool) -> None:
1035+
"""Process the hints field."""
10321036
if self.doc_loader is None:
10331037
return
10341038
debug = _logger.isEnabledFor(logging.DEBUG)

cwltool/procgenerator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, procgenerator: "ProcessGenerator") -> None:
2424
self.processStatus = None # type: Optional[str]
2525

2626
def receive_output(self, jobout: Optional[CWLObjectType], processStatus: str) -> None:
27+
"""Process the results."""
2728
self.jobout = jobout
2829
self.processStatus = processStatus
2930

cwltool/provenance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def _initialize_bagit(self) -> None:
333333
bag_it_file.write("Tag-File-Character-Encoding: %s\n" % ENCODING)
334334

335335
def open_log_file_for_activity(self, uuid_uri: str) -> Union[TextIOWrapper, WritableBagFile]:
336+
"""Begin the per-activity log."""
336337
self.self_check()
337338
# Ensure valid UUID for safe filenames
338339
activity_uuid = uuid.UUID(uuid_uri)
@@ -578,6 +579,7 @@ def guess_mediatype(
578579
return aggregates
579580

580581
def add_uri(self, uri: str, timestamp: Optional[datetime.datetime] = None) -> Aggregate:
582+
"""Create and store an aggreate for the given URI."""
581583
self.self_check()
582584
aggr = {"uri": uri} # type: Aggregate
583585
aggr["createdOn"], aggr["createdBy"] = self._self_made(timestamp=timestamp)

cwltool/singularity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ def get_from_requirements(
298298

299299
@staticmethod
300300
def append_volume(runtime: List[str], source: str, target: str, writable: bool = False) -> None:
301+
"""Add binding arguments to the runtime list."""
301302
runtime.append("--bind")
302303
# Mounts are writable by default, so 'rw' is optional and not
303304
# supported (due to a bug) in some 3.6 series releases.

cwltool/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def mark(d: Dict[str, str]) -> None:
297297

298298

299299
def get_listing(fs_access: "StdFsAccess", rec: CWLObjectType, recursive: bool = True) -> None:
300+
"""Expand, recursively, any 'listing' fields in a Directory."""
300301
if rec.get("class") != "Directory":
301302
finddirs: List[CWLObjectType] = []
302303
visit_class(rec, ("Directory",), finddirs.append)
@@ -502,6 +503,7 @@ def __init__(self) -> None:
502503
self.hints: List[CWLObjectType] = []
503504

504505
def get_requirement(self, feature: str) -> Tuple[Optional[CWLObjectType], Optional[bool]]:
506+
"""Retrieve the named feature from the requirements field, or the hints field."""
505507
for item in reversed(self.requirements):
506508
if item["class"] == feature:
507509
return (item, True)

cwltool/validate_js.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def dump_jshint_error() -> None:
203203

204204

205205
def print_js_hint_messages(js_hint_messages: List[str], source_line: Optional[SourceLine]) -> None:
206+
"""Log the message from JSHint, using the line number."""
206207
if source_line is not None:
207208
for js_hint_message in js_hint_messages:
208209
_logger.warning(source_line.makeError(js_hint_message))

0 commit comments

Comments
 (0)