Skip to content

misc#

zen_api_utils.misc #

Functions:

  • set_logging –

    Return the shared logger without changing application-owned handlers.

  • initialize_zenapi –

    Create an gRPC channel for ZEN-API using the specified configuration file.

  • path_validator –

    Returns a Path object.

set_logging #

set_logging()

Return the shared logger without changing application-owned handlers.

initialize_zenapi #

initialize_zenapi(config_file: str | Path = 'config.ini', grpc_config: Configuration | None = None) -> tuple[Channel, list[tuple[str, str]]]

Create an gRPC channel for ZEN-API using the specified configuration file.

Parameters:

  • config_file (str | Path, default: 'config.ini' ) –

    Path to the configuration file. Can be a string or Path object. If a relative path is provided, it will be resolved relative to the current working directory. Defaults to "config.ini".

  • grpc_config (Configuration | None, default: None ) –

    Optional grpclib transport configuration.

Returns:

  • tuple[Channel, list[tuple[str, str]]] –

    Tuple consisting of gRPC Channel and metadata as a list of tuples.

Raises:

  • FileNotFoundError –

    If the configuration file does not exist.

path_validator #

path_validator(v: str | Path) -> Path

Returns a Path object.

Parameters:

  • v (str | Path) –

    A string or Path object.

Returns:

  • Path ( Path ) –

    A Path object.

Raises:

  • ValueError –

    If the value is not a string or Path object.