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_dictionary (dict) – The dictionary (created with create_output_dictionary()) to which this output format will be added.

  • output_identifier (str) – Identifier of the output.

  • as_ref (bool, optional) – Determines if this output will be returned as a reference or not. None for process default.

  • mimetype (str 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: owslib.wps.Process) str[source]

Create docstring from process metadata.

Parameters:

process (owslib.wps.Process) – A WPS process.

Returns:

The formatted docstring for this process.

Return type:

str

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

Create WPSClient docstring.

Parameters:
  • wps (owslib.wps.WebProcessingService) – A WPS service.

  • processes (Dict[str, owslib.wps.Process]) – A dictionary of available processes.

Returns:

The formatted docstring for this WPSClient.

Return type:

str

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_identifier (str) – Identifier of the output.

  • as_ref (bool, optional) – Determines if this output will be returned as a reference or not. None for process default.

  • mimetype (str, optional) – If the process supports multiple MIME types, it can be specified with this argument. None for process default.

Returns:

Output dictionary.

Return type:

dict

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

Apply mixins to a class instance after creation.

Parameters:
  • obj (Any) – The object to be extended.

  • cls (Any) – 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:
  • names (str or list of str) – Process names.

  • complete_list (list of str) – List of all available process names.

Returns:

Tuple of two lists: contained and missing.

Return type:

tuple

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

Create docstring entry for input parameter from an OWSlib object.

Parameters:

obj (Any) – An OWSlib object.

Returns:

The formatted docstring entry for this object.

Return type:

str

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

Convert a string into another data type.

Parameters:
  • value (Any) – Value to be converted.

  • data_type (str) – The WPS dataType.

Returns:

The converted value.

Return type:

Any

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

Whether to encode the value as raw data content.

Parameters:
  • url (str) – URL to the WPS server.

  • value (Any) – Value to be sent to the WPS server.

Returns:

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

Return type:

bool

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

Output pretty repr for an Output.

Parameters:
  • obj (Any) – An object.

  • linebreaks (bool) – 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_type (str) – The WPS dataType.

Returns:

The python data type.

Return type:

Any

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:
  • value (Any) – Value to be converted.

  • data_type (str) – The WPS dataType.

  • encoding (Any, optional) – Encoding of the data.

  • mimetype (Any, optional) – MIME type of the data.

  • schema (Any, optional) – Schema of the data.

Returns:

The converted value.

Return type:

Any