Skip to content

constants

constants

Functions:

Name Description
get_main_name

Get the main name from an indicator name.

get_nested_name

Get the nested name from an indicator name.

join_nested_name

Join an indicator name with a nested reading field.

split_nested_name

Split indicator{nested}field into indicator name and nested field.

get_main_name

get_main_name(name: str) -> str

Get the main name from an indicator name.

Source code in hexital/core/constants.py
def get_main_name(name: str) -> str:
    """Get the main name from an indicator name."""
    if NESTED_DELI not in name:
        return name
    return split_nested_name(name)[0]

get_nested_name

get_nested_name(name: str) -> str

Get the nested name from an indicator name.

Source code in hexital/core/constants.py
def get_nested_name(name: str) -> str:
    """Get the nested name from an indicator name."""
    if NESTED_DELI not in name:
        return name
    return split_nested_name(name)[1]

join_nested_name

join_nested_name(indicator_name: str, nested_name: str) -> str

Join an indicator name with a nested reading field.

Source code in hexital/core/constants.py
def join_nested_name(indicator_name: str, nested_name: str) -> str:
    """Join an indicator name with a nested reading field."""
    return f"{indicator_name}{NESTED_DELI}{nested_name}"

split_nested_name

split_nested_name(name: str) -> tuple[str, str | None]

Split indicator{nested}field into indicator name and nested field.

Source code in hexital/core/constants.py
4
5
6
7
8
9
def split_nested_name(name: str) -> tuple[str, str | None]:
    """Split ``indicator{nested}field`` into indicator name and nested field."""
    if NESTED_DELI not in name:
        return name, None
    main_name, nested_name = name.split(NESTED_DELI, 1)
    return main_name, nested_name