Sample

pyint-c107eb707b14-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6230–1; higher is more readable
Mi0.4670–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6410–1; higher is more readable

Views

Source code

from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache class DummyCache(BaseCache): def __init__(self, host, *args, **kwargs): super().__init__(*args, **kwargs) def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): self.make_and_validate_key(key, version=version) return True def get(self, key, default=None, version=None): self.make_and_validate_key(key, version=version) return default def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): self.make_and_validate_key(key, version=version) def touch(self, key, timeout=DEFAULT_TIMEOUT, version=None): self.make_and_validate_key(key, version=version) return False def delete(self, key, version=None): self.make_and_validate_key(key, version=version) return False def has_key(self, key, version=None): self.make_and_validate_key(key, version=version) return False def clear(self): pass

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.1173.778−38.735
Source linesThe number of non-empty source lines.31+12.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.692−7.038

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.906+0.704
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.26+0.116
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.106−0.091
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.563+0.017

Intercept 0.07 + feature contributions = 0.503 (log-odds).
Score = sigmoid(0.503) = 0.623.

Score0.467
Score23
Run 1

The code is simple and easy to understand. The class follows a clear structure: constructor and cache methods aligned with the base interface. Nesting is flat, with no conditionals or loops. Each method has a clear purpose, and action granularity is good—one action per line. The repeated validation call is concise but could be considered redundant; a helper or comment might clarify intent. Method names match the standard cache API, which improves reading flow for familiar Django developers. The constructor is minimal but currently ignores the 'host' parameter, which is slightly ambiguous. Overall, the code is clean and readable, though not self-documenting regarding the dummy behavior.

Run 2

The code is highly readable. It has a flat, logical structure with one public method per cache operation, consistent signatures, and minimal nesting. Each method’s intent is clear: it validates the key (via make_and_validate_key) and returns an appropriate dummy value. The implementation is concise, avoiding unnecessary logic or repeated validation code. Action granularity is excellent—each statement is on its own line. Reading flow is natural: class definition, then methods in a logical order matching common cache APIs. Minor deductions: the __init__ method is redundant since it only calls super(), and some methods omit an explicit return, relying on Python’s implicit None. Overall, the code is very easy to follow and maintain.

Run 3

The code is highly readable. It follows a clear, logical structure with one method per cache operation, flat nesting, and concise implementations. Each method validates its key and then performs a single, predictable action—no ambiguous logic or unnecessary complexity. The code length is minimal and appropriate for a dummy cache backend. Action granularity is well-maintained, with each method doing exactly one thing per line. Reading flow is natural: method names match standard cache semantics, and the class’s purpose is immediately clear. Minor deductions: repeated make_and_validate_key calls could be factored, and a few methods return hardcoded booleans without explanation, but this is acceptable for dummy behavior.

Run 1

Code Structure: A single, logically organized class groups standard cache operations into distinct methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and conventional method names communicate a no-op cache implementation, though a short docstring could clarify its validation-only behavior and differing return values. Code length: The implementation is concise; repeated key validation is straightforward and appropriate for separate interface methods. Action granularity: Each line performs one action. Reading flow: Consistent signatures, spacing, and method bodies make the code easy to scan. Unused parameters reflect the cache interface but slightly obscure intent without explanatory documentation.

Run 2

Code Structure: A single, well-organized class groups standard cache operations into distinct methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and familiar method names clearly suggest a no-op cache, though a short docstring could explain the unused parameters and return behavior. Code length: The implementation is concise; repeated key validation is appropriate for independent interface methods. Action granularity: Each line performs one action, keeping validation and returns separate. Reading flow: Consistent signatures, formatting, and method bodies make the code easy to scan and understand.

Run 3

Code Structure: A single, logically organized class separates cache operations into small methods. Nesting: The code is flat, with no nested conditionals or loops. Clarity of intent: DummyCache and standard cache method names clearly suggest a no-op cache; a brief docstring could clarify the intentional lack of storage and unused parameters. Code length: Concise implementations avoid unnecessary logic, and repeated key validation is straightforward. Action granularity: Each line performs one action. Reading flow: Consistent signatures, spacing, and validation-first method bodies make the code easy to scan and understand.