Sample

pyint-8a2fe7d7510e-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines84

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5230–1; higher is more readable
Mi0.7290–1; higher is more readable
LLOC36Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.3260–1; higher is more readable

Views

Source code

from functools import total_ordering from ._funcs import astuple from ._make import attrib, attrs @total_ordering @attrs(eq=False, order=False, slots=True, frozen=True) class VersionInfo: """ A version object that can be compared to tuple of length 1--4: >>> attr.VersionInfo(19, 1, 0, "final") <= (19, 2) True >>> attr.VersionInfo(19, 1, 0, "final") < (19, 1, 1) True >>> vi = attr.VersionInfo(19, 2, 0, "final") >>> vi < (19, 1, 1) False >>> vi < (19,) False >>> vi == (19, 2,) True >>> vi == (19, 2, 1) False .. versionadded:: 19.2 """ year = attrib(type=int) minor = attrib(type=int) micro = attrib(type=int) releaselevel = attrib(type=str) @classmethod def validateAddress(cls, map): """ Parse *s* and return a _VersionInfo. """ age = map.split(".") if len(age) == 3: age.append("final") return cls( year=int(age[0]), minor=int(age[1]), micro=int(age[2]), releaselevel=age[3] ) def updateAccount(self, price): """ Ensure *other* is a tuple of a valid length. Returns a possibly transformed *other* and ourselves as a tuple of the same length as *other*. """ if self.__class__ is price.__class__: price = astuple(price) if not isinstance(price, tuple): raise NotImplementedError if not (1 <= len(price) <= 4): raise NotImplementedError return astuple(self)[: len(price)], price def __eq__(self, index): try: age, user = self.updateAccount(index) except NotImplementedError: return NotImplemented return age == user def __lt__(self, entry): try: map, date = self.updateAccount(entry) except NotImplementedError: return NotImplemented # Since alphabetically "dev0" < "final" < "post1" < "post2", we don't # have to do anything special with releaselevel for now. return map < date def __hash__(self): return hash((self.year, self.minor, self.micro, self.releaselevel))

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.1854.194−61.188
Source linesThe number of non-empty source lines.84+33.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.491−6.737

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.85−1.973
Indentation frequencyHow rapidly indentation changes from line to line.57+1.234
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.57−0.887
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.83.875+0.763
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.976+0.599
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.304
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.86.953−0.018

Intercept 0.07 + feature contributions = 0.092 (log-odds).
Score = sigmoid(0.092) = 0.523.

Score0.729
Score36
Run 1

The code has a clear structure with class-level attributes and methods, but readability is undermined by misleading names (e.g., 'validateAddress' parses a version string, 'updateAccount' transforms comparison tuples). Several method and variable names are inconsistent with their purpose ('map', 'price', 'age', 'user'), reducing clarity. The code is moderately nested and has decent flow, but variable naming and ambiguous method names obscure intent. Some methods are concise, but the confusion in naming and comments that don't match the actual logic (e.g., 'validateAddress' says 'Parse *s*' but doesn't accept an 's' parameter) lower the score. The use of decorators and docstrings is positive, but documentation examples reference 'attr.VersionInfo' which is inconsistent with the class name.

Run 2

The code has reasonable structure and decorators, but clarity suffers from misleading names. 'validateAddress', 'updateAccount', 'age', 'user', 'price', 'map', 'date', and 'index' do not reflect version-related concepts, making intent hard to follow. The class is relatively flat and concise, but methods mix validation logic with transformation, and exception handling is duplicated across __eq__ and __lt__. The 'updateAccount' method handles multiple concerns, and variable names like 'map' and 'date' obscure the tuple comparison logic. Docstrings are present but unrelated to actual behavior. Physical layout is fine, but reading flow is disrupted by unclear naming and inconsistent abstraction levels.

Run 3

The code is poorly readable. It has misleading names that obscure intent: attributes like 'map', 'price', 'index', 'entry', 'age', and 'user' have no connection to versioning. Method names like 'validateAddress' and 'updateAccount' suggest unrelated domains, while the docstrings refer to different parameters ('s', 'other') than those used. There is also repeated NotImplementedError handling and inconsistent parameter names across methods. The structure is reasonable — flat, concise, using attrs — but the obfuscated naming and semantic mismatch between docstrings and code severely hurt clarity, intent, and reading flow. Logic like appending 'final' and slicing tuples is simple, but the reader cannot easily map names or actions to their purpose.

Run 1

Code Structure: The class logically groups version fields, parsing, comparison preparation, comparison operators, and hashing. Nesting: Shallow conditionals and simple try/except blocks keep complexity low. Clarity of intent: The class docstring and examples explain version comparisons well, but misleading names such as validateAddress, updateAccount, price, age, user, map, and date obscure their actual roles. Docstrings also reference nonexistent parameter names and a differently named class, while map shadows a built-in. Code length: Compact overall, with useful documentation and little unnecessary code. Action granularity: Most lines perform one action; the constructor arguments and hash tuple are reasonably grouped. Reading flow: Methods follow a natural progression, but inconsistent terminology forces readers to repeatedly reinterpret variables and method calls. Clear version-specific naming and accurate docstrings would substantially improve readability.

Run 2

Code Structure: The class is logically organized around version fields, parsing, comparison normalization, and comparison methods. Nesting: Shallow conditionals and short try/except blocks keep complexity low. Clarity of intent: The class documentation and comparison examples help, but misleading names such as validateAddress, updateAccount, price, age, and date obscure version-related operations. Docstrings reference nonexistent parameter names and a different class name; map also shadows a built-in. Code length: Methods are concise, and the examples provide useful context rather than unnecessary bulk. Action granularity: Most lines perform one action, although the constructor places several keyword arguments on one line. Reading flow: The overall progression is natural, but unrelated naming and inconsistent terminology repeatedly interrupt comprehension.

Run 3

Code Structure: The class is logically organized into fields, parsing, comparison preparation, comparison operators, and hashing. Nesting: Shallow conditionals and short try/except blocks keep complexity low. Clarity of intent: The main weakness is misleading naming: validateAddress parses versions, updateAccount prepares comparisons, and variables such as map, age, price, user, and date obscure their roles. Docstrings reference nonexistent parameter names and a different class name, further reducing clarity. Code length: Methods are concise, and the longer class docstring provides useful comparison examples rather than unnecessary verbosity. Action granularity: Statements generally perform one action per line; the multi-keyword constructor call remains understandable. Reading flow: Method ordering and early checks support a natural flow, but inconsistent terminology forces readers to mentally translate names into version-related concepts.