Sample

pyint-e7d0884686e7-I12

Inline all eligible single-use intermediate local variables

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 Pro16.670–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 clear, logical structure with a simple class inheriting from BaseCache and implementing the expected interface. Nesting is minimal and flat. Each method has a clear intent, mimicking real cache operations while validating keys. Code length is concise; methods are not unnecessarily long. Action granularity is good, with one significant action per line (validation, return). Reading flow is natural and predictable, following the standard cache API method order. Minor deductions: the unused `host` parameter, `key`, `value`, and `timeout` parameters in some methods could be slightly confusing, and `clear` is empty, but these are appropriate for a dummy cache implementation.

Run 3

The code is highly readable. It follows a consistent structure, with each method performing a single, clear action — validating the key and returning a dummy result. Nesting is non-existent, and the intent of each method is unambiguous. The naming is descriptive and follows Django conventions. The use of method parameters aligns with the base class, making the implementation easy to follow. The only minor drawback is the redundant __init__ method, which simply calls super with the same arguments and could be omitted without affecting clarity. Overall, the code is concise, flat, and easy to scan.

Run 1

Code Structure: The class is logically organized into small, clearly separated cache-interface methods. Nesting: There is no nested control flow, making each method easy to follow. Clarity of intent: DummyCache and conventional method names communicate a no-op cache implementation, although a brief docstring could clarify the intentional return values and unused parameters. Code length: The implementation is concise; repeated key validation is straightforward and appropriate for independent methods. Action granularity: Each line performs a single action. Reading flow: Consistent signatures and the repeated validate-then-return pattern provide a natural, predictable reading experience.

Run 2

Code Structure: A single, clearly organized class groups related cache operations into small methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and familiar cache-method names communicate a no-op implementation, though a short docstring could clarify the deliberately unused parameters and return values. Code length: Concise throughout; repeated key validation is appropriate for the interface. Action granularity: Each line performs one action, keeping behavior easy to inspect. Reading flow: Consistent signatures and validation-first method bodies create a predictable, natural flow.

Run 3

Code Structure: A single class groups related cache operations into clearly separated methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and conventional method names convey a no-op cache implementation, though a brief docstring would clarify the deliberately 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 straightforward action. Reading flow: Consistent signatures and method bodies make the code easy to scan, moving naturally from initialization through cache operations to clearing.