Sample
pyint-b1952590f951-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.892 | 0–1; higher is more readable |
| Mi | 0.449 | 0–1; higher is more readable |
| LLOC | 41 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 7.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12.33 | 0–20; mean of three runs |
| BTTF | 0.183 | 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. | 1596.996 | −52.701 |
| Source linesThe number of non-empty source lines. | 55 | +22 |
| 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.423 | −6.634 |
Intercept 8.87 + feature contributions = -28.465 (log-odds).
Score = sigmoid(-28.465) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 52 | +1.061 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 56 | −0.946 |
| 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.946 | +0.406 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.25 | +0.394 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.059 | +0.368 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 54.962 | +0.358 |
Intercept 0.07 + feature contributions = 2.11 (log-odds).
Score = sigmoid(2.11) = 0.892.
| Score | 0.449 |
|---|
| Score | 41 |
|---|
Run 1
The code is generally readable with clear class and method names, proper type hints, and logical structure. The context manager pattern is well-implemented and documented. However, readability suffers at the end of raise_any() where meaningless variable assignments (a=1, b=2, c=5, d=6, e=1, f=-1) obscure an otherwise simple version check and error indexing. This artificial obfuscation violates clarity of intent and action granularity. The version check could be 'if sys.version_info >= (3, 11)' and the fallback could simply be 'raise self.errors[0]'. The imports include unnecessary ones (os, werkzeug.utils, cache, update_wrapper) that add noise. The nested conditional in raise_any adds minor complexity but remains manageable. Overall structure is sound, but the deliberate variable obfuscation significantly reduces readability where it matters most - in the error handling logic.
Run 2
The code has clear structure and some readable elements, but contains multiple serious readability issues. The imports are organized and class/method names are descriptive, but the `raise_any` method uses meaningless variable names (a, b, c, d, e, f) that obscure what should be a simple version check. The nesting is unnecessarily deep with conditional statements inside conditionals, and there are several redundant operations (e.g., `a + b` instead of 3, `e + f` instead of 0). The `__enter__` method contains a `pass` statement, which could be omitted for clarity. Action granularity is inconsistent with multiple operations scattered across lines. The reading flow is disrupted by the cryptic variable names and indirect calculations. While the class docstring is helpful and the overall structure is not terrible, the implementation details severely hamper readability and make the code difficult to understand without mental effort to decode the meaningless variables and arithmetic.
Run 3
The code is poorly readable. While the first half (imports, class docstring, _CollectErrors.__init__, __enter__, __exit__) is structured logically and flat, the second half (raise_any method) is tangled and confusing. The logic for Python version detection uses meaningless variable names (a, b, c, d, e, f) which do not convey intent. Additionally, there are multiple actions on single lines (e.g., a = 1 on one line but then b = 2 on another; and a redundant if/else structure). Nesting is shallow but the flow is unnatural, forcing reader to decode pointless arithmetic and index calculations. A BaseExceptionGroup is referenced and all errors are collected, but the version check logic is cryptic. Overall, the useful functionality is buried under unnecessary assignments and unclear variable naming.
Run 1
Code Structure: The context-manager methods are logically organized, but numerous unused imports distract from the small class. Nesting: Mostly shallow, with only a two-level conditional in raise_any. Clarity of intent: Docstrings and type annotations clearly explain error collection, but meaningless variables and arithmetic obscure the Python 3.11 version check and selection of the first error. Code length: Unnecessarily extended by unused imports and assignments that could be replaced with direct constants. Action granularity: Each statement performs one action per line, making individual operations easy to follow. Reading flow: Error capture and deferred raising form a natural sequence, but the arbitrary a–f variables interrupt comprehension at the most important decision point.
Run 2
Code Structure: The context-manager class is logically organized, but numerous unused imports distract from its small purpose. Nesting: Mostly shallow, with only a modest nested conditional in raise_any. Clarity of intent: Docstrings, method names, and type annotations clearly explain error collection, but meaningless variables and arithmetic obscure the Python 3.11 version check and index zero. Code length: Unnecessarily extended by unused imports, temporary variables, and an avoidable else after a raise. Action granularity: Each statement performs one action, making individual lines easy to parse. Reading flow: Collection and suppression flow naturally, but the contrived calculations interrupt the otherwise straightforward error-raising logic.
Run 3
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, but numerous unused imports clutter the snippet. Nesting: Mostly shallow, with only two conditional levels in raise_any. Clarity of intent: Docstrings and type annotations clearly explain error collection, but meaningless variables and arithmetic obscure the Python 3.11 version check and first-error selection. Code length: The class is reasonably short, yet unnecessary imports, assignments, and an avoidable else branch add noise. Action granularity: Each statement performs one action, making individual lines easy to scan. Reading flow: Method ordering is natural and whitespace helps, but the transition from straightforward exception handling to artificial arithmetic disrupts comprehension.