Functions
hash_str
3
str
▼
Hash string content using specified algorithm.
hash_str
3
str
▼
def hash_str(content: str, truncate: int | None = None, algorithm: str = 'sha256') -> str
Parameters
| Name | Type | Description |
|---|---|---|
content |
str |
String content to hash |
truncate |
int | None |
Truncate result to N characters (None = full hash) Default:None
|
algorithm |
str |
Hash algorithm ('sha256', 'md5') Default:'sha256'
|
Returns
str
hash_bytes
3
str
▼
Hash bytes content using specified algorithm.
hash_bytes
3
str
▼
def hash_bytes(content: bytes, truncate: int | None = None, algorithm: str = 'sha256') -> str
Parameters
| Name | Type | Description |
|---|---|---|
content |
bytes |
Bytes content to hash |
truncate |
int | None |
Truncate result to N characters (None = full hash) Default:None
|
algorithm |
str |
Hash algorithm ('sha256', 'md5') Default:'sha256'
|
Returns
str
subtree_hash
2
str
▼
Deterministic structural hash for a Patitas AST node/subtree.
Uses dataclass f…
subtree_hash
2
str
▼
def subtree_hash(node: Any, *, truncate: int = 16) -> str
Deterministic structural hash for a Patitas AST node/subtree.
Uses dataclass field traversal to remain stable across process runs.
Parameters
| Name | Type | Description |
|---|---|---|
node |
Any |
|
truncate |
int |
Default:16
|
Returns
str