Sample
pyint-a77ba7bb03d2-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.54 | 0–1; higher is more readable |
| Mi | 0.224 | 0–1; higher is more readable |
| LLOC | 38 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.584 | 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. | 1802.659 | −59.488 |
| Source linesThe number of non-empty source lines. | 102 | +40.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.614 | −6.921 |
Intercept 8.87 + feature contributions = -16.739 (log-odds).
Score = sigmoid(-16.739) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 103 | −2.611 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 52 | +1.061 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 101.862 | +1.014 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 52 | −0.772 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.033 | +0.618 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 78.184 | +0.457 |
| 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. | 78.961 | +0.321 |
Intercept 0.07 + feature contributions = 0.159 (log-odds).
Score = sigmoid(0.159) = 0.54.
| Score | 0.224 |
|---|
| Score | 38 |
|---|
Run 1
The code is highly readable with clear structure and intent. It uses dataclasses and type hints effectively, and class-level configuration attributes are documented with explanatory comments. Methods are concise and follow single-responsibility principles. Docstrings provide useful context for each method. Nesting is minimal except for one conditional in `response()`. Action granularity is good, with one logical operation per line. The main weaknesses are the `_prepare_response_obj` method not being shown, which makes the flow slightly ambiguous, and the compact logic could be clearer. Overall, the code is well-organized, maintainable, and follows Python idioms.
Run 2
The code is highly readable. It has clear structure with logical class organization and well-documented attributes and methods. The nesting is minimal—only one conditional block in the response method with simple branches. Intent is clearly conveyed through docstrings explaining each method's purpose, parameters, and defaults. The code is concise without unnecessary verbosity, though some methods could be slightly more compact. Action granularity is appropriate, with single operations per line in most cases. Reading flow is natural: class-level configuration attributes are grouped together, methods follow a logical processing order, and the response method builds objects systematically. The type hints enhance understanding, and the docstrings provide helpful context about JSON serialization behaviors and edge cases.
Run 3
This code is highly readable with clear structure and purpose. The class is well-organized with a logical progression from class attributes to methods, and each method has explicit docstrings explaining its behavior and parameters. Nesting is minimal, with only a simple if/else conditional in the response method. The intent of the code is clear — it provides JSON serialization with specific defaults and formatting behaviors. The code is concise yet comprehensive, with no unnecessary verbosity. Each action is separated logically: setting defaults, serializing, and constructing responses are distinct steps. The reading flow is natural, moving from initialization through serialization to response generation. The use of type hints, dataclass-style attributes with docstrings, and clear naming conventions enhances clarity. Minor improvements could include extracting the conditional logic in response() into a separate method, but overall this is exceptionally readable Python code.
Run 1
Code Structure: Clearly organized into configuration attributes and focused serialization, deserialization, and response methods. Nesting: Minimal, with only one straightforward if/else branch. Clarity of intent: Descriptive names, type annotations, and detailed docstrings explain behavior well; undefined external references such as JSONProvider and _default limit standalone understanding, and hexadecimal 0x2 obscures a simple indentation value. Code length: Implementation is concise, although extensive documentation adds considerable length. Action granularity: Statements generally perform one action per line, with a readable multiline response construction. Reading flow: Configuration naturally precedes operations, and response preparation proceeds logically through formatting and construction. Minor distractions include unused imports in the excerpt and the slightly dense compact/debug condition.
Run 2
Code Structure: Configuration attributes and focused serialization, deserialization, and response methods are logically organized. Nesting: Methods are flat, with only one simple if/else branch. Clarity of intent: Descriptive names, type annotations, and detailed docstrings explain behavior well; however, JSONProvider, _default, and Response are not defined in this excerpt, and hexadecimal 0x2 is less intuitive than 2 for indentation. Code length: Implementation is concise, although extensive documentation and apparently unused imports add visual length. Action granularity: Each statement performs one clear action, and the multiline response construction remains readable. Reading flow: The progression from configuration to basic operations to response formatting is natural. Minor distractions include missing surrounding dependency context and using setdefault on a newly created dictionary where direct assignment would be clearer.
Run 3
Code Structure: Configuration attributes and focused serialization, deserialization, and response methods are logically organized. Nesting: Control flow is shallow, with only one simple if/else. Clarity of intent: Descriptive names, type annotations, and thorough docstrings clearly explain behavior; however, external definitions such as JSONProvider and _default are absent, and hexadecimal 0x2 is less intuitive than 2 for indentation. Code length: Implementation is concise, though extensive documentation increases scanning effort and several imports appear unused in this excerpt. Action granularity: Each line generally performs one clear operation, with sensible wrapping of the response construction. Reading flow: The progression from configuration to basic JSON operations to HTTP response generation is natural and consistent. Minor contextual gaps and unconventional notation prevent a perfect score.