eventutilities_python package

Subpackages

Submodules

eventutilities_python.type_aliases module

eventutilities_python.type_aliases.NestedStr

Recursive Sequence of strings.

Allows for [str], [str, [str, str]], etc.

alias of Sequence[Union[str, NestedStr]]

class eventutilities_python.type_aliases.Path_uc(v, **k)

Bases: PathType

class eventutilities_python.type_aliases.UriAbsolute

UriAbsolute is just a type alias of str.

It exists to be able to allow jsonargparse to automatically deserialize and resolve incoming URI parameters with this type.

alias of TypeVar(‘UriAbsolute’, bound=str)

eventutilities_python.type_aliases.resolve_uris(uri: str | Sequence[str | Sequence[str | NestedStr]], relative_to: Sequence[str] | None = None) str | Sequence[str | Sequence[str | NestedStr]]

Resolves u as an absolute URI. Uses jsonargparse url parsing, as well as pathlib.Path.as_uri() to add file:// to the beginning of local file paths.

Parameters:
  • uri – uri to resolve, or a (recursive) list of uris to resolve.

  • relative_to – If not provided, will attempt to resolve only to cwd. If provided, each path here will be attempted to be used to resolve in order. The first readable file found in one of these paths will be returned.

Returns:

The resolved URI or (recursive) list of resolved URIs.

eventutilities_python.utils module

class eventutilities_python.utils.JavaObjectWrapper(java_object: JavaObject)

Bases: object

A wrapper class that maintains an object implemented in Java via py4j.

Based on pyflink’s JavaFunctionWrapper.

java_object: JavaObject

The underlying py4j JavaObject.

eventutilities_python.utils.callable_repr(func: Callable[[...], Any]) str

Given a callable, returns a nice description string using its name, file and lineno, if available.

eventutilities_python.utils.find_lib_jars(lib_dir: str) Collection[str]

Returns a list of file:// prefixed .jar file paths in the directory.

Converts a python datetime to a PyFlink Instant.

eventutilities_python.utils.format_dt(dt: datetime) str

Formats dt into an ISO-8601 UTC (‘Z’) string.

eventutilities_python.utils.get_memory_usage_of(mem_info_key: str) int

Calls psutil.Process().memory_full_info() and returns the memory usage bytes value for mem_info_key.

Parameters:

mem_info_key – See

https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_full_info :param mem_info_key: See https://psutil.readthedocs.io/en/latest/#ps

util.Process.memory_full_info for a list of available keys.

eventutilities_python.utils.json_default_serializer(obj: Any) Any

A serializer function that handles a few more types that python json serializer doesn’t know how to handle.

Used when serializing objects to json that have types like datetimes or Flink Instants.

eventutilities_python.utils.setup_logging(config_dict: Dict[Any, Any] | None = None, level: str = 'INFO') None

Sets up python logging either from a log config file or using basicConfig.

Parameters:
  • config_dict – Setup logging from a config dict. If not set, then basicConfig will be used.

  • level – basicConfig log level that will be used if config_file is not set.

Module contents

A Python library to build Event Platform streaming services.

eventutilities_python.get_version() str