birdy.client.utils module

birdy.client.utils.add_output_format(output_dictionary: dict, output_identifier: str, as_ref: bool | None = None, mimetype: str | None = None) None[source]

Add an output format to an already existing dictionary.

Parameters

output_dictionarydict

The dictionary (created with create_output_dictionary()) to which this output format will be added.

output_identifierstr

Identifier of the output.

as_refbool, optional

Determines if this output will be returned as a reference or not. None for process default.

mimetypestr or None

If the process supports multiple MIME types, it can be specified with this argument. None for process default.

birdy.client.utils.build_process_doc(process: Process) str[source]

Create docstring from process metadata.

Parameters

processowslib.wps.Process

A WPS process.

Returns

str

The formatted docstring for this process.

birdy.client.utils.build_wps_client_doc(wps: WebProcessingService, processes: dict[str, Process]) str[source]

Create WPSClient docstring.

Parameters

wpsowslib.wps.WebProcessingService

A WPS service.

processesDict[str, owslib.wps.Process]

A dictionary of available processes.

Returns

str

The formatted docstring for this WPSClient.

birdy.client.utils.create_output_dictionary(output_identifier: str, as_ref: bool | None = None, mimetype: str | None = None) dict[source]

Create an output format dictionary.

Parameters

output_identifierstr

Identifier of the output.

as_refbool, optional

Determines if this output will be returned as a reference or not. None for process default.

mimetypestr, optional

If the process supports multiple MIME types, it can be specified with this argument. None for process default.

Returns

dict

Output dictionary.

birdy.client.utils.extend_instance(obj: Any, cls: Any) None[source]

Apply mixins to a class instance after creation.

Parameters

objAny

The object to be extended.

clsAny

The class to be added.

birdy.client.utils.filter_case_insensitive(names: str | list[str], complete_list: list[str]) tuple[list[str], list[str]][source]

Filter a sequence of process names into a known and unknown list.

Parameters

namesstr or list of str

Process names.

complete_listlist of str

List of all available process names.

Returns

tuple

Tuple of two lists: contained and missing.

birdy.client.utils.format_type(obj: Any) str[source]

Create docstring entry for input parameter from an OWSlib object.

Parameters

objAny

An OWSlib object.

Returns

str

The formatted docstring entry for this object.

birdy.client.utils.from_owslib(value: Any, data_type: str) Any[source]

Convert a string into another data type.

Parameters

valueAny

Value to be converted.

data_typestr

The WPS dataType.

Returns

Any

The converted value.

birdy.client.utils.is_embedded_in_request(url: str, value: Any) bool[source]

Whether to encode the value as raw data content.

Parameters

urlstr

URL to the WPS server.

valueAny

Value to be sent to the WPS server.

Returns

bool

True if: - value is a file:/// URI or a local path - value is a File-like instance - url is not localhost - value is a File object - value is already the string content

birdy.client.utils.pretty_repr(obj: Any, linebreaks: bool = True)[source]

Output pretty repr for an Output.

Parameters

objAny

An object.

linebreaksbool

If True, split attributes with linebreaks.

birdy.client.utils.py_type(data_type: str) Any[source]

Return the python data type matching the WPS dataType.

Parameters

data_typestr

The WPS dataType.

Returns

Any

The python data type.

birdy.client.utils.to_owslib(value: Any, data_type: str, encoding: Any | None = None, mimetype: Any | None = None, schema: Any | None = None) Any[source]

Convert value into OWSlib objects.

Parameters

valueAny

Value to be converted.

data_typestr

The WPS dataType.

encodingAny, optional

Encoding of the data.

mimetypeAny, optional

MIME type of the data.

schemaAny, optional

Schema of the data.

Returns

Any

The converted value.