Module

autodoc.models.common

Common types for autodoc typed metadata.

Provides shared types used across all metadata domains:

  • SourceLocation: Source code location for a documented element
  • QualifiedName: Validated qualified name for a documented element

Classes

SourceLocation dataclass
Source code location for a documented element.
2

Source code location for a documented element.

Attributes

Name Type Description
file str

Path to source file (string for serializability)

line int

Line number (1-based)

column int | None

Column number (optional, 1-based)

Methods 1

from_path classmethod
Create from Path object.
3 SourceLocation
def from_path(cls, path: Path, line: int, column: int | None = None) -> SourceLocation

Create from Path object.

Parameters 3
path Path

Path to source file

line int

Line number (1-based)

column int | None

Column number (optional, 1-based)

Returns

SourceLocation

SourceLocation instance

Internal Methods 1
__post_init__
Validate line number is positive.
0 None
def __post_init__(self) -> None

Validate line number is positive.

QualifiedName dataclass
Validated qualified name for a documented element. Ensures qualified names don't have empty parts …
5

Validated qualified name for a documented element.

Ensures qualified names don't have empty parts (e.g., from malformed module paths like "...bengal.core").

Attributes

Name Type Description
parts tuple[str, ...]

Tuple of name parts (non-empty strings)

Methods 3

name property
Last part of the qualified name.
str
def name(self) -> str

Last part of the qualified name.

Returns

str

parent property
Parent qualified name, or None if top-level.
QualifiedName | None
def parent(self) -> QualifiedName | None

Parent qualified name, or None if top-level.

Returns

QualifiedName | None

from_string classmethod
Create from dot-separated string, filtering empty parts.
2 QualifiedName
def from_string(cls, qualified_name: str, separator: str = '.') -> QualifiedName

Create from dot-separated string, filtering empty parts.

Parameters 2
qualified_name str

Dot-separated qualified name

separator str

Part separator (default: ".")

Returns

QualifiedName

QualifiedName instance

Internal Methods 2
__post_init__
Validate parts are non-empty.
0 None
def __post_init__(self) -> None

Validate parts are non-empty.

__str__
Return dot-separated string representation.
0 str
def __str__(self) -> str

Return dot-separated string representation.

Returns

str