Generate a hashable, (mostly) opaque key for expressions supported by the binder. These allow using expressions as dictionary keys based on structural/value matching (instead of based on expression identity). Return None if the expression type is not supported (it cannot be narrowed).
(e: Expression)
| 101 | |
| 102 | |
| 103 | def literal_hash(e: Expression) -> Key | None: |
| 104 | """Generate a hashable, (mostly) opaque key for expressions supported by the binder. |
| 105 | |
| 106 | These allow using expressions as dictionary keys based on structural/value |
| 107 | matching (instead of based on expression identity). |
| 108 | |
| 109 | Return None if the expression type is not supported (it cannot be narrowed). |
| 110 | |
| 111 | See the comment above for more information. |
| 112 | |
| 113 | NOTE: This is not directly related to literal types. |
| 114 | """ |
| 115 | return e.accept(_hasher) |
| 116 | |
| 117 | |
| 118 | def literal(e: Expression) -> int: |
no test coverage detected
searching dependent graphs…