Skip to content

API

init

get_new_uuid

get_new_uuid() -> str
Source code in ogc/models/utils.py
def get_new_uuid() -> str:
    return str(uuid.uuid1())

serialize

serialize(
    inst: str,
    field: str,
    value: str | datetime.datetime | Path,
) -> str

Serializes value into its proper type

Source code in ogc/models/utils.py
def serialize(inst: str, field: str, value: str | datetime.datetime | Path) -> str:
    """Serializes value into its proper type"""
    if isinstance(value, datetime.datetime):
        return value.isoformat()
    if isinstance(value, Path):
        return str(value)
    return value

convert_tags_to_slug_tags

convert_tags_to_slug_tags(
    tags: list[str] | None,
) -> list[str] | None

Converts tags to their slugged equivalent

Source code in ogc/models/utils.py
def convert_tags_to_slug_tags(tags: list[str] | None) -> list[str] | None:
    """Converts tags to their slugged equivalent"""
    if tags:
        return [slugify(tag) for tag in tags]
    return None