Implementation Details¶
You probably don't need this.
keyed.helpers
¶
Miscellaneous helpers.
Freezeable
¶
Bases: Protocol
Make a class Hashable by breaking it's ability to setattr.
When an object is not frozen, we allow it to setattr but do not allow it to hash. Once an object is frozen, setattr breaks but a very simple id-based hash is enabled.
Todo
Remove the need for this class by writing proper hash/eq methods for all classes.
Source code in src/keyed/helpers.py
guard_frozen
¶
Check if the object is frozen before allowing method execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
T
|
The method to be decorated. |
required |
Returns:
Type | Description |
---|---|
T
|
The decorated method. |
Source code in src/keyed/helpers.py
freeze
¶
Call self.freeze() on the object before executing the method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
T
|
The method to be decorated. |
required |
Returns:
Type | Description |
---|---|
T
|
The decorated method. |