Sample
pyint-97a83eab0bd2-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.873 | 0–1; higher is more readable |
| Mi | 0.428 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.451 | 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. | 701.154 | −23.138 |
| Source linesThe number of non-empty source lines. | 36 | +14.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.629 | −6.944 |
Intercept 8.87 + feature contributions = -6.812 (log-odds).
Score = sigmoid(-6.812) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 69.838 | +0.707 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.034 | +0.607 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 37 | −0.274 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 62.243 | +0.2 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 25 | +0.128 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 35.859 | +0.091 |
Intercept 0.07 + feature contributions = 1.928 (log-odds).
Score = sigmoid(1.928) = 0.873.
| Score | 0.428 |
|---|
| Score | 18 |
|---|
Run 1
The code is highly readable with clear structure and intent. It uses modern type hints, descriptive names, and comprehensive docstrings. The class hierarchy is logical, and the one-line update callback is concise. Minor deductions: the import of `te.Self` is missing from the shown imports, and `SessionMixin` appears undefined, suggesting incomplete context rather than poor structure. The `on_update` function could be slightly clearer with an explicit `__setitem__` override instead of a callback, but the current approach is acceptable. Nesting is minimal, action granularity is good, and reading flow is natural.
Run 2
The code shows moderate readability. Structure is generally logical with clear sectioning via class and method definitions, but the `__init__` method contains a nested function that makes the flow less obvious. Nesting is shallow overall, but the inner `on_update` callback adds slight cognitive overhead. Intent is reasonably clear—the class purpose and attribute behavior are documented with docstrings and comments. Code length is appropriately concise and avoids unnecessary verbosity. Action granularity is acceptable, though some lines combine multiple concepts (e.g., the import aliasing and the inner function definition). Reading flow improves from the explanatory comments but is disrupted by the inner callback definition appearing before `super().__init__`, making the initialization order feel slightly counterintuitive. The type hints and `from __future__ import annotations` are helpful for modern Python. Overall, the code is readable but would benefit from moving `on_update` to a module-level function or using a simpler approach like a lambda to reduce nesting and improve immediate clarity of the constructor.
Run 3
The code is generally readable but has several minor issues. The class structure is logical with clear docstrings. However, type hints use abbreviated aliases (c, t) reducing immediate clarity. The __init__ method defines a nested on_update function that references 'te.Self' which is not imported, indicating a bug. The 'modified' class attribute is set outside __init__ in a non-standard way. Import organization is somewhat scattered with mixing of 'from __future__' and standard library imports. The nesting is minimal, but the inner function adds slight complexity. Missing imports (SessionMixin, te) make the code incomplete. Overall, it's readable but could benefit from full import statements and fixing the undefined references.
Run 1
Code Structure: Imports, class documentation, state, and initialization are logically organized, though SessionMixin and te are undefined in the snippet. Nesting: Shallow; the single nested callback is appropriate. Clarity of intent: Documentation clearly explains modification tracking, but the abbreviated parameter ini and unexplained aliases reduce clarity. The docstring also mentions accessed tracking that is not shown. Code length: Implementation is concise, although documentation dominates and the short constructor signature is unnecessarily spread across lines. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from documentation to initialization, with minor friction from missing definitions and the callback parameter shadowing the outer self.
Run 2
Code Structure: Imports, class documentation, state, and initialization are logically organized. Nesting: Shallow; the nested callback is appropriate and easy to follow. Clarity of intent: Documentation clearly explains signed-cookie sessions and modification tracking, although the abbreviated parameter name 'ini' and undefined references to 'SessionMixin' and 'te' reduce self-contained clarity. Code length: The implementation is concise, but documentation is comparatively lengthy and several imports are unused in this snippet. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from session behavior to state initialization and callback registration, though additional blank lines between import groups and the class would improve visual separation.
Run 3
Code Structure: Imports, class documentation, state, and initialization are logically organized, though several imports are unused in this snippet. Nesting: Shallow; the nested callback is small and appropriate. Clarity of intent: The docstrings clearly explain session behavior and modification tracking, but the abbreviated parameter 'ini' and undefined references to 'te' and 'SessionMixin' reduce clarity in isolation. Code length: The implementation is concise, although documentation and imports outweigh the executable code. Action granularity: Each statement performs one action, making changes easy to follow. Reading flow: The progression from class purpose to state tracking and callback registration is natural; alias inconsistencies and missing definitions slightly interrupt it.