Sample
pyint-4c90b995c19f-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.862 | 0–1; higher is more readable |
| Mi | 0.574 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.607 | 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. | 919.264 | −30.336 |
| Source linesThe number of non-empty source lines. | 36 | +14.4 |
| 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.341 | −6.512 |
Intercept 8.87 + feature contributions = -13.577 (log-odds).
Score = sigmoid(-13.577) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 69.973 | +0.701 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 34 | +0.439 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.413 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 37 | −0.274 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 35.69 | +0.089 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 49.649 | −0.003 |
Intercept 0.07 + feature contributions = 1.833 (log-odds).
Score = sigmoid(1.833) = 0.862.
| Score | 0.574 |
|---|
| Score | 20 |
|---|
Run 1
The code is generally well-structured and readable. It uses clear naming conventions, logical organization, and flat nesting with minimal indentation levels. The class has a clear purpose, and the methods are concise with appropriate action granularity. The __call__ method is straightforward, and the __repr__ method demonstrates good formatting practices. However, there are minor readability issues: the __call__ method could benefit from a docstring explaining the validation logic, and the conditional in __repr__ could be slightly clearer with a helper method. The code is idiomatic Python with good use of type hints and decorators, but the validation flow could be more explicit. Overall, it strikes a good balance between conciseness and clarity, with minor room for improvement in documentation and separation of concerns within the __repr__ method.
Run 2
The code demonstrates good structure with a well-defined class that has clear responsibilities. The nesting is minimal, with only one level of indentation in the __call__ method. Intent is generally clear, especially with the docstring explaining the design choice of using a callable class. However, the __repr__ method could be clearer about its output format. The code is concise without unnecessary repetition. Action granularity is appropriate - each line performs a distinct operation. Reading flow is somewhat disrupted by the f-string construction in __repr__, which splits the output string across multiple lines. The use of type hints is adequate but could be more explicit. The import structure is organized alphabetically. Overall, the code is readable but could benefit from slightly better documentation and more explicit type annotations.
Run 3
The code is highly readable with clear structure, flat nesting, and logical organization. The class is well-named, uses attrs decorators concisely, and defines two attributes with appropriate validators. The __call__ method performs one action per line, making the control flow obvious: optional iterable validation followed by member iteration and validation. The __repr__ method is clean and readable despite minor string formatting complexity. The code avoids unnecessary length and each component has a clear purpose. Only slight deductions for the conditional f-string construction in __repr__, which requires a moment to parse, and the docstring could be slightly more descriptive. Overall it exemplifies clean, maintainable Python code.
Run 1
Code Structure: The class logically separates configuration, validation, and representation, though several unused imports add clutter. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make validation behavior clear, but is_callable() and optional() are not defined or imported in the snippet, and the docstring explains the callable-class design rather than the method's validation behavior. Code length: The implementation is concise; multiline formatting adds some length but keeps expressions readable. Action granularity: Each statement performs one clear action, with no compressed compound statements. Reading flow: Validation proceeds naturally from the iterable itself to its members, followed by representation logic. The conditional expression and split f-string in __repr__ require minor extra parsing.
Run 2
Code Structure: The class cleanly separates attribute definitions, validation behavior, and representation formatting, though several imports appear unused in this snippet. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation clear; however, is_callable() and optional() are not defined or imported in the shown code, and the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, although representation formatting spans several lines. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from configuration to execution to representation is natural; the multiline conditional expression slightly interrupts an otherwise straightforward flow.
Run 3
Code Structure: The class logically groups validator configuration, validation behavior, and representation, though several imports appear unused in this excerpt. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation clear; however, is_callable() and optional() are not defined or imported in the shown code, and the docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, with modest extra formatting for the representation. Action granularity: Each statement performs one clear action, without compressed or compound operations. Reading flow: Configuration naturally precedes validation and representation; the multiline conditional expression and split f-string slightly interrupt an otherwise smooth flow.