Sample
pyint-31b65a6e8356-I01
Remove comments and docstrings
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.514 | 0–1; higher is more readable |
| Mi | 0.419 | 0–1; higher is more readable |
| LLOC | 24 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.538 | 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. | 866.467 | −28.593 |
| Source linesThe number of non-empty source lines. | 42 | +16.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.142 | −6.213 |
Intercept 8.87 + feature contributions = -9.136 (log-odds).
Score = sigmoid(-9.136) = 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. | 42 | +0.716 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 42 | −0.543 |
| 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. | 73.93 | +0.534 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 40 | −0.38 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.067 | +0.29 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 41.76 | +0.174 |
Intercept 0.07 + feature contributions = 0.056 (log-odds).
Score = sigmoid(0.056) = 0.514.
| Score | 0.419 |
|---|
| Score | 24 |
|---|
Run 1
The code is generally readable with a clear class purpose and logical method separation. It uses flat nesting and concise expressions, and each method performs one focused action. However, there are minor issues: repeated local imports of `inspect` are unnecessary and slightly disrupt reading flow; the class name `_AnnotationExtractor` is private and somewhat vague; the use of `_GenericAlias` and imported types from `typing` are unused, adding ambiguity. The blank line formatting is inconsistent, and the comment style lacks context. Overall, the structure is clean and action granularity is good, but the code could be tightened by moving the import to module level and removing unused imports to improve clarity.
Run 2
The code is generally clear but has several issues. Imports (threading, Mapping, Sequence, Callable, _GenericAlias) are unused, adding noise. The class structure is straightforward, but methods have extra blank lines and comments that do not add meaningful information. Repeated local imports of `inspect` in each method are redundant and hinder readability. The logic is mostly flat with minimal nesting, which is good, but the guards (`if not self.sig`) could be simplified by early returns. The class name `_AnnotationExtractor` and method names are descriptive, but the heavy use of conditional checks and local imports obscures intent. Action granularity is acceptable, though some multi-line conditions are a bit long. Overall, concise and functional but cleaned-up imports and a module-level `inspect` import would improve clarity and flow.
Run 3
The code is generally readable with clear separation into a class with two focused methods. Imports are organized, though _GenericAlias is unused. The class uses __slots__, which is good but somewhat advanced. Nesting is minimal and flow is natural. However, clarity suffers from unnecessary repeated local imports of inspect, which could be moved to the module level. The get_first_param_type method converts parameters to a list unnecessarily; iterating directly would be cleaner. Docstrings are absent, and method names are clear but could benefit from comments explaining intent. Action granularity is mostly good, but the nested condition in get_return_type reduces flatness slightly. Overall, readable but not exemplary.
Run 1
Code Structure: The class logically groups signature extraction and annotation access into focused methods, though unused imports add clutter. Nesting: Shallow conditionals and early returns keep complexity low. Clarity of intent: Method names clearly describe their purpose; naming the constructor parameter 'callable' shadows a built-in, and the abbreviated attribute 'sig' is slightly less explicit. Code length: The implementation is concise, but repeated local imports and excessive blank lines are unnecessary. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: The progression from initialization to parameter and return annotation retrieval is natural; inconsistent whitespace and the unnecessarily expanded return-type condition mildly interrupt scanning.
Run 2
Code Structure: The class logically groups signature extraction and annotation access, though unused module imports and repeated local imports add clutter. Nesting: Shallow conditionals and early returns keep control flow easy to follow. Clarity of intent: Descriptive method names make the purpose clear; 'sig' is slightly abbreviated, and the parameter 'callable' shadows a built-in. Code length: The implementation is concise, but excessive blank lines and repeated imports are unnecessary. Action granularity: Each statement performs a single clear action. Reading flow: Initialization followed by parameter and return-type accessors is natural, although inconsistent whitespace and the unnecessarily expanded return-annotation condition mildly interrupt reading.
Run 3
Code Structure: The class is logically organized into initialization and two focused annotation-access methods, though unused imports add clutter. Nesting: Shallow conditionals and early returns make execution easy to follow. Clarity of intent: Class and method names clearly communicate annotation extraction; however, 'sig' is abbreviated and the parameter 'callable' shadows a built-in. Code length: The implementation is concise, but repeated local imports and excessive blank lines introduce unnecessary visual noise. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural sequence, and exception handling is straightforward; inconsistent whitespace and an unnecessarily expanded return-type condition slightly interrupt the flow.