eoap_cwlwrap.types
Type utilities and validators used by the workflow wrapper.
Directory_or_File = Union[Directory, File]
module-attribute
A Directory Workflow or a File union type.
URL_SCHEMA = 'https://raw.githubusercontent.com/eoap/schemas/main/string_format.yaml'
module-attribute
The URL of the string-format schema
URL_TYPE = f'{URL_SCHEMA}#URI'
module-attribute
The fully qualified name URI CWL type
is_nullable(typ)
Detects if the input type can be nullable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be nullable, False otherwise. |
is_type_assignable_to(actual, expected)
Detects if the actual type can be assignable to the expected type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual
|
Any
|
Any CWL type. |
required |
expected
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the actual type can be assigned to the expected type, False otherwise. |
get_assignable_type(actual, expected)
is_directory_compatible_type(typ)
Detects if the actual type can be assignable to Directory type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be assigned to |
is_file_compatible_type(typ)
Detects if the actual type can be assignable to File type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be assigned to |
is_directory_or_file_compatible_type(typ)
Detects if the actual type can be assignable to Directory or File types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be assigned to |
is_uri_compatible_type(typ)
Detects if the actual type can be assignable to https://raw.githubusercontent.com/eoap/schemas/refs/heads/main/string_format.yaml#URI type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be assigned to the EOAP URI type, False otherwise. |
is_array_type(typ)
Detects if the actual type can be assignable to array type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the input type can be assigned to an array type, False otherwise. |
replace_type_with_url(source, to_be_replaced)
Deep replaces any CWL type in the source type with the https://raw.githubusercontent.com/eoap/schemas/refs/heads/main/string_format.yaml#URI type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Any CWL type. |
required |
to_be_replaced
|
Any
|
The CWL type that has to be replaced. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The new type. |
replace_directory_with_url(typ)
Deep replaces the Directory type in the source type with the https://raw.githubusercontent.com/eoap/schemas/refs/heads/main/string_format.yaml#URI type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The new type. |
type_to_string(typ)
Serializes a CWL type to a human-readable string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
Any
|
Any CWL type. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The human-readable string representing the input CWL type. |
validate_directory_stage_in(directory_stage_in)
Checks if a CWL stage-in document is a URI-compatible input and Directory-compatible output Process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory_stage_in
|
Process
|
Any CWL |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. |
validate_file_stage_in(file_stage_in)
Checks if a CWL stage-in document is a URI-compatible input and File-compatible output Process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_stage_in
|
Process
|
Any CWL |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. |
validate_directory_stage_out(directory_stage_out)
Checks if a CWL stage-out document is a Directory-compatible input and URI-compatible output Process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory_stage_out
|
Process
|
Any CWL |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. |
validate_file_stage_out(file_stage_out)
Checks if a CWL stage-out document is a File-compatible input and URI-compatible output Process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_stage_out
|
Process
|
Any CWL |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. |