Sample
pyint-659e581d989a-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.84 | 0–1; higher is more readable |
| Mi | 0.262 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.573 | 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. | 635.312 | −20.965 |
| Source linesThe number of non-empty source lines. | 28 | +11.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.411 | −6.617 |
Intercept 8.87 + feature contributions = -7.512 (log-odds).
Score = sigmoid(-7.512) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.931 | +0.598 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.049 | +0.463 |
| 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. | 26 | +0.162 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 27.739 | −0.022 |
| 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 | −0.02 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 29 | +0.01 |
Intercept 0.07 + feature contributions = 1.659 (log-odds).
Score = sigmoid(1.659) = 0.84.
| Score | 0.262 |
|---|
| Score | 17 |
|---|
Run 1
The code is highly readable with clear structure, minimal nesting, and concise length. It demonstrates logical organization with a single class defined using the attrs decorator. The nesting depth is shallow (one conditional within one method), maintaining an easy-to-follow flow. Intent is unambiguous — a validator ensuring a value is a subclass of a specified type. Action granularity is appropriate; the conditional check, exception raising, and repr methods each perform coherent actions. Reading flow is natural, with type hints, docstring, and f-strings improving clarity. Minor points could be made about one-line methods or slightly more descriptive parameter names, but overall it is excellent.
Run 2
The code is well-structured and highly readable. It follows a clear logical organization with imports at the top, a single class definition with a clear purpose, and well-separated methods. Nesting is minimal—only one conditional inside the __call__ method, keeping the code flat and easy to follow. Intent is clearly communicated through descriptive naming (e.g., _SubclassOfValidator, type, attr, value) and a concise docstring explaining why a callable class is used. Code length is appropriate; there is no unnecessary verbosity or duplication. Action granularity is well-maintained, with one meaningful operation per logical segment, though some lines contain multiple function arguments, which is acceptable for readability. The reading flow is natural: imports, class definition, method logic, and string representation are all ordered logically. Minor deductions could be made for slight complexity in the error-raising block, but overall the code is clear, maintainable, and readable.
Run 3
The code is well-structured and highly readable. It uses a class-based validator with a clear single responsibility: verifying subclass relationships. Imports are organized logically, and the use of the attrs decorator reduces boilerplate. Nesting is minimal; the main logic is flat and straightforward. Intent is clear from the class name and the descriptive error message. Code length is concise without sacrificing clarity. Action granularity is appropriate, with each logical step separated. The reading flow is natural, moving from definition to validation to representation. Minor deductions: the import of `operator`, `re`, `Pattern`, `contextmanager`, and several attrs utilities are unused, which slightly reduces cleanliness. The docstring inside `__call__` is helpful but could be more prominent. Overall, this is a clean and maintainable validator implementation.
Run 1
Code Structure: The validator is logically organized into its attribute, validation method, and representation method, though several unused imports add clutter. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: The class name, issubclass check, and descriptive error message clearly communicate the purpose; the docstring explains the callable-class design rather than validation behavior, and inst is unused. Code length: The implementation is concise, although the multiline exception construction is somewhat verbose. Action granularity: Each statement performs one clear action, with message construction separated from raising the exception. Reading flow: The progression from configuration to validation to representation is natural, but framework-specific decorators and attrib require some background knowledge.
Run 2
Code Structure: Imports and a focused validator class are logically organized, though several imports are unused in this snippet. Nesting: Minimal nesting makes control flow easy to follow. Clarity of intent: Class naming, the subclass check, and the error message clearly communicate validation behavior; however, the __call__ docstring explains representation customization rather than validation, and inst is unused. Code length: The implementation is concise, although unused imports and the expanded exception arguments add minor clutter. Action granularity: Each statement performs a distinct action, with message construction separated from raising the exception. Reading flow: The progression from stored type to validation to representation is natural, but abbreviations such as inst and attr and framework-specific decorators require some contextual knowledge.
Run 3
Code Structure: Imports and a small validator class are logically organized, though many imports are unused in this snippet. Nesting: Minimal nesting, with only one conditional inside the validation method. Clarity of intent: The class name, subclass check, descriptive error message, and custom representation clearly communicate its purpose; however, the docstring explains the callable-class design rather than the method's validation behavior, and abbreviated parameter names slightly reduce clarity. Code length: The implementation is concise, although the multiline exception construction is somewhat verbose. Action granularity: Each statement performs a single clear action. Reading flow: The sequence from configuration to validation to representation is natural and easy to follow, with minor spacing and import clutter detracting from polish.