rics.translation.types#

Types used for translation.

Module Attributes

Translatable

Enumeration of translatable types.

ID

Name of the ID placeholder.

NameType

Type used to label collections of IDs, such as the column names in a DataFrame or the keys of a dict.

IdType

Type of the value being translated into human-readable labels.

SourceType

Type used to describe sources.

ExtendedOverrideFunction

Signature for a user-defined override function.

NamesPredicate

A predicate type on names.

NameTypes

A union of a name type, or an iterable thereof.

Names

Acceptable name types.

Classes

TypeVar(name, *constraints[, bound, ...])

Type variable.

Translatable#

Enumeration of translatable types.

alias of TypeVar(‘Translatable’, pandas.DataFrame, pandas.Index, pandas.Series, ~typing.Dict, ~typing.Sequence, str, int)

ID: str = 'id'#

Name of the ID placeholder.

NameType#

Type used to label collections of IDs, such as the column names in a DataFrame or the keys of a dict.

alias of TypeVar(‘NameType’, bound=Hashable)

IdType#

Type of the value being translated into human-readable labels.

alias of TypeVar(‘IdType’, int, str)

SourceType#

Type used to describe sources. Typically a string for things like files and database tables.

alias of TypeVar(‘SourceType’, bound=Hashable)

ExtendedOverrideFunction#

Signature for a user-defined override function.

Parameters:
  • name – A name to create a name-to-source match for.

  • sources – Potential matches for name.

  • ids – IDs for name.

Returns:

Either None (let regular logic decide), a dict, or a source.

If a dict, it is expected to be on the form {source: [ids_for_source..]}.

alias of Callable[[NameType, Set[SourceType], List[IdType]], Optional[Union[SourceType, Dict[SourceType, List[IdType]]]]]

NamesPredicate#

A predicate type on names.

alias of Callable[[NameType], bool]

NameTypes#

A union of a name type, or an iterable thereof.

alias of Union[NameType, Iterable[NameType]]

Names#

Acceptable name types.

alias of Union[NameType, Iterable[NameType], Callable[[NameType], bool]]