pyvrs.utils module

pyvrs.utils.filter_by_record_type(available_record_types: Set[str], requested_record_types: Iterable[str]) Set[str][source]

Filter a set record types based on the provided record types. Filter only succeeds on exact matches. :param available_record_types: A set of record types in a file. :param requested_record_types: A set of record types you are interested in.

Returns:

A set of record types in available_record_types that is also in requested_record_types.

pyvrs.utils.filter_by_stream_ids(available_stream_ids: Set[str], regex_stream_ids: Iterable[str]) Set[str][source]

Filter a set of stream_ids based on the provided regex stream_ids. :param available_stream_ids: A set of stream_ids in a file. :param regex_stream_ids: regex of the stream ids that you are interested in.

Returns:

A set of stream_ids in available_stream_ids that matches the one of the regex in regex_stream_ids.

pyvrs.utils.get_recordable_type_id_name(stream_id: str) str[source]

Retrieve a human readable string what the recordable is. :param stream_id: stream_id you are interested in.

Returns:

The name of recordable_type_id for the given stream id.

pyvrs.utils.string_of_set(s: Set) str[source]

Return a pretty string representation of a set (with elements ordered).

pyvrs.utils.stringify_metadata_keys(metadata_dict: Dict[Tuple[str, str], Any]) Dict[str, Any][source]

remove unambiguous types from metadata dicts. If the type is overloaded, converts to a key<type> string representation.

pyvrs.utils.tags_to_justified_table_str(tags: Mapping[str, Any]) str[source]

Returns a nice table representation of tags for easy viewing.