metadata
Source location metadata tracking.
MetadataRegistry
Track source locations for config items.
Maintains a clean separation between config data and metadata about where config items came from. This avoids polluting config dictionaries with metadata keys.
Example
Source code in src/sparkwheel/metadata.py
__contains__(id_path)
__init__()
__len__()
copy()
Create a copy of this registry.
Returns:
| Type | Description |
|---|---|
MetadataRegistry
|
New MetadataRegistry with same data |
get(id_path)
Get source location for a config path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_path
|
str
|
Configuration path to look up |
required |
Returns:
| Type | Description |
|---|---|
SourceLocation | None
|
SourceLocation if registered, None otherwise |
Source code in src/sparkwheel/metadata.py
merge(other)
Merge another registry into this one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
MetadataRegistry
|
MetadataRegistry to merge from |
required |
register(id_path, location)
Register source location for a config path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_path
|
str
|
Configuration path (e.g., "model::lr", "optimizer::params::0") |
required |
location
|
SourceLocation
|
Source location information |
required |