Sample
pyint-4b7ddd80e522-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.226 | 0–1; higher is more readable |
| Mi | 0.464 | 0–1; higher is more readable |
| LLOC | 38 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.438 | 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. | 1918.114 | −63.298 |
| Source linesThe number of non-empty source lines. | 129 | +51.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.501 | −6.751 |
Intercept 8.87 + feature contributions = -9.579 (log-odds).
Score = sigmoid(-9.579) = 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. | 130 | −3.567 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 128.874 | +1.392 |
| 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. | 109.977 | −0.993 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 109.977 | +0.97 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 49 | +0.958 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 49 | −0.704 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.031 | +0.643 |
Intercept 0.07 + feature contributions = -1.231 (log-odds).
Score = sigmoid(-1.231) = 0.226.
| Score | 0.464 |
|---|
| Score | 38 |
|---|
Run 1
The code is reasonably readable with good structure, clear intent, and helpful documentation. Class variables, type hints, and docstrings improve clarity. Nesting is mostly shallow except for the if/else in `as_view`, which remains understandable. However, a major issue is a stray, unrelated factorial loop inside the `view` function, which breaks clarity and relevance. Additionally, some lines are dense—especially those mixing function calls with type ignores—and the `as_view` method handles multiple responsibilities (view creation, decoration, metadata assignment), reducing cohesion. But overall, logical organization and action granularity are moderate.
Run 2
The code is highly readable due to its clear logical organization, comprehensive docstrings, and type annotations. The View class is well-structured with class-level constants and a clean classmethod. Nesting is minimal, with only a single conditional and small nested function definitions. Intent is explicitly documented, especially in the docstring and comments. Code length is appropriate given the educational nature and necessary metadata. Each action is on its own line, improving clarity. The only minor readability drawbacks are slightly long function signatures and the unusual inline factorial loop, which may distract from the primary purpose. Overall, the code is maintainable, self-explanatory, and follows consistent style conventions.
Run 3
The code is generally well-structured with clear class-level documentation and type hints, making the intent understandable. However, there are some readability issues: the `as_view` method has a nested function with an unrelated factorial computation that breaks the natural reading flow and adds confusion. The method mixes setup logic (creating instances, applying decorators, attaching attributes) with the view function definition, making the action granularity uneven. The nesting is moderate, with conditional branches containing function definitions, but it could be flatter. The code length is acceptable but could be shorter if the factorial loop were removed. Overall, the code is readable for experienced developers familiar with Flask internals, but the unrelated computation and slightly tangled flow prevent a higher score.
Run 1
Code Structure: The class cleanly groups configuration, dispatch behavior, and view creation, though an unrelated factorial calculation disrupts cohesion. Nesting: Mostly shallow, with understandable conditional closures and loops; the factorial loop adds needless nesting. Clarity of intent: Descriptive names, type annotations, and thorough documentation explain the lifecycle and decorators well, but the unused factorial calculation is confusing. Code length: Executable logic is reasonably concise, although extensive documentation and repeated metadata assignments increase reading effort. Action granularity: Statements generally perform one action per line; chained dispatch calls remain understandable. Reading flow: Configuration proceeds naturally into dispatch and factory logic, but dynamic function attributes, type-ignore comments, and the irrelevant calculation interrupt an otherwise coherent flow.
Run 2
Code Structure: Logically organized into documented configuration attributes and focused methods; the unrelated factorial calculation disrupts cohesion. Nesting: Generally shallow, although conditional nested functions and the factorial loop add complexity. Clarity of intent: Descriptive names, type annotations, and thorough documentation explain the view lifecycle well; the unused factorial calculation is confusing, and dynamic function attributes require extra interpretation. Code length: Implementation is reasonably concise, but extensive documentation, repeated metadata assignments, and dead computation increase reading effort. Action granularity: Most lines perform one action; the combined ensure_sync and dispatch invocation is denser but understandable. Reading flow: Progresses naturally from configuration to dispatch and view construction, with clear branching for instance lifetime. Closure behavior, inline type-checker suppressions, and the irrelevant loop interrupt an otherwise coherent flow.
Run 3
Code Structure: Logically organized into class configuration, dispatch behavior, and view creation, although the unrelated factorial calculation disrupts cohesion. Nesting: Moderate nesting from conditional branches, inner functions, and loops remains manageable. Clarity of intent: Descriptive names, type annotations, and thorough documentation explain the class-based view mechanism; the unused factorial computation has no clear purpose. Code length: Implementation is reasonably concise, but extensive documentation and repeated metadata assignments increase reading length. Action granularity: Statements generally perform one action per line; chained dispatch calls are slightly denser. Reading flow: Configuration precedes behavior naturally, and comments explain dynamic attributes. However, closure behavior, duplicated inner-function definitions, numerous type-ignore annotations, and irrelevant arithmetic interrupt an otherwise clear flow.