Sample
pyint-2fe0ff6cce61-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.102 | 0–1; higher is more readable |
| Mi | 0.583 | 0–1; higher is more readable |
| LLOC | 74 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.441 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 5595.287 | −184.644 |
| Source linesThe number of non-empty source lines. | 272 | +108.8 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.379 | −6.568 |
Intercept 8.87 + feature contributions = -73.542 (log-odds).
Score = sigmoid(-73.542) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 273 | −8.63 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 198 | +6.111 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 198 | −4.123 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 271.957 | +3.392 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 90.315 | +0.653 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.042 | +0.537 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 90.96 | −0.187 |
Intercept 0.07 + feature contributions = -2.177 (log-odds).
Score = sigmoid(-2.177) = 0.102.
| Score | 0.583 |
|---|
| Score | 74 |
|---|
Run 1
The code is reasonably structured with a clear class hierarchy and documentation, but it suffers from several readability issues. The Attribute class has good docstrings and logical organization, but the __init__ method is very long with many parameters and repetitive bound_setattr calls. The _setattrs method contains awkward inverted conditionals (e.g., 'if not (name != "metadata")') that hurt readability. Some helper methods like from_counting_attr have unclear parameter naming (ca) and complex conditional logic. The __setstate__ method has confusing nested if/else structure with a no-op pass branch. While the code follows consistent patterns and has helpful comments, the dense parameter lists, repetitive setter patterns, and occasionally inverted logic make it harder to follow than necessary.
Run 2
The code is moderately readable. It has clear intent with docstrings and consistent naming, and the overall class structure is logical. However, readability is reduced by several factors: the extremely long __init__ parameter list, the use of bound_setattr to bypass frozen immutability which obscures direct assignment, the length of the class docstring, and boolean conditions like 'if not (name != metadata)' which are difficult to parse. Nesting is generally shallow, and line length is mostly reasonable, but some methods (like evolve and _setattrs) contain slightly convoluted logic. The code is organized but not succinct; it feels longer than necessary due to verbose comments and repetitive assignments.
Run 3
The code is well-structured with clear class organization and thorough documentation. The Attribute class is logically laid out with __slots__, __init__, and helper methods. Nesting is minimal, with only one if-else block in __setstate__. Intent is clear through descriptive method names and class docstring. Action granularity is good, with one bound_setattr call per line. However, the code is unnecessarily long due to excessive docstring content and verbose comments. The reading flow is natural but interrupted by long documentation blocks. Some conditional logic is awkwardly inverted (using 'if not condition: pass else: ...'), which reduces clarity. Overall, the code is highly readable but could be more concise.
Run 1
Code Structure: The class is logically organized into initialization, construction, copying, serialization, and attribute-setting methods, though slot-order dependencies and long positional calls introduce fragility. Nesting: Generally shallow, with only modest conditional complexity. Clarity of intent: Descriptive method names, documentation, and explanatory comments help, but double-negated conditions, an empty pass branch, builtin-shadowing parameters, and internal descriptor operations obscure some logic. Code length: Extensive documentation is useful, but repetitive assignments, a large constructor signature, and unused imports in this excerpt increase reading effort. Action granularity: Most statements perform one action; tuple unpacking and conditional expressions remain manageable. Reading flow: Method grouping and consistent formatting support natural reading, while lengthy positional argument lists and awkwardly split expressions interrupt it. Overall, readable and well documented, but unnecessarily indirect conditionals and implementation-heavy construction prevent a higher score.
Run 2
Code Structure: Methods are logically separated by responsibility, with useful documentation, though slot-order dependencies and long positional constructor calls complicate maintenance. Nesting: Mostly shallow, with limited conditional branching; multiline conditional expressions add some visual complexity. Clarity of intent: Descriptive names and comments explain immutability, metadata handling, and compatibility behavior. However, inverted conditions such as 'if not (name != "metadata")' and an empty pass branch obscure simple logic. Code length: Generally justified, but extensive documentation, repetitive assignments, and imports unused within this excerpt make it lengthy. Action granularity: Statements generally perform one action per line, supporting easy scanning. Reading flow: Methods follow a sensible progression from construction to copying and serialization, but awkward line wrapping, numerous positional arguments, and references to externally defined helpers interrupt comprehension.
Run 3
Code Structure: Methods are logically grouped within a cohesive class, with documentation explaining responsibilities and compatibility concerns. Nesting: Mostly shallow, although conditional expressions and multiline calls add visual complexity. Clarity of intent: Descriptive method names and comments help, but inverted conditions such as 'if not (name != "metadata")' and the no-op pass branch obscure straightforward logic. Code length: Repetitive field assignments are understandable, but extensive documentation, a large constructor, and imports unused in this excerpt increase reading overhead. Action granularity: Statements generally perform one action each, making operations easy to follow. Reading flow: Consistent formatting and sequential initialization support natural reading, but the long positional constructor call requires cross-referencing parameter order, and slot-order dependencies and descriptor-based mutation demand additional context.