Sample
pyint-bdadfb4b677f-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.199 | 0–1; higher is more readable |
| Dorn | 0.767 | 0–1; higher is more readable |
| Mi | 0.655 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18.33 | 0–20; mean of three runs |
| BTTF | 0.736 | 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. | 659.075 | −21.749 |
| Source linesThe number of non-empty source lines. | 47 | +18.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.877 | −7.315 |
Intercept 8.87 + feature contributions = -1.395 (log-odds).
Score = sigmoid(-1.395) = 0.199.
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. | 48 | −0.663 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 39 | +0.612 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.034 | +0.608 |
| 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. | 74.958 | +0.49 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 39 | −0.474 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 68.729 | +0.304 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 46.855 | +0.245 |
Intercept 0.07 + feature contributions = 1.193 (log-odds).
Score = sigmoid(1.193) = 0.767.
| Score | 0.655 |
|---|
| Score | 23 |
|---|
Run 1
The code demonstrates strong readability through clear module organization with logical import grouping, a well-named sentinel class, and appropriate use of enums. The structure is flat with minimal nesting, making the control flow easy to follow. The class purpose is immediately apparent from the docstring, which also includes helpful version annotations. The implementation is concise, using enum.auto() appropriately, and each method contains a single clear action. The reading flow is natural, with imports organized by type (future, stdlib, typing, third-party) followed by the class definition. Minor deductions possible for the large number of imports without immediate context, but this is justified for a foundational module. The code follows idiomatic Python patterns and would be easily understood by experienced developers.
Run 2
The code is generally readable and well-structured. It uses clear imports, a sentinel enum with useful docstrings, and flat organization. Nesting is minimal, and intent is clear through naming and comments. However, the large number of imports reduces immediate clarity, and the use of conditional/version-specific imports adds slight complexity. The sentinel class is concise but could benefit from type annotations on methods. Overall, the code is maintainable and understandable, but the import block and subtle compatibility-related details slightly reduce the readability score.
Run 3
The code demonstrates excellent readability. The structure is logically organized with clear section separation: imports are grouped (standard library, third-party, relative), class definition follows, and documentation is placed appropriately. Nesting is minimal—the code is flat with only a class containing a few methods. Clarity of intent is strong: the _Nothing sentinel's purpose is well-documented with clear docstrings explaining the problem it solves and version changes. Code length is concise—no unnecessary lines or verbosity. Action granularity is appropriate: methods like __repr__ and __bool__ are single-purpose, one-line implementations. Reading flow is natural: sentinel pattern, then enum auto-initialization, then simple dunder methods. Minor deductions: the docstring mentions typing.Literal usage but doesn't show an example, and the large import block could potentially be condensed. Overall, this is exemplary readable Python code that follows idiomatic patterns and maintains clarity throughout.
Run 1
Code Structure: Imports are grouped sensibly, followed by a small, focused enum class. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive docstring clearly explains the sentinel's purpose, and the short methods make its representation and boolean behavior explicit. Code length: The implementation is concise; the compatibility notes add useful context without excessive detail. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: The progression from imports to documentation, enum member, and behavior methods is natural. Minor drawbacks are the large import block relative to the shown implementation and limited blank-line separation between import groups and the class.
Run 2
Code Structure: Imports precede a clearly defined sentinel enum, providing logical organization, though the many imports are unused in this excerpt. Nesting: Minimal nesting makes the class easy to scan. Clarity of intent: The descriptive docstring explains why the sentinel exists, and the representation and boolean methods have obvious purposes. Code length: The implementation is concise; documentation and imports dominate the excerpt but do not obscure its behavior. Action granularity: Each statement occupies its own line, with no compressed or combined actions. Reading flow: The sequence from imports to documentation, enum member, and special methods is natural. Additional blank lines between import groups and before the top-level class would improve visual separation.
Run 3
Code Structure: Imports are grouped by source, followed by a focused sentinel class; clearer spacing between groups would improve organization. Nesting: Minimal, with only a class and short methods. Clarity of intent: The descriptive class name, docstring, and explicit enum member clearly explain the sentinel's purpose and behavior. Code length: The implementation is concise, although the extensive imports appear unnecessary for this excerpt. Action granularity: Each statement performs one action, with no compressed or compound statements. Reading flow: The progression from imports to documentation, definition, and behavior is natural; the long import section slightly delays reaching the small implementation.