Sample

pyint-2643cf679ba3-SRC

Unmodified source class

Lines41

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8540–1; higher is more readable
Mi0.4840–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.5520–1; higher is more readable

Views

Source code

from __future__ import annotations from collections import OrderedDict from collections.abc import Iterable, Iterator, Mapping from typing import Any, Generic, TypeVar, overload from .compat import MutableMapping class LookupDict(dict[str, _VT]): """Dictionary lookup object.""" name: Any def __init__(self, name: Any = None) -> None: self.name = name super().__init__() def __repr__(self) -> str: return f"<lookup '{self.name}'>" def __getattr__(self, key: str) -> _VT | None: # We need this for type checkers to infer typing # on attribute access with status_codes.py if key in self.__dict__: return self.__dict__[key] else: raise AttributeError( f"'{type(self).__name__}' object has no attribute '{key}'" ) def __getitem__(self, key: str) -> _VT | None: # type: ignore[override] # We allow fall-through here, so values default to None return self.__dict__.get(key, None) @overload def get(self, key: str, default: None = None) -> _VT | None: ... @overload def get(self, key: str, default: _D | _VT) -> _D | _VT: ... def get(self, key: str, default: _D | None = None) -> _VT | _D | None: return self.__dict__.get(key, default)

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.1312.4−43.309
Source linesThe number of non-empty source lines.41+16.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.61−6.915

Intercept 8.87 + feature contributions = -24.954 (log-odds).
Score = sigmoid(-24.954) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.37+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.75.952+0.448
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74.286+0.394
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.39−0.345
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.40.805+0.161
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.087+0.099

Intercept 0.07 + feature contributions = 1.768 (log-odds).
Score = sigmoid(1.768) = 0.854.

Score0.484
Score25
Run 1

The code is generally readable and follows Python conventions well. It has good type hints, docstrings, and clear method separation. The class structure is logical with each method serving a distinct purpose. Nesting is minimal, and the reading flow is natural. However, there's a potential inconsistency: __getitem__ and get() use self.__dict__ rather than the dict's storage, which could be confusing. The __getattr__ method has an if-else that could be simplified to raise directly after the if. The overload decorators add complexity but are justified for type checking. Overall, the code is maintainable but could benefit from a comment explaining why __dict__ is used instead of the inherited dict storage, and the __getattr__ could be flattened slightly.

Run 2

The code is generally readable and well-structured. It has a clear class hierarchy, concise methods, and flat nesting. Type hints and overloads improve clarity, and docstrings/comments explain intent. Minor issues: using self.__dict__ directly instead of super().get() for dict lookups slightly obscures intent, and the __getattr__/__getitem__ logic could confuse readers unfamiliar with the fall-through behavior. Overall, it is concise, organized, and easy to follow.

Run 3

The code is generally clear and well-structured, with a concise class definition and good use of type hints. It has a logical layout: imports, class declaration, init, repr, attribute access, item access, then overloaded get methods. Nesting is minimal, and each method performs a single action, contributing to good action granularity. The reading flow is natural, and intent is fairly clear, especially with the explanatory comments for __getattr__ and __getitem__. However, the use of __getitem__ returning None as a fall-through might be ambiguous without context, and the overload definitions slightly increase length but improve clarity. The code is concise but could benefit from a docstring explaining the fall-through behavior more explicitly. Overall, it is highly readable with only minor clarity improvements needed.

Run 1

Code Structure: Methods are logically grouped within a small class, though unused imports and undefined type variables in the snippet distract. Nesting: Minimal nesting makes control flow easy to follow; the else after a return is unnecessary. Clarity of intent: Method names, annotations, and comments help, but using __dict__ rather than dictionary storage is surprising, and the class docstring does little to explain that behavior. Code length: Generally concise, although overloads and typing details add visual weight. Action granularity: Each statement performs one clear action. Reading flow: Initialization, representation, attribute access, and lookup methods follow a natural sequence, with consistent formatting and spacing.

Run 2

Code Structure: Imports and a single class with small, logically grouped methods provide clear organization, though _VT and _D are not defined in the snippet. Nesting: Control flow is shallow, with only one if/else branch. Clarity of intent: Type annotations and comments explain lookup behavior, but the generic docstring and use of __dict__ rather than dictionary entries make the interface somewhat surprising. Code length: Concise overall; the else after return and explicit None argument to get are mildly redundant. Action granularity: Statements generally perform one action per line; compact overload declarations remain understandable. Reading flow: Methods progress naturally from initialization and representation to lookup operations, although typing machinery and an extra blank line slightly interrupt the flow.

Run 3

Code Structure: Imports and a single class with short, focused methods provide clear organization, though _VT and _D are not defined in the excerpt and several imports are unused. Nesting: Minimal nesting makes control flow easy to follow; the else after return is unnecessary. Clarity of intent: Method names, annotations, and comments explain lookup behavior, but storing lookups in __dict__ rather than the inherited dictionary is surprising, and the class docstring is vague. Code length: Concise overall, with some annotation and overload verbosity that supports typing. Action granularity: Statements generally perform one action per line. Reading flow: Methods follow a natural progression from initialization and representation to lookup operations, although an extra blank line and unexplained type variables slightly interrupt comprehension.