Sample
pyint-361115d35406-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.192 | 0–1; higher is more readable |
| Mi | 0.425 | 0–1; higher is more readable |
| LLOC | 78 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.42 | 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. | 5435.556 | −179.373 |
| Source linesThe number of non-empty source lines. | 170 | +68 |
| 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.522 | −6.783 |
Intercept 8.87 + feature contributions = -109.287 (log-odds).
Score = sigmoid(-109.287) = 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. | 171 | −5.018 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 136 | +3.967 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 136 | −2.7 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 169.777 | +1.963 |
| 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. | 110.977 | −1.035 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 110.959 | +0.986 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.063 | +0.33 |
Intercept 0.07 + feature contributions = -1.438 (log-odds).
Score = sigmoid(-1.438) = 0.192.
| Score | 0.425 |
|---|
| Score | 78 |
|---|
Run 1
The code is generally well-structured and readable, with clear class and method definitions, good docstrings, and logical organization. It scores positively on structure, clarity of intent, and reading flow. However, some areas reduce readability. Nesting is moderate but acceptable; the `open` method contains an if-elif-else chain that adds complexity. Code length is reasonable for the functionality, though some methods could be shortened. Action granularity is mostly good, but the `open` method mixes multiple actions in conditional branches and contains inline comments and a hex index `args[0x0]` that seems cryptic. The `session_transaction` method is clear but lengthy. Overall, the code is professional and maintainable, but minor issues with conditional complexity and a few non-obvious expressions prevent a higher score.
Run 2
The code is generally well-structured and readable, with clear separation of methods, descriptive naming, and helpful docstrings. The `open` method handles multiple input types with a somewhat verbose conditional chain, but each branch is logically isolated and commented. Nesting is moderate, mostly within context managers and a single if-else chain. Intent is clear throughout, particularly in `session_transaction` and `__enter__`/`__exit__`. Line length is mostly reasonable except for the `_copy_environ` call inside `open`, which is long and includes a type ignore comment. Action granularity is mostly one action per line, though some argument-heavy calls stack multiple parameters. Reading flow is natural, with higher-level methods first and internal helpers grouped logically. A few minor issues like the magic number `0x0` for index zero and the long conditional block slightly reduce readability, but overall the code is maintainable and easy to follow.
Run 3
The code is structured but suffers from complexity and readability issues. It has clear sections and docstrings, but methods like `open` contain multiple nested conditionals and multi-responsibility blocks, reducing clarity. Nesting reaches up to 3 levels, with mixed action granularity; some lines combine multiple logical operations. The intent is mostly clear, especially in commented branches, but the use of magic numbers (args[0x0]) harms readability. The code length is moderate for its functionality, but several methods handle too many edge cases at once, affecting reading flow. Context manager handling is straightforward, yet the loop and context stack manipulation in `open` disrupt natural progression. Overall, it is functional but would benefit from refactoring into smaller helper methods and simplifying conditionals.
Run 1
Code Structure: Well-organized class with focused methods and reusable helpers; request handling and context management are clearly separated. Nesting: Generally shallow, although open() contains a moderately nested type-dispatch branch. Clarity of intent: Descriptive method names, type annotations, docstrings, and lifecycle comments clarify behavior. However, args[0x0] is unnecessarily unusual, some referenced types and helpers are not defined in the snippet, and the 'request is None' comment is misleading. Code length: Mostly proportionate to functionality; detailed documentation adds useful context, though repeated argument indexing and long expressions add minor clutter. Action granularity: Statements generally perform one action per line, with a few chained calls requiring extra parsing. Reading flow: Initialization, session operations, request preparation, and context entry/exit follow a natural progression. Context preservation requires some framework knowledge, but comments explain the key transitions.
Run 2
Code Structure: Well-organized class with focused methods and helper functions separating environment preparation, request construction, and context management. Nesting: Mostly shallow, although open() has a moderately nested type-dispatch block. Clarity of intent: Descriptive method names, type annotations, docstrings, and lifecycle comments explain behavior well. However, hexadecimal indexing (args[0x0]) is distracting, some abbreviated names reduce clarity, and several referenced types and helpers are not defined in the excerpt. Code length: Generally appropriate for the functionality; lengthy docstrings provide useful context rather than unnecessary implementation verbosity. Action granularity: Statements generally perform one action per line, with a few dense chained calls and long argument expressions. Reading flow: Initialization, session handling, request processing, and context-manager methods follow a logical sequence. Context preservation requires careful tracking of state, and comments such as 'request is None' do not accurately describe the visible code.
Run 3
Code Structure: Well-organized class with focused methods separating session management, request construction, and context cleanup. Nesting: Mostly shallow, although open() contains a moderately nested type-dispatch branch. Clarity of intent: Descriptive method names, annotations, docstrings, and lifecycle comments explain most behavior. Repeated args[0x0], abbreviated variables, and names not defined in the snippet reduce immediate clarity. Code length: Generally appropriate for the functionality; documentation is useful, but request-dispatch repetition adds some verbosity. Action granularity: Most lines perform one clear action, with a few chained builder calls and a long assignment requiring extra effort. Reading flow: Methods follow natural setup, execution, and cleanup sequences. Context preservation requires careful tracking, and the misleading 'request is None' comment slightly disrupts understanding.