Sample

pyint-bfcdf163c3cc-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines33

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8150–1; higher is more readable
Mi0.3820–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.5690–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, request: Request, key: str) -> None: form_matches = request.form.getlist(key) buf = [ f"You tried to access the file {key!r} in the request.files" " dictionary but it does not exist. The mimetype for the" f" request is {request.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 form_matches: names = ", ".join(repr(x) for x in form_matches) buf.append( "\n\nThe browser instead transmitted some file names. " f"This was submitted: {names}" ) self.msg = "".join(buf) 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.439−6.659

Intercept 8.87 + feature contributions = -10.412 (log-odds).
Score = sigmoid(-10.412) = 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.577
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.912+0.492
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.934+0.051

Intercept 0.07 + feature contributions = 1.485 (log-odds).
Score = sigmoid(1.485) = 0.815.

Score0.382
Score18
Run 1

The code is well-structured and readable. It uses clear imports, logical class definition, and a focused exception class with a single responsibility. The constructor builds an error message via a list of strings, which is a clean approach. Nesting is minimal (one conditional), and each line generally performs one logical action. The f-strings and multi-line string concatenation are readable, though the mixing of f-strings and plain string concatenation slightly interrupts flow. The class docstring explains intent clearly. Minor deductions: 'AssertionError' in the base classes is unusual and could confuse readers; 'form_matches' could be more descriptively named. Overall, the code is concise, well-organized, and easy to follow.

Run 2

The code is well-structured and readable. It defines a custom exception class with a clear purpose and logical organization. The constructor builds an error message in a flat, sequential manner without deep nesting. Each action is clearly separated, especially the conditional append to the message list. The variable names are descriptive (e.g., `form_matches`, `buf`), and the docstring explains the class's intent. The code is concise, though the f-string concatenation could be slightly simplified. The main readability drawback is the long multi-line string construction, which slightly interrupts reading flow. Overall, the code is clear, maintainable, and follows good practices for custom exception design.

Run 3

The code is generally well-structured and readable. It defines a single exception class with a clear error-message-building purpose. Nesting is minimal, with only a conditional block inside the constructor. The constructor builds an error message step-by-step, with one primary action per line, which improves clarity. However, readability is slightly reduced by a long f-string/string concatenation block, and some minor awkwardness in the message construction, such as mixing f-strings and regular strings across lines. The docstring explains the intent well. The use of `self.msg` and `__str__` is straightforward. Overall, it is concise and logically organized, but the string-building section could be clearer or more compact.

Run 1

Code Structure: The exception class cleanly separates message construction from string representation, although several imports appear unused and Request is not defined or imported in the snippet. Nesting: Only one conditional keeps the code shallow and easy to follow. Clarity of intent: The descriptive class name, docstring, and explanatory error message clearly communicate the debugging purpose. Code length: The implementation is concise; most of its length comes from useful diagnostic text. Action granularity: Each statement performs a focused action, with message fragments neatly split across lines. Reading flow: The sequence naturally progresses from collecting form values to building the message, optionally adding submitted filenames, and exposing the final text.

Run 2

Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__. Nesting: Only one conditional keeps the code shallow and easy to follow. Clarity of intent: The class name, docstring, descriptive variables, and explicit error message clearly communicate its purpose, although the Request annotation has no visible import and several imports are unused. Code length: The implementation is concise; most of its length comes from helpful diagnostic text rather than unnecessary logic. Action granularity: Each statement performs a distinct operation, with message fragments neatly split across lines. Reading flow: The progression from retrieving form values to constructing and optionally extending the message is natural. Minor spacing issues around imports and the class declaration slightly reduce polish.

Run 3

Code Structure: The exception class is logically organized, with message construction in __init__ and rendering in __str__; several unused imports add clutter. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: The descriptive class name, docstring, and detailed error message clearly explain its purpose, although Request is not imported in the snippet. Code length: The implementation is concise; most of its length supports a useful diagnostic message. Action granularity: Statements generally perform one action each, with a straightforward generator expression for formatting names. Reading flow: Execution progresses naturally from collecting form values to building the base message, adding optional context, and storing the result. Split string literals slightly interrupt reading but keep line lengths manageable.