Sample
pyint-285ea0b567b8-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.873 | 0–1; higher is more readable |
| Mi | 0.502 | 0–1; higher is more readable |
| LLOC | 41 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.564 | 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. | 2303.37 | −76.011 |
| Source linesThe number of non-empty source lines. | 67 | +26.8 |
| 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.54 | −6.809 |
Intercept 8.87 + feature contributions = -47.151 (log-odds).
Score = sigmoid(-47.151) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 62 | +1.407 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 68 | −1.371 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87.971 | +0.615 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 66.944 | +0.526 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.061 | +0.345 |
| 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. | 87.985 | −0.061 |
Intercept 0.07 + feature contributions = 1.928 (log-odds).
Score = sigmoid(1.928) = 0.873.
| Score | 0.502 |
|---|
| Score | 41 |
|---|
Run 1
The code is well-structured with clear logical organization: imports are grouped logically, the class has a clear docstring, and methods are concise. Nesting is minimal, with only one level in the constructor and clean method. Intent is clear throughout—the field validates values against a parent instance. Code length is appropriate with no unnecessary verbosity. Action granularity is mostly one action per line, though some lines like chained getattr calls in the clean method could be considered slightly dense but remain readable. Reading flow is natural, with straightforward method ordering and intuitive variable naming. Minor deductions for the parent_instance arguments potentially hurting reusability, but overall this is Django-quality readable code.
Run 2
The code is well-structured and readable. Imports are clearly organized with sensible grouping from standard and Django libraries. The class has a clear single responsibility and follows Django conventions. Nesting is shallow, with only one level in the clean() method's conditional logic. Intent is immediately apparent from the class name, docstring, and method names. Code length is appropriate — no unnecessary verbosity or duplication. Each logical action is generally on its own line, and variable names are descriptive (parent_instance, pk_field, to_field). Reading flow is natural: initialization, validation, change detection. Minor deductions: the conditional assignment in __init__ could be slightly clarified, and a brief comment explaining the string comparison in clean() would improve understanding. Overall, it's maintainable and idiomatic Django code.
Run 3
The code is well-structured and follows Django conventions. Imports are logically grouped by module. The class has a clear single purpose with a helpful docstring. Methods are short and focused, with good separation of concerns. Nesting is shallow, with only one level inside `__init__` and `clean`. Action granularity is largely one action per line, improving traceability. Reading flow is natural — the `clean` method clearly indicates the validation path, including fallbacks for empty values and conversions for comparison. Minor deductions: a few lines are slightly dense (e.g., chained attribute access and combined if/else), and the `has_changed` method lacks a docstring or explanatory comment despite being non-obvious behavior. Overall, clarity is high, length is appropriate, and structure is idiomatic.
Run 1
Code Structure: The class is logically organized into initialization, validation, and change detection, although many imports are unused in this snippet. Nesting: Conditional nesting is shallow and manageable; early returns simplify validation. Clarity of intent: Descriptive method names, the docstring, and comments explain the parent-instance validation, though 'orig' is vague and the constant False from has_changed lacks explanation. Code length: The implementation is concise, but the extensive imports add unnecessary visual overhead. Action granularity: Statements generally perform one action per line, with readable multiline formatting. Reading flow: Initialization naturally precedes validation and change detection, and validation progresses clearly from empty-value handling to comparison and return.
Run 2
Code Structure: The class is logically organized into initialization, validation, and change detection, though many imports are unused in this snippet. Nesting: Conditional nesting is shallow, and early returns keep validation easy to follow. Clarity of intent: Descriptive names, a class docstring, and comments explain the parent-instance validation; however, 'orig' is vague, and the unconditional False in has_changed lacks an explanation. Code length: Methods are concise, although the extensive import block adds unnecessary length to the presented code. Action granularity: Each statement performs a single clear action, with sensible formatting of longer expressions. Reading flow: Initialization naturally precedes validation, and the validation progresses from empty-value handling to comparison and error reporting.
Run 3
Code Structure: The class is logically organized into initialization, validation, and change detection, though numerous unused imports clutter the snippet. Nesting: Conditional nesting is shallow and manageable, with early returns simplifying validation. Clarity of intent: Descriptive class and attribute names, a docstring, and comments explain the parent-instance validation purpose; 'orig' is less descriptive, and the unconditional has_changed() result lacks explanation. Code length: Methods are concise, but the import block is disproportionately long for the functionality shown. Action granularity: Each statement generally performs one action, and multiline formatting keeps calls readable. Reading flow: Initialization naturally precedes validation and change detection; straightforward branching makes execution easy to follow, with minor repetition in retrieving the parent key.