Depth
Rule limiting nested type subscripts.
pynudger.rule.depth.Depth ¶
Bases: Check, Type
Rule checking type expressions with deeply nested subscripts.
pynudger.rule.depth.Depth.values ¶
Yield the subscript depth of every explicit type root.
Yields:
| Type | Description |
|---|---|
Iterable[Value[int]] | Maximum nested subscript depth for each explicit type root. |
Source code in src/pynudger/rule/depth.py
pynudger.rule.depth.Depth.check ¶
Report subscript depths above the configured maximum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[int] | Maximum nested subscript depth in the type root. | required |
Returns:
| Type | Description |
|---|---|
bool | True when the type depth exceeds the configured maximum. |
Source code in src/pynudger/rule/depth.py
pynudger.rule.depth.Depth.message ¶
Describe a type root that exceeds the depth limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[int] | Maximum nested subscript depth in the type root. | required |
Returns:
| Type | Description |
|---|---|
str | Diagnostic containing the actual and maximum type depths. |
Source code in src/pynudger/rule/depth.py
pynudger.rule.depth.Depth.description ¶
Return the public rule description.
Returns:
| Type | Description |
|---|---|
str | Description of the nested type depth limit. |
pynudger.rule.depth.Depth.nodes ¶
Yield explicit type-expression roots in grouped AST order.
Yields:
| Type | Description |
|---|---|
Iterable[expr] | Annotation, return, alias, and type-variable bound expressions. |
Source code in src/pynudger/_loader.py
pynudger.rule.depth.Depth.unpack ¶
Extract the value from a node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node | AST | The AST node to extract the value from. | required |
Returns:
| Type | Description |
|---|---|
Any | The value loaded from the node. |