Skip to content

Commit 1d795f3

Browse files
authored
tighten cwl_version() types (#149)
1 parent 4bad634 commit 1d795f3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cwl_utils/parser/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,20 @@ def _get_id_from_graph(yaml: MutableMapping[str, Any], id_: Optional[str]) -> An
4949
)
5050

5151

52-
def cwl_version(yaml: Any) -> Any:
52+
def cwl_version(yaml: Any) -> Optional[str]:
5353
"""Return the cwlVersion of a YAML object.
5454
5555
Args:
5656
yaml: A YAML object
5757
58-
Returns:
59-
Any: The value of `cwlVersion`. Its type is Optional[str] when a given YAML object is a valid CWL object.
60-
6158
Raises:
6259
ValidationException: If `yaml` is not a MutableMapping.
6360
"""
6461
if not isinstance(yaml, MutableMapping):
6562
raise ValidationException("MutableMapping is required")
6663
if "cwlVersion" not in list(yaml.keys()):
6764
return None
68-
return yaml["cwlVersion"]
65+
return cast(str, yaml["cwlVersion"])
6966

7067

7168
def load_document_by_uri(

0 commit comments

Comments
 (0)