Sample
pyint-02177a38b85f-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.367 | 0–1; higher is more readable |
| Mi | 0.423 | 0–1; higher is more readable |
| LLOC | 31 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.677 | 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. | 1623.002 | −53.559 |
| Source linesThe number of non-empty source lines. | 43 | +17.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.792 | −7.188 |
Intercept 8.87 + feature contributions = -34.677 (log-odds).
Score = sigmoid(-34.677) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 43 | −0.566 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 44 | −0.522 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.06 | +0.356 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 42.784 | +0.188 |
| 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. | 86.977 | −0.019 |
Intercept 0.07 + feature contributions = -0.547 (log-odds).
Score = sigmoid(-0.547) = 0.367.
| Score | 0.423 |
|---|
| Score | 31 |
|---|
Run 1
The code is moderately readable but has several issues. The import section is lengthy but organized by type. The class definition is simple, but the __init__ method contains multiple operations in a single line and lacks type hints or docstrings. The __setitem__ method chains a helper function call with a parent method call, which reduces clarity. The use of double underscores and mixing of MIMEMixin and MIMEMultipart inheritance creates ambiguity about the class's true purpose. While the code is flat and not deeply nested, the lack of comments explaining the safety wrapper's intent hurts comprehension. The variable naming like _subtype and **_params is conventional for MIME but may confuse newcomers. Overall, the code is functional but could benefit from better documentation and clearer separation of actions.
Run 2
The code has a clear logical organization with imports grouped by source (standard library, third-party, local modules), which aids readability. The class structure is simple with straightforward inheritance and an explicit constructor that delegates to the parent class while adding an encoding attribute. However, readability is reduced by several factors: the constructor uses positional arguments with underscore-prefixed names suggesting internal use, which is not immediately clear. The __setitem__ method chains a function call with a parent method call in a single expression, reducing action granularity. The purpose of forbid_multi_line_headers is only hinted at by its name, but its behavior and side effects remain unclear without context. Variable names like _params and _subtype are cryptic. The code is concise but could be more readable with better parameter naming and by separating the validation from the assignment in __setitem__. The reading flow is generally natural, but the mix of protected-style parameters and method chaining makes the intent somewhat ambiguous.
Run 3
The code is partially readable. The imports are logically grouped and ordered, which aids navigation. The class definition and constructor signature are clear. However, readability is hurt by the presence of deprecated or complex utilities (e.g., deprecation wrappers) and by MIME's inherent reliance on single-letter variables like '_params', which obscure intent. The `__setitem__` method performs validation and assignment cleanly, but the overall structure remains flat yet dense due to the large import block. While not deeply nested, the code assumes familiarity with Django's email internals, making it less accessible to general readers. Concise but domain-heavy.
Run 1
Code Structure: Imports precede a small, logically organized class, though many imports are unused in this excerpt. Nesting: Methods are flat with no nested control flow. Clarity of intent: SafeMIMEMultipart and forbid_multi_line_headers clearly convey header-safety behavior, although MIMEMixin and the validation helper are not defined here, and val is a generic name. Code length: The class is concise, but the extensive import block dominates the excerpt. Action granularity: Each statement performs a distinct action; tuple unpacking naturally represents the validation result. Reading flow: Initialization followed by header assignment is easy to follow, with consistent formatting and a readable multiline signature. Additional separation between import groups and before the class would improve scanning.
Run 2
Code Structure: Imports precede a compact class with clearly separated initialization and header-assignment methods, though many imports are unused in this excerpt. Nesting: Flat methods with no nested control flow make the code easy to scan. Clarity of intent: SafeMIMEMultipart and forbid_multi_line_headers communicate safe MIME header handling, although MIMEMixin and the validation helper are defined elsewhere. Code length: The class is concise, but the extensive import block outweighs the implementation shown. Action granularity: Each statement performs a single clear operation. Reading flow: Initialization followed by customized header assignment is natural; explicit parent-class calls are understandable, though super() could make the inheritance flow more idiomatic.
Run 3
Code Structure: Imports are grouped logically, and the class cleanly separates initialization from header assignment, though many imports are unused in this excerpt. Nesting: Both methods are flat and easy to follow. Clarity of intent: The class name and header-validation call clearly suggest safe MIME handling, but MIMEMixin and forbid_multi_line_headers are not defined here, and abbreviated parameter names require familiarity with the underlying API. Code length: The class is concise; the extensive import section is disproportionate to the shown functionality. Action granularity: Each statement performs a distinct operation, with tuple assignment naturally representing one validation step. Reading flow: Initialization followed by assignment interception creates a natural progression, although an additional blank line before the class and a short explanatory docstring would improve presentation.