Sample
pyint-b430695b04c9-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.741 | 0–1; higher is more readable |
| Mi | 0.392 | 0–1; higher is more readable |
| LLOC | 35 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.355 | 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. | 1363.068 | −44.981 |
| Source linesThe number of non-empty source lines. | 49 | +19.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.526 | −6.789 |
Intercept 8.87 + feature contributions = -23.3 (log-odds).
Score = sigmoid(-23.3) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 46 | +0.854 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 50 | −0.734 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 46 | −0.635 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.428 |
| 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. | 76.96 | +0.406 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.88 | +0.388 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.872 | +0.273 |
Intercept 0.07 + feature contributions = 1.05 (log-odds).
Score = sigmoid(1.05) = 0.741.
| Score | 0.392 |
|---|
| Score | 35 |
|---|
Run 1
The code is generally readable and well-structured. Imports are organized, the class has a clear single responsibility, and docstrings explain intent. Methods are short, with one primary action per line. Nesting is shallow. Minor deductions: the conditional import/version logic in `raise_any` is slightly tangled and uses a magic number (`0x0`) for index 0. The type annotations are clear but add verbosity. Overall, it reads naturally with a logical flow.
Run 2
The code is fairly readable with clear structure and intent. The class has a concise docstring explaining its purpose, methods are small and focused, and type hints are used consistently. The nesting is minimal and the flow is logical. The main weaknesses are minor: the `__enter__` method with just `pass` is awkward, the version check with a hex literal `(0x3, 0xb)` is less readable than `(3, 11)`, and the fallback `self.errors[0x0]` uses hex unnecessarily. The import block is long but organized. Overall, the code is understandable but could be slightly cleaner.
Run 3
The code is moderately readable. It has clear structure with a docstring and a single class, and the logic is understandable. Import block is organized somewhat logically. However, nesting is minimal and clarity of intent is fair but the use of '0x0' instead of '0' for list indexing and the version check 'sys.version_info >= (0x3, 0xb)' are cryptic and hurt readability. Action granularity is good, one action per line mostly. The context manager's 'pass' in __enter__ is a minor smell. The exception group fallback is terse and not obvious. Overall, it is readable but not excellent.
Run 1
Code Structure: The context manager is logically organized into initialization, entry, exit, and deferred error reporting, although many imports are unused in this snippet. Nesting: Control flow is shallow, with only two levels in raise_any. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection and deferred raising. Hexadecimal literals for Python versions and the zero index unnecessarily obscure familiar values. Code length: The implementation is concise, though the import block outweighs the small class. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Methods follow the natural context-manager lifecycle, making the class easy to follow; import grouping and spacing before the class could be improved.
Run 2
Code Structure: The class is logically organized into initialization, context-manager methods, and error propagation, although many unrelated imports add clutter. Nesting: Most methods are flat; raise_any has modest, easily followed nesting. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain error collection and deferred raising. Hexadecimal literals for Python versions and list indexing unnecessarily obscure familiar values. Code length: The implementation is concise, but unused imports and an avoidable else after raise reduce economy. Action granularity: Each line generally performs one action, making behavior easy to scan. Reading flow: Methods follow the natural context-manager lifecycle, though import clutter and limited spacing between top-level sections slightly interrupt the flow.
Run 3
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, although many unrelated imports clutter the snippet. Nesting: Mostly flat, with only modest nesting in raise_any. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection and deferred raising; hexadecimal constants obscure otherwise straightforward version and index values. Code length: The implementation is concise, but unused imports add unnecessary length. Action granularity: Statements generally perform one action per line. Reading flow: Methods follow the natural context-manager lifecycle, followed by error reporting; excessive imports and unconventional numeric notation slightly interrupt readability.