Sample
pyint-cc39a72855c4-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.998 | 0–1; higher is more readable |
| Dorn | 0.28 | 0–1; higher is more readable |
| Mi | 0.77 | 0–1; higher is more readable |
| LLOC | 56 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.64 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Source linesThe number of non-empty source lines. | 189 | +75.6 |
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 2161.997 | −71.346 |
| 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.501 | −6.752 |
Intercept 8.87 + feature contributions = 6.372 (log-odds).
Score = sigmoid(6.372) = 0.998.
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. | 190 | −5.691 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 114 | +3.206 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 188.988 | +2.232 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 114 | −2.195 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.023 | +0.721 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 79.3 | +0.475 |
| 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. | 80.911 | +0.238 |
Intercept 0.07 + feature contributions = -0.944 (log-odds).
Score = sigmoid(-0.944) = 0.28.
| Score | 0.77 |
|---|
| Score | 56 |
|---|
Run 1
The code is highly readable with clear structure and intent. The ClassProps class uses __slots__ and has a straightforward __init__ that maps parameters to attributes one per line. The nested enums (Hashability, KeywordOnly) are logically grouped and well-documented. Each enum value has a docstring explaining its purpose. The docstring for ClassProps is comprehensive, documenting all attributes with types and descriptions. The is_hashable property is concise and readable. Import organization is clean, using standard library, third-party, and local imports in separate blocks. Minor deductions: the __init__ method is somewhat long (16 parameters) but unavoidable given the class's purpose as a data container; the enum value assignments use string values rather than auto() which is stylistic but acceptable. Overall, the code demonstrates excellent organization, minimal nesting, clear intent, and natural reading flow.
Run 2
The code is highly readable with clear structure and organization. The class has a comprehensive docstring explaining its purpose and all attributes. Nested enum classes (Hashability, KeywordOnly) are logically grouped and well-documented. The __slots__ declaration is flat and readable. The constructor parameters are aligned consistently, making the signature scannable. Each attribute assignment in __init__ is one action per line. The code is somewhat verbose due to extensive docstrings, but this improves clarity for complex library code. The is_hashable property is simple and flat. Minor deductions: the constructor has 16 parameters, which could be simplified, and the import block is lengthy, though both are justified by the library's complexity. Overall, this is exemplary code structure for a library API.
Run 3
The code demonstrates solid structural organization with clear imports, a well-documented class docstring, and logical grouping of related attributes. The nested enum classes (Hashability, KeywordOnly) are appropriately placed and each has clear purpose. The slots declaration is explicit and well-commented. However, readability suffers in several areas: the __init__ method has 16 parameters with repetitive self-assignment lines, creating visual noise without adding clarity. Type hints are missing throughout the class, making parameter purpose less immediately clear. The is_hashable property uses wrapped conditions that could be simplified with membership testing. The docstring is quite verbose for an experimental feature, though thorough. Mixed import styles (from x import y vs from . import a, b) add minor inconsistency. Action granularity in __init__ follows good one-assignment-per-line practice, but the overall method length feels unnecessarily long for simple attribute storage, suggesting a dataclass or alternative pattern could improve conciseness without sacrificing clarity.
Run 1
Code Structure: Clearly organized into documentation, related enums, slots, initialization, and a computed property. Nesting: Shallow and appropriate; nested enums logically belong to ClassProps. Clarity of intent: Descriptive names and thorough documentation make the class's role and individual properties explicit, though missing parameter and return annotations slightly reduce clarity. Code length: Verbose documentation and repeated field declarations across slots, parameters, and assignments increase length, but most verbosity supports understanding. Action granularity: Each assignment performs one action, and enum members and property logic are cleanly separated. Reading flow: Natural progression from purpose to representation to behavior, with consistent formatting. The large import block includes many names unused in this snippet, adding minor visual noise.
Run 2
Code Structure: Imports, documentation, nested enums, slots, initialization, and the property are logically organized. Nesting: Shallow; nested enums naturally belong to ClassProps, and methods contain no complex control flow. Clarity of intent: Descriptive names and thorough documentation make the class's purpose and fields clear, although constructor type annotations would help. Code length: The extensive documentation is useful, but repeating 16 fields across documentation, slots, parameters, and assignments adds boilerplate. Action granularity: Each assignment and enum definition performs one action per line; the property expression is cleanly formatted. Reading flow: The progression from class description to supporting enums, storage, initialization, and derived behavior is natural, though the long documentation and constructor slightly slow navigation.
Run 3
Code Structure: Imports, documentation, nested enums, slots, initialization, and the computed property are logically organized. Nesting: Shallow and appropriate; nested enums clearly belong to ClassProps. Clarity of intent: Descriptive names and thorough docstrings make the class's purpose and individual properties clear, although missing parameter and return annotations reduce immediate type clarity. Code length: Verbose documentation and repeated field lists across slots, parameters, and assignments increase scanning effort, but most of the length serves a clear purpose. Action granularity: Each assignment performs one action per line, and enum definitions are easy to inspect. Reading flow: The progression from class documentation to supported values, storage, initialization, and derived behavior is natural. The long constructor and documentation slightly slow navigation, but the implementation remains straightforward and highly readable.