unsprawl.core.regions

unsprawl.core.regions.

A nested namespace for region codes that supports IDE auto-complete.

Target syntax

  • Region.SG

  • Region.US.CA.SF

Each node exposes: - .CODE : a hyphenated ISO-like identifier (e.g., ‘US-CA-SF’) - .DOT : a dot-serialized identifier (e.g., ‘US.CA.SF’)

Design notes

This is intentionally data-light and import-safe. It is a convenience namespace, not a database of the world.

Attributes

Classes

_RegionNode

Immutable region node.

_RegionNamespace

A simple namespace that supports attribute chaining.

Module Contents

class _RegionNode[source]

Immutable region node.

The node stores a tuple of path segments, e.g. (‘US’, ‘CA’, ‘SF’).

_parts: tuple[str, Ellipsis]
property CODE: str

Hyphenated region code (default serialization).

property DOT: str

Dot-serialized region code.

__str__()[source]
class _RegionNamespace[source]

A simple namespace that supports attribute chaining.

This pattern keeps the ergonomics of Region.US.CA.SF without needing metaclasses or dynamic module generation.

SG
class US[source]
CODE = 'US'
DOT = 'US'
class CA[source]
CODE = 'US-CA'
DOT = 'US.CA'
SF
Region
RegionNode