Sample
pyint-ef343a8cfde5-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.755 | 0–1; higher is more readable |
| Mi | 0.591 | 0–1; higher is more readable |
| LLOC | 27 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.585 | 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. | 896.111 | −29.572 |
| Source linesThe number of non-empty source lines. | 49 | +19.6 |
| 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.211 | −6.317 |
Intercept 8.87 + feature contributions = -7.418 (log-odds).
Score = sigmoid(-7.418) = 0.001.
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. | 49 | −0.699 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 40 | +0.646 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 40 | −0.497 |
| 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.96 | +0.49 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.049 | +0.462 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.48 | +0.381 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.697 | +0.271 |
Intercept 0.07 + feature contributions = 1.125 (log-odds).
Score = sigmoid(1.125) = 0.755.
| Score | 0.591 |
|---|
| Score | 27 |
|---|
Run 1
The code is generally readable with clear class and method names, sensible docstrings, and consistent use of imports. Structure is logical, nesting is minimal, and actions are mostly one per line. Some issues slightly reduce clarity: the `__slots__` attribute is unnecessary for an extractor class, imports are scattered inside methods rather than centralized, and the `get_first_param_type` method creates a list unnecessarily. The conditional in `get_return_type` spans multiple lines and could be simplified for better flow. Overall, intent is clear but minor redundancies and import placement slightly hinder readability.
Run 2
The code is well-structured with a clear single-purpose class and focused methods. Nesting is minimal and logic is flat. Method names and docstrings clearly convey intent. Each method performs one action per line for the most part, though the return-type check condition is somewhat dense. Imports inside methods are slightly unusual but acceptable given optional dependency assumptions. Type hints are partially used but incomplete (e.g., 'callable' lacks annotation, 'sig' is untyped). The code is compact without unnecessary verbosity. The reading flow is natural, with methods sequenced logically. Minor improvements could include using a dataclass or attrs to reduce boilerplate, and hoisting the 'inspect' import to module level for consistency. Overall, it is clean, maintainable code that slightly misses top marks due to minor annotation gaps and localized complexity.
Run 3
The code is generally readable and well-structured. It has a clear purpose: extracting annotations from callables. The class and method names are descriptive, and docstrings explain intent. The structure is logical, with minimal nesting and flat conditionals. However, there are a few issues: the redundant `import inspect` inside each method (instead of once at module level) is unnecessary and slightly hampers flow. The `if not self.sig` check in `get_first_param_type` could be more explicit. The code uses `params = list(self.sig.parameters.values())` but only needs the first parameter, which adds minor length. The conditional in `get_return_type` is slightly verbose but clear. Overall, it is concise, with one action per line mostly, and reads mostly naturally, but the repeated imports and minor verbosity prevent a higher score.
Run 1
Code Structure: The class cleanly separates signature extraction from parameter and return annotation retrieval. Nesting: Shallow conditionals and early returns make the methods easy to follow. Clarity of intent: Descriptive method names and docstrings explain the purpose, though 'sig' is abbreviated and the parameter name 'callable' shadows a built-in. Code length: Concise overall, but repeated local imports and unused module-level imports add clutter. Action granularity: Each statement performs a single clear action. Reading flow: Initialization followed by focused accessor methods creates a natural progression; the multiline return-annotation condition slightly interrupts an otherwise smooth flow.
Run 2
Code Structure: The class logically groups signature extraction and annotation access into small, focused methods. Nesting: Control flow is shallow, with early returns and simple conditionals. Clarity of intent: Descriptive method names and docstrings clearly explain the purpose, although naming a parameter 'callable' shadows a built-in. Code length: The implementation is concise, but unused module-level imports and repeated local inspect imports add clutter. Action granularity: Each line generally performs one action, making operations easy to follow. Reading flow: Initialization followed by parameter and return annotation access forms a natural progression. The multiline return-type condition slightly interrupts the flow, and missing method type hints modestly reduce clarity.
Run 3
Code Structure: The class logically groups signature extraction and annotation access, although several module imports are unused. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Descriptive method names and docstrings explain the purpose; however, 'sig' is abbreviated, and the parameter name 'callable' shadows a built-in. Code length: Compact overall, with minor repetition from local inspect imports and explicit None returns. Action granularity: Statements generally perform one action per line. Reading flow: Initialization followed by focused accessor methods creates a natural progression, though the multiline return-annotation condition slightly interrupts an otherwise straightforward flow.