Naming

String manipulation methods for names

CAMEL_TO_SNAKE = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))')

Convert camel case to snake case

courtesy of: https://stackoverflow.com/a/12867228

snake_case(name: str | None) str | None

Snake caser for replacing all non-word characters with single underscores

Primarily used when creating dimension labels in ArrayAdapter , see also camel_to_snake() for converting camelcased names.

camel_to_snake(name: str) str

Convert camel case to snake case

courtesy of: https://stackoverflow.com/a/12867228

module_case(name: str) str

Returns name that can be used as a python module, used for referring to generated pydantic and linkml models.

Replaces with underscores:
  • .

version_module_case(name: str) str

module_case() except ensure that it starts with “v”

relative_path(target: Path, origin: Path) Path

return path of target relative to origin, even if they’re not in the same subpath

References