Classes
SourceLocation
dataclass
Source code location for a documented element.
SourceLocation
dataclass 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.
from_path
classmethod 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 instanceSourceLocation
—
Internal Methods 1
__post_init__
Validate line number is positive.
__post_init__
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 …
QualifiedName
dataclass 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.
name
property def name(self) -> str
Last part of the qualified name.
Returns
str
parent
property
Parent qualified name, or None if top-level.
parent
property 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.
from_string
classmethod 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 instanceQualifiedName
—
Internal Methods 2
__post_init__
Validate parts are non-empty.
__post_init__
def __post_init__(self) -> None
Validate parts are non-empty.
__str__
Return dot-separated string representation.
__str__
def __str__(self) -> str
Return dot-separated string representation.
Returns
str