Sample

pyint-9176e32f493e-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines33

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8140–1; higher is more readable
Mi0.3740–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.6010–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from jinja2.loaders import BaseLoader from werkzeug.routing import RequestRedirect from .blueprints import Blueprint from .globals import _cv_app from .sansio.app import App class DebugFilesKeyError(KeyError, AssertionError): """Raised from request.files during debugging. The idea is that it can provide a better error message than just a generic KeyError/BadRequest. """ def __init__(self, req: Request, key2: str) -> None: form2 = req.form.getlist(key2) buf2 = [ f"You tried to access the file {key2!r} in the request.files" " dictionary but it does not exist. The mimetype for the" f" request is {req.mimetype!r} instead of" " 'multipart/form-data' which means that no file contents" " were transmitted. To fix this error you should provide" ' enctype="multipart/form-data" in your form.' ] if form2: nam = ", ".join(repr(x2) for x2 in form2) buf2.append( "\n\nThe browser instead transmitted some file names. " f"This was submitted: {nam}" ) self.msg = "".join(buf2) def __str__(self) -> str: return self.msg

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.782.526−25.823
Source linesThe number of non-empty source lines.33+13.2
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.455−6.683

Intercept 8.87 + feature contributions = -10.436 (log-odds).
Score = sigmoid(-10.436) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.038+0.568
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.74.882+0.494
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.31+0.335
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.33.088−0.271
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.776+0.048

Intercept 0.07 + feature contributions = 1.475 (log-odds).
Score = sigmoid(1.475) = 0.814.

Score0.374
Score18
Run 1

The code is generally readable with clear structure, minimal nesting, and purpose-driven methods. The error class is well-documented, and the message-building list pattern is clear. However, some variable names (key2, form2, buf2, x2, nam) hinder clarity, and the inline string concatenation in the list makes action granularity slightly less clean. The flow is natural but could be improved with more descriptive naming and slightly better separation of message segments.

Run 2

The code is well-structured and readable. It uses clear imports and type hints, with one logical class definition. Nesting is minimal—just one level inside the __init__ conditional. The intent is clearly documented in the class docstring and the error message construction is explicit. Code length is appropriate for the task; the string building is slightly verbose but justified for a detailed user-facing error. Action granularity is mostly one action per line, especially in the conditional block. Reading flow is natural: construction of message parts, conditional addition, then assignment. Minor deductions: the variable names like buf2, key2, form2, and x2 include unnecessary numeric suffixes, slightly reducing clarity, and the long f-string could be split for even better readability.

Run 3

The code has a clear purpose and reasonable structure, but readability is mixed. The class and method definitions are logically organized and the docstring clarifies intent. Nesting is minimal, and the error message construction is straightforward. However, several issues lower the score: variables like `key2`, `form2`, `buf2`, `x2`, and `nam` use confusing numeric suffixes; the message string is awkwardly split across multiple literals without clear separation; and `DebugFilesKeyError` inherits from both `KeyError` and `AssertionError`, which is unusual and not explained. Action granularity is mostly fine, but the `if form2:` block adds density. Reading flow is disrupted by inconsistent naming and unexplained import of `Request` which is not shown in the snippet. Overall, the logic is understandable but could be more readable with better naming, simpler exception hierarchy, and cleaner string assembly.

Run 1

Code Structure: The exception class is logically organized into initialization and string representation, but several unused imports clutter the snippet. Nesting: Only one conditional introduces nesting, keeping control flow simple. Clarity of intent: The descriptive class name, docstring, and detailed error message clearly explain the purpose; names such as key2, form2, buf2, and nam are less informative, and Request is not imported in the snippet. Code length: The implementation is concise, with most length devoted to a useful diagnostic message. Action granularity: Statements generally perform one action each, and the comprehension remains straightforward. Reading flow: Execution progresses naturally from gathering form values to constructing the message and returning its representation, although dense string concatenation and inconsistent variable naming slightly interrupt readability.

Run 2

Code Structure: The exception class is logically organized into initialization and string representation, though several unused imports add clutter. Nesting: Only one conditional is present, keeping the code shallow and easy to follow. Clarity of intent: The class name, docstring, and diagnostic message clearly explain its purpose, but names such as key2, form2, buf2, and nam are less descriptive than they could be; Request is not imported in the snippet. Code length: The implementation is reasonably concise, with most length devoted to a useful error message. Action granularity: Statements generally perform one action each, and the generator expression is straightforward. Reading flow: Execution proceeds naturally from gathering form values to constructing the message and exposing it through __str__, although fragmented string literals and limited spacing between top-level elements slightly interrupt readability.

Run 3

Code Structure: The exception class is logically organized, with initialization and string representation clearly separated, though several imports are unused and Request is not visibly imported. Nesting: Only one conditional keeps the code shallow and easy to follow. Clarity of intent: The docstring and detailed error message clearly explain the purpose, but names such as key2, form2, buf2, nam, and x2 are less descriptive than they could be. Code length: The implementation is compact; the long message is justified by its diagnostic purpose. Action granularity: Each statement performs a focused action, with no compressed multi-statement lines. Reading flow: Execution proceeds naturally from collecting form values to building the message and returning its representation. Limited spacing between top-level elements and distracting imports slightly reduce readability.