Sample

pyint-28236650840d-I05

Rewrite eligible decimal integer literals in hexadecimal notation

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 follows a simple, consistent structure where each method is short and performs a single logical action. Nesting is completely flat, with no conditional or loop complexity. The intent is clear: it implements a dummy cache backend that validates keys but doesn't actually store data. Each method is concise, with no unnecessary lines. Action granularity is appropriate—most methods perform one validation call and return a value. The reading flow is natural because methods are ordered logically (add, get, set, touch, delete, has_key, clear) and share a uniform pattern. Minor deductions: the unused 'host' parameter and redundant super().__init__ could be considered slightly ambiguous, and the repeated validation pattern, while clear, is somewhat repetitive. Overall, it is an easily understood and maintainable mock implementation.

Run 3

The code is well-structured and highly readable. Each method is short, focused, and follows a consistent pattern: validate the key, then either store nothing or return a constant. There is no deep nesting, and the flow is straightforward. Variable and method names are clear from Django’s cache API. The only minor drawbacks are the unused 'host' parameter in __init__, which slightly obscures intent, and the repeated make_and_validate_key calls, which could be centralized to reduce duplication. Overall, the code is clean and easy to follow.

Run 1

Code Structure: A single, logically organized class exposes familiar cache operations as separate methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and conventional method names clearly suggest a no-op cache; a short docstring would better explain the return values and intentionally unused parameters. Code length: The implementation is concise, with repeated validation appropriate to each operation. Action granularity: Each statement performs one action, keeping validation and returns distinct. Reading flow: Consistent signatures, spacing, and method bodies make the class easy to scan from initialization through cache operations.

Run 2

Code Structure: A single, well-organized class groups standard cache operations into distinct methods. Nesting: Methods are flat, with no conditional or loop nesting. Clarity of intent: DummyCache and conventional method names clearly suggest a no-op cache, though a brief docstring could explain the intentionally unused parameters and return values. Code length: Implementations are concise; repeated key validation is appropriate for the interface. Action granularity: Each line performs one action, making behavior easy to scan. Reading flow: Consistent signatures, spacing, and validation-first implementations provide a natural, predictable reading flow.

Run 3

Code Structure: A single, well-organized class groups standard cache operations into separate methods. Nesting: Methods are flat, with no nested control flow. Clarity of intent: DummyCache and familiar method names communicate a no-op cache implementation, though a brief docstring would clarify the intentional lack of storage and unused parameters. Code length: The implementation is concise; repeated key validation is appropriate for independently callable methods. Action granularity: Each line performs one clear action. Reading flow: Consistent signatures, spacing, and validation-before-return patterns make the class easy to scan and understand.