Sample
pyint-3a7a34fa27cf-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.002 | 0–1; higher is more readable |
| Dorn | 0.697 | 0–1; higher is more readable |
| Mi | 0.535 | 0–1; higher is more readable |
| LLOC | 29 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.719 | 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. | 1056.775 | −34.874 |
| Source linesThe number of non-empty source lines. | 66 | +26.4 |
| 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.513 | −6.769 |
Intercept 8.87 + feature contributions = -6.372 (log-odds).
Score = sigmoid(-6.372) = 0.002.
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. | 67 | −1.336 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 46 | +0.854 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 46 | −0.635 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.039 | +0.566 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 65.833 | +0.51 |
| 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. | 77 | +0.404 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.612 | +0.399 |
Intercept 0.07 + feature contributions = 0.833 (log-odds).
Score = sigmoid(0.833) = 0.697.
| Score | 0.535 |
|---|
| Score | 29 |
|---|
Run 1
The code demonstrates excellent readability through clear structure and organization. Imports are logically grouped with a mix of standard library, third-party, and local modules. The Factory class has a well-documented purpose with a clear docstring explaining its usage and parameters. Each method has a single, focused responsibility - __init__, __getstate__, and __setstate__ each perform one clear action. The code uses modern Python features appropriately (__slots__, zip with strict=True, type hints) without sacrificing clarity. Naming conventions are consistent and descriptive. The use of __slots__ reduces memory overhead while the concise implementation avoids unnecessary verbosity. Comments are minimal but meaningful, with version annotations where relevant. The only minor deduction is that some context about the broader attrs library would help understand this class's role in the larger system, but within its scope, it's exceptionally clear and well-structured.
Run 2
The code is highly readable. It has a clear class definition with a well-documented docstring explaining purpose and parameters. Imports are organized logically from standard library to local modules. The Factory class uses __slots__ for efficiency and implements pickle support cleanly. The constructor is concise and clear, with default values. The __getstate__/__setstate__ methods are flat, use tuple/generator and zip with strict=True, making intent obvious. Minor deductions could be for lack of type hints in method signatures and slight reliance on internal dunder methods that may not be immediately clear to all readers, but these are acceptable given the library context and Python idiom. Overall structure, granularity, and flow are excellent.
Run 3
The code demonstrates strong structural organization with clear imports, a single well-defined class, and appropriate use of slots. Nesting is minimal and action granularity is clear. The Factory class has an easily understood purpose and the docstrings explain the intent well. Reading flow is natural, with the class definition following imports and the methods following the constructor. Minor deductions: a module-level docstring is missing, and the constructor parameters lack type hints, which would improve clarity. Overall, this is highly readable code.
Run 1
Code Structure: Imports and a single focused class are logically organized, although many imports are unused in this snippet. Nesting: Methods are flat, with only one simple loop. Clarity of intent: The class docstring clearly explains factory behavior, and descriptive names make initialization and serialization understandable; the pickle method docstrings could explain the state format more precisely. Code length: The implementation is concise, though the import block is disproportionately large for the shown class. Action granularity: Each statement performs one clear action, with a straightforward generator expression for collecting state. Reading flow: The progression from documentation and slots to initialization and pickle support is natural. Minor spacing improvements between import groups and before the class would improve visual separation.
Run 2
Code Structure: The class is logically organized, with initialization followed by serialization methods, though the many unused imports clutter this excerpt. Nesting: Methods are flat, with only a simple loop in __setstate__. Clarity of intent: Descriptive names and a detailed class docstring clearly explain factory behavior; the pickle method docstrings are less precise. Code length: The implementation is concise, although the import block and documentation are substantial relative to the executable code. Action granularity: Each statement performs one clear action, and the generator expression remains easy to understand. Reading flow: Methods follow a natural progression, but the lack of blank lines between import groups and before the class slightly weakens visual organization.
Run 3
Code Structure: The class is logically organized into documentation, slots, initialization, and serialization methods, although many imports are unused in the shown snippet. Nesting: Methods are flat, with only a single shallow loop. Clarity of intent: Descriptive names and a detailed class docstring clearly explain the factory and takes_self behavior; the pickle method docstrings are less specific. Code length: The implementation is concise, though the import block is disproportionately large for this excerpt. Action granularity: Each statement performs one clear action, and the generator expression remains straightforward. Reading flow: Methods follow a natural order, and consistent formatting makes the class easy to scan; stronger separation between import groups would slightly improve readability.