Repetition
Rules for repeated name words in declarations.
pynudger.rule.repetition.RepetitionVariable ¶
Bases: _Repetition, GlobalDefinition
Rule checking module-scope variable binding names.
pynudger.rule.repetition.RepetitionVariable.values ¶
Yield module-scope variable binding names.
Yields:
| Type | Description |
|---|---|
Iterable[Value[str]] | Variable identifiers with their declaration locations. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionVariable.nodes ¶
Return declarations from module-level control flow.
Returns:
| Type | Description |
|---|---|
Iterable[GlobalDefinitionNode] | Iterable of declarations outside class and function bodies. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionVariable.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. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionVariable.check ¶
Report identifiers containing the module name as complete words.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name to check. | required |
Returns:
| Type | Description |
|---|---|
bool | True when the module name is a non-exact, contiguous word sequence |
bool | in the identifier. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionVariable.message ¶
Describe the repeated module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name that repeats the module name. | required |
Returns:
| Type | Description |
|---|---|
str | Diagnostic message containing both names. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionVariable.description ¶
Return the public description of the rule.
Returns:
| Type | Description |
|---|---|
str | Description of the identifier category checked by this rule. |
pynudger.rule.repetition.RepetitionClass ¶
Bases: _Repetition, Class
Rule checking class names in all scopes.
pynudger.rule.repetition.RepetitionClass.nodes ¶
Return class definition nodes in their existing loader order.
Returns:
| Type | Description |
|---|---|
Iterable[ClassDef] | Iterable of |
pynudger.rule.repetition.RepetitionClass.values ¶
Wrap values from the configured AST nodes.
Yields:
| Type | Description |
|---|---|
Iterable[Value[Any]] | Values extracted from the configured AST nodes. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionClass.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. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionClass.check ¶
Report identifiers containing the module name as complete words.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name to check. | required |
Returns:
| Type | Description |
|---|---|
bool | True when the module name is a non-exact, contiguous word sequence |
bool | in the identifier. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionClass.message ¶
Describe the repeated module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name that repeats the module name. | required |
Returns:
| Type | Description |
|---|---|
str | Diagnostic message containing both names. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionClass.description ¶
Return the public description of the rule.
Returns:
| Type | Description |
|---|---|
str | Description of the identifier category checked by this rule. |
pynudger.rule.repetition.RepetitionFunction ¶
Bases: _Repetition, Function
Rule checking function names in all scopes.
pynudger.rule.repetition.RepetitionFunction.nodes ¶
Yield function definition nodes in their existing loader order.
Returns:
| Type | Description |
|---|---|
Iterable[FunctionNode] | Synchronous definitions followed by asynchronous definitions. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionFunction.values ¶
Wrap values from the configured AST nodes.
Yields:
| Type | Description |
|---|---|
Iterable[Value[Any]] | Values extracted from the configured AST nodes. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionFunction.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. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.RepetitionFunction.check ¶
Report identifiers containing the module name as complete words.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name to check. | required |
Returns:
| Type | Description |
|---|---|
bool | True when the module name is a non-exact, contiguous word sequence |
bool | in the identifier. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionFunction.message ¶
Describe the repeated module name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[str] | Identifier name that repeats the module name. | required |
Returns:
| Type | Description |
|---|---|
str | Diagnostic message containing both names. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.RepetitionFunction.description ¶
Return the public description of the rule.
Returns:
| Type | Description |
|---|---|
str | Description of the identifier category checked by this rule. |
pynudger.rule.repetition.Name ¶
Bases: Check, GlobalDefinition
Rule checking shared words in module-scope declaration names.
pynudger.rule.repetition.Name.values ¶
Yield every declaration-word candidate with its total count.
Yields:
| Type | Description |
|---|---|
Iterable[Value[_Candidate]] | Every unique declaration-word pair with the word's module-wide |
Iterable[Value[_Candidate]] | occurrence count. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.Name.check ¶
Report candidates meeting the configured occurrence minimum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[_Candidate] | Declaration-word candidate with its module-wide count. | required |
Returns:
| Type | Description |
|---|---|
bool | Whether the candidate reaches the configured minimum. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.Name.message ¶
Describe the module that should own the declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value | Value[_Candidate] | Repeated declaration-word candidate. | required |
Returns:
| Type | Description |
|---|---|
str | Diagnostic with the declaration kind, name, and module name. |
Source code in src/pynudger/rule/repetition.py
pynudger.rule.repetition.Name.description ¶
Return the public rule description.
Returns:
| Type | Description |
|---|---|
str | Description of the module-grouping rule. |
pynudger.rule.repetition.Name.nodes ¶
Return declarations from module-level control flow.
Returns:
| Type | Description |
|---|---|
Iterable[GlobalDefinitionNode] | Iterable of declarations outside class and function bodies. |
Source code in src/pynudger/_loader.py
pynudger.rule.repetition.Name.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. |