Sample
pyint-51028bef1232-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.002 | 0–1; higher is more readable |
| Dorn | 0.459 | 0–1; higher is more readable |
| Mi | 0.464 | 0–1; higher is more readable |
| LLOC | 35 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.653 | 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. | 1777.581 | −58.66 |
| Source linesThe number of non-empty source lines. | 126 | +50.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.517 | −6.775 |
Intercept 8.87 + feature contributions = -6.165 (log-odds).
Score = sigmoid(-6.165) = 0.002.
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. | 127 | −3.46 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 125.856 | +1.349 |
| 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 | −0.994 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 109.976 | +0.97 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 46 | +0.854 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.03 | +0.649 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
Intercept 0.07 + feature contributions = -0.164 (log-odds).
Score = sigmoid(-0.164) = 0.459.
| Score | 0.464 |
|---|
| Score | 35 |
|---|
Run 1
The code is highly readable due to its clear class-based structure, comprehensive docstrings, and logical organization. The View class is well-documented with examples and version notes, making intent explicit. Function definitions are straightforward, and type hints improve clarity. Nesting is minimal—only one level in the as_view method's conditional blocks. The code is moderately concise, with some verbose type ignores and long lines that slightly reduce readability. Action granularity is generally good, though a few lines combine multiple operations (e.g., function calls with type ignores). Overall reading flow is natural, progressing logically from class attributes to methods. Minor deductions for occasional line length and type-ignore clutter.
Run 2
The code is highly readable overall. It is logically organized, with class variables and methods clearly separated. The docstrings are detailed and explain intent well. The `as_view` method shows slight nesting due to the `if cls.init_every_request` branch, but the branches are short and easy to follow. Action granularity is mostly one action per line; a few lines combine type ignores and assignments but remain understandable. The reading flow is natural, moving from class setup to dispatch behavior to the factory method. Minor length comes from extensive documentation, which is appropriate for a public API rather than unnecessarily long. The recursive decorator application and view metadata assignments are clear, though in a couple of spots, long lines with type ignores slightly reduce readability.
Run 3
The code is well-structured and highly readable, with clear separation of class-level documentation, type annotations, and method definitions. The `View` class includes extensive docstrings that explain purpose and usage, contributing to clarity of intent. Nesting is minimal, limited to one level inside conditional blocks and loops. Action granularity is mostly one action per line, though a few lines combine instantiation, type comments, and method calls. Reading flow is natural, following a logical sequence from class definition to method implementation. Code length is justified by educational/documentation content rather than unnecessary complexity. Minor readability reductions come from inline type-ignore comments and slightly dense lines in `as_view`, but overall the code is very readable.
Run 1
Code Structure: Well-organized class with configuration attributes, an abstract dispatch method, and a view factory. Nesting: Mostly shallow; conditional nested function definitions and the decorator loop add manageable complexity. Clarity of intent: Descriptive names, type annotations, and thorough documentation clearly explain behavior, including instance reuse. Dynamic function attributes and type-ignore comments require some extra interpretation. Code length: Implementation is concise, though extensive documentation and repeated wrapper logic slightly increase reading effort. Action granularity: Each statement generally performs one action, with metadata assignments clearly separated. Reading flow: Naturally progresses from configuration to dispatch and view creation; closures, decorator application, and metadata attachment introduce minor cognitive overhead.
Run 2
Code Structure: Logically organized into class configuration, an abstract dispatch method, and a view factory. Nesting: Shallow overall, with understandable nested functions and a decorator loop. Clarity of intent: Descriptive names, type annotations, and detailed documentation clearly explain behavior, though dynamic function attributes and closures require some familiarity. Code length: Implementation is concise; extensive documentation adds length but provides useful context. Minor duplication exists between the two generated view functions and metadata assignments. Action granularity: Each line generally performs one action, with no compressed multi-statement lines. Reading flow: Progresses naturally from configuration to request dispatch and callable setup. Long return lines, inline type-checker suppression comments, and repeated metadata assignments slightly interrupt the otherwise clear flow.
Run 3
Code Structure: Imports, configuration attributes, and methods are logically organized with clear responsibilities. Nesting: Limited to conditional branches, nested view functions, and a decorator loop; depth remains manageable. Clarity of intent: Descriptive names, type annotations, and comprehensive documentation explain instance lifecycle and route generation, though dynamic function attributes and closures require extra attention. Code length: Implementation is reasonably concise, but extensive documentation, repeated metadata assignments, and duplicated dispatch calls slightly increase reading effort. Action granularity: Statements generally perform one action per line; chained dispatch invocation is compact but understandable. Reading flow: Progresses naturally from class configuration to dispatch behavior and view construction. Long type-ignore comments and documentation markup occasionally interrupt the otherwise clear flow.