Sample
pyint-4c3b58458c6f-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.436 | 0–1; higher is more readable |
| Mi | 0.657 | 0–1; higher is more readable |
| LLOC | 51 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.593 | 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. | 2560.102 | −84.483 |
| Source linesThe number of non-empty source lines. | 107 | +42.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.402 | −6.603 |
Intercept 8.87 + feature contributions = -39.416 (log-odds).
Score = sigmoid(-39.416) = 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. | 107 | −2.752 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 78 | +1.961 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 78 | −1.369 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 106.843 | +1.084 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 100.981 | +0.825 |
| 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. | 100.954 | −0.611 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.042 | +0.537 |
Intercept 0.07 + feature contributions = -0.256 (log-odds).
Score = sigmoid(-0.256) = 0.436.
| Score | 0.657 |
|---|
| Score | 51 |
|---|
Run 1
The code has some positive aspects, such as type annotations and a docstring for the class, but it suffers from severe readability issues. The import block is disorganized with inconsistent spacing and alignment, making it difficult to scan. Several lines cram multiple statements together (e.g., in __getstate__ and __init__), violating the one-action-per-line principle. The lambda assignments in __init__ are densely packed and hard to follow, with awkward line breaks and trailing spaces. Nesting is not deeply problematic, but the if/elif chain combined with lambdas reduces clarity. Code length is acceptable, but the lack of consistent formatting, coupled with cramped expressions and inconsistent indentation in places, significantly impairs natural reading flow. Overall, the code is functional but far from readable, requiring significant reformatting to improve comprehension.
Run 2
The code is functionally organized but suffers from poor readability due to inconsistent formatting and excessive nesting. The `Converter.__init__` method uses deeply nested conditional logic with lambda assignments, making the intent hard to follow. There are multiple actions packed into single lines (e.g., lambda definitions and assignment), violating the 'one action per line' principle. Import statements are irregularly aligned, and line breaks are inconsistent. The class docstring is clear, but `__init__` lacks a docstring and mixes type checking, attribute assignment, and conditional lambdas without separation. The reading flow is disrupted by awkward line wrapping and indentation. While the code is concise in places, this conciseness often comes at the cost of clarity. The structure would benefit from extracting helper methods and simplifying the branching logic to reduce cognitive load.
Run 3
The code has a clear class structure with a single Converter class and reasonable method separation, but suffers from several readability issues. Import formatting is inconsistent with awkward line breaks and spacing. The __init__ method has a deep nested conditional structure with four branches, making the logic harder to follow. Lambda assignments with positional parameters like `lambda value, _, __` obscure intent rather than clarifying it. Some lines are unnecessarily long (e.g., the _fmt_converter_call return statements exceeding 100 characters), while others are oddly broken. Formatting inconsistencies appear throughout—varying indentation, trailing spaces, and inconsistent line breaks in getstate returns. The docstrings are helpful and well-written, improving clarity of intent. Action granularity is mostly one action per line, but some lines combine multiple operations. Overall, the code is understandable but would benefit from cleaner formatting, extracted helper methods, and more descriptive variable names to improve readability.
Run 1
Code Structure: The class is logically organized into initialization, call formatting, and serialization methods, but inconsistent spacing and limited separation between methods weaken presentation. Nesting: Conditional logic stays shallow and is easy to follow. Clarity of intent: Descriptive method names and detailed docstrings explain converter behavior, although placeholder lambda parameters are cryptic and the serialization docstring omits takes_field. Code length: The implementation is reasonably concise, with some repetitive conditional checks and long formatted strings. Action granularity: Most executable lines perform one action, but crowded imports and dictionary entries reduce visual clarity. Reading flow: Methods follow a natural progression, yet irregular indentation, awkward closing parentheses, and long lines interrupt scanning.
Run 2
Code Structure: The class is logically organized into initialization, call formatting, and serialization methods, but inconsistent import formatting and missing spacing between methods weaken organization. Nesting: Control flow is shallow, with straightforward conditional branches and early returns. Clarity of intent: Descriptive method names and detailed docstrings explain the converter behavior, though placeholder lambda parameters and the abbreviated variable 'ex' require interpretation. The serialization docstring also omits takes_field. Code length: The implementation is reasonably concise, although repeated flag checks and generated-call expressions introduce some repetition. Action granularity: Most statements perform one action per line, but crowded imports and dictionary entries reduce visual separation. Reading flow: Methods follow a natural progression, but irregular whitespace, awkward closing parentheses, and long formatted strings interrupt scanning.
Run 3
Code Structure: The class is logically organized into initialization, call formatting, and serialization methods, but inconsistent spacing and crowded imports weaken presentation. Nesting: Conditional logic remains shallow, with straightforward branches and early returns. Clarity of intent: Descriptive method names and detailed docstrings explain converter behavior, although placeholder lambda arguments and dynamically assigned __call__ require extra interpretation. The __getstate__ docstring also omits takes_field despite its inclusion in the returned state. Code length: Methods are reasonably concise, though repeated converter-call strings and numerous imports unused in this snippet add clutter. Action granularity: Most statements perform one action per line, but multiple imports and dictionary entries share lines awkwardly. Reading flow: Method order is natural, but missing blank lines between methods, irregular indentation within continuations, and excessive inline whitespace interrupt scanning.