Sample
pyint-27a5b18836e9-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.765 | 0–1; higher is more readable |
| Mi | 0.713 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 18 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.129 | 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. | 702.957 | −23.198 |
| Source linesThe number of non-empty source lines. | 24 | +9.6 |
| 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.707 | −7.061 |
Intercept 8.87 + feature contributions = -11.789 (log-odds).
Score = sigmoid(-11.789) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 46.92 | +1.678 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.076 | +0.202 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 24 | −0.13 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.583 | −0.08 |
Intercept 0.07 + feature contributions = 1.18 (log-odds).
Score = sigmoid(1.18) = 0.765.
| Score | 0.713 |
|---|
| Score | 20 |
|---|
Run 1
The code is highly readable with a clear, logical structure. It uses a flat hierarchy with no nesting, making the control flow obvious. Each class method has a single, well-defined purpose with clear intent expressed through descriptive method names and type hints. The code is concise, avoiding unnecessary boilerplate, and maintains one action per line. The reading flow is natural, grouping related imports together and organizing class methods in a logical sequence (check, to_json, to_python). The use of `__slots__` and type hints demonstrates thoughtful design without sacrificing clarity.
Run 2
The code is highly readable with clear structure and intent. Imports are organized logically, with standard library modules grouped together, followed by third-party and local imports. The class definition is concise with a single responsibility: serializing/deserializing datetime objects. Each method performs exactly one action, maintaining flat nesting throughout. Naming is descriptive and follows Python conventions. Type hints are used consistently (though `t.Any` is redundant), and `__slots__` is appropriately declared. The only minor improvement would be removing the redundant `t.Any` type hints or using more specific types, but this is idiomatic for generic tag implementations. Overall, the code demonstrates excellent readability with minimal cognitive overhead.
Run 3
The code is highly readable. It has a clear, logical structure with imports organized by standard library, third-party, and local modules. The class TagDateTime is concise and focused, with no unnecessary nesting. Each method has a single responsibility: check validates the type, to_json serializes, and to_python deserializes. Type hints improve clarity. Method names and the 'key' attribute clearly convey intent. The use of __slots__ is appropriate for memory efficiency. While the import of JSONTag is missing from the snippet, this appears to be context outside the visible code. Overall, the code follows Python best practices and is easy to understand.
Run 1
Code Structure: The class is logically organized into type checking and bidirectional conversion methods, though numerous unused imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Class and method names clearly convey datetime serialization, but the key " d" is unexplained and broad Any annotations provide little type guidance. Code length: The implementation is concise, although the import section is disproportionately long. Action granularity: Each statement performs a single action. Reading flow: The check, to_json, and to_python sequence is natural; clearer import grouping and additional spacing before the class would improve presentation.
Run 2
Code Structure: The class is logically organized into type checking, serialization, and deserialization methods. Nesting: There is no unnecessary nesting; each method has a single return statement. Clarity of intent: Descriptive class and method names make the datetime conversion purpose clear, although the tag key " d" is unexplained and JSONTag is not defined or imported in the snippet. Code length: The implementation is concise, but several imports are unused in the provided code. Action granularity: Each line performs one clear action. Reading flow: The methods follow a natural check-to-JSON-to-Python sequence, with consistent formatting and helpful type annotations; import grouping could be improved.
Run 3
Code Structure: The class is logically organized into type checking and conversion methods, although several imports are unused in this snippet and JSONTag is not defined or imported. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class and method names clearly communicate datetime serialization and deserialization, but the tag key " d" is unexplained and broad Any annotations provide little type guidance. Code length: The implementation is concise, with no unnecessary method logic; unused imports add clutter. Action granularity: Each statement performs one action. Reading flow: Methods follow a natural check, serialize, deserialize sequence, with consistent formatting; an additional blank line before the class would improve separation.