topmark.registry.bindings¶
Advanced registry for file type to processor bindings.
This module owns the effective relationship layer between registered file types and registered processor definitions. It is intentionally separate from both the file type and processor registries so identity and relationships can be modeled independently.
Binding
dataclass
¶
Joined metadata view of one file type and its optionally bound processor.
Attributes:
| Name | Type | Description |
|---|---|---|
filetype |
FileTypeMeta
|
Serializable metadata for the file type. |
processor |
ProcessorMeta | None
|
Serializable metadata for the bound processor, or |
BindingRegistry ¶
Composed registry of effective file-type-key to processor-key bindings.
The base binding view is derived from the explicit built-in processor
bindings declared in topmark.processors.instances. Local overrides and
removals are then layered on top.
as_mapping
classmethod
¶
Return a read-only mapping of effective file type to processor bindings.
Returns:
| Type | Description |
|---|---|
Mapping[str, str]
|
Mapping of canonical file type key to canonical processor key. |
Source code in src/topmark/registry/bindings.py
get_processor_key
classmethod
¶
Return the bound canonical processor key for a file type key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_type_key
|
str
|
Canonical file type key. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The bound canonical processor key, or |
str | None
|
currently unbound. |
Source code in src/topmark/registry/bindings.py
get_filetype_keys
classmethod
¶
Return canonical file type keys currently bound to a processor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processor_key
|
str
|
Canonical processor key. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Sorted tuple of canonical file type keys currently bound to the |
...
|
processor. |
Source code in src/topmark/registry/bindings.py
is_bound
classmethod
¶
Return whether a canonical file type key currently has a binding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_type_key
|
str
|
Canonical file type key. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/topmark/registry/bindings.py
is_processor_bound
classmethod
¶
Return whether a canonical processor key is referenced by any binding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processor_key
|
str
|
Canonical processor key. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
processor, else |
Source code in src/topmark/registry/bindings.py
bind
classmethod
¶
Bind a registered file type key to a registered processor key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_type_key
|
str
|
Canonical file type key to bind. |
required |
processor_key
|
str
|
Canonical processor key to bind to the file type. |
required |
Raises:
| Type | Description |
|---|---|
UnknownFileTypeError
|
If |
ProcessorBindingError
|
If |
Source code in src/topmark/registry/bindings.py
unbind
classmethod
¶
Remove the effective binding for a canonical file type key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_type_key
|
str
|
Canonical file type key whose binding should be removed. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/topmark/registry/bindings.py
unbind_processor
classmethod
¶
Remove all bindings that currently reference a processor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processor_key
|
str
|
Canonical processor key. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Sorted tuple of canonical file type keys that were unbound. |
Source code in src/topmark/registry/bindings.py
iter_bindings
classmethod
¶
Iterate the effective joined bindings of file types and processors.
Yields:
| Name | Type | Description |
|---|---|---|
Binding |
Binding
|
A pair containing file type metadata and the optionally |
Binding
|
bound processor metadata ( |
Source code in src/topmark/registry/bindings.py
iter_meta
classmethod
¶
Iterate over effective (file_type_key, processor_key) pairs.
Yields:
| Type | Description |
|---|---|
tuple[str, str]
|
Tuples of |
Source code in src/topmark/registry/bindings.py
bound_filetype_local_keys
classmethod
¶
Return sorted local keys of file types that currently have a binding.
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Sorted tuple of file type local keys that are currently bound. |
Source code in src/topmark/registry/bindings.py
unbound_filetype_local_keys
classmethod
¶
Return sorted local keys of recognized file types that currently lack a binding.
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Sorted tuple of file type local keys that are currently unbound. |