Sample

pyint-1e5312c6af50-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines28

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6210–1; higher is more readable
Mi0.4660–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol180–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.28+11.2
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.691−7.036

Intercept 8.87 + feature contributions = -25.701 (log-odds).
Score = sigmoid(-25.701) = 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.862+0.706
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.106−0.091
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.28+0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.27.408−0.027

Intercept 0.07 + feature contributions = 0.494 (log-odds).
Score = sigmoid(0.494) = 0.621.

Score0.466
Score23
Run 1

The code is generally readable and follows a simple pattern, but has several stylistic issues. Each method is short and clear in intent, which helps readability. The nesting is flat, and actions are mostly one per line. However, the lack of blank lines between methods (e.g., between 'add' and 'get', 'delete' and 'has_key') disrupts the reading flow and makes the code feel visually cramped. The unused parameters (value, timeout, key) are accepted but ignored, which is acceptable for a dummy cache but could be slightly confusing. The overall structure is logical, and the class name makes its purpose clear. Minor improvements in spacing and method separation would improve readability.

Run 2

The code is generally readable but has several inconsistencies. Structure is mostly logical, with clear class inheritance from BaseCache. Nesting is flat and actions are granular, with one action per line. However, clarity of intent is mixed: methods like add() returning True while delete() returns False without explanation may confuse readers. The main readability issue is inconsistent blank lines between methods, which disrupts natural reading flow. Some methods (set, clear) lack explicit return values, relying on implicit None, while others explicitly return booleans, creating ambiguity about expected behavior. The unused host parameter is also confusing. Code length is appropriately concise. Overall, the code is understandable but would benefit from consistent formatting, clear return value conventions, and documentation explaining the dummy cache's intentional behavior.

Run 3

The code is generally readable and concise. It has a logical class structure, low nesting, and clear intent: it implements a dummy cache backend. Actions are mostly one per line, and method names are standard and self-explanatory. However, readability is slightly reduced by inconsistent spacing between method definitions (some have blank lines, others do not). The __init__ method is unnecessary and adds noise. A few methods (set, clear) lack explicit return values, which could be clearer, though not strictly required. Overall, the code is easy to follow but would benefit from consistent formatting and removal of redundant elements.

Run 1

Code Structure: Methods are logically grouped within a single cache class, though inconsistent blank lines slightly weaken separation. Nesting: All methods are flat and easy to scan. Clarity of intent: DummyCache and conventional method names communicate a no-op cache implementation; unused parameters and differing return values could benefit from brief documentation. Code length: Concise, with repetitive key validation appropriate to the interface. Action granularity: Each line performs one clear action. Reading flow: The progression through standard cache operations is natural, with only minor formatting inconsistencies interrupting readability.

Run 2

Code Structure: A single, focused class organizes cache operations into small methods, though inconsistent blank lines weaken separation. Nesting: Flat method bodies with no nested control flow are easy to follow. Clarity of intent: DummyCache and conventional method names communicate a no-op cache implementation; a brief docstring could clarify its key validation and return behavior. Code length: Concise, with repeated validation calls serving a consistent purpose. Action granularity: Each line performs one clear action. Reading flow: The constructor followed by standard cache operations provides a natural progression, slightly disrupted by uneven method spacing.

Run 3

Code Structure: Methods are logically organized within a small cache backend class, though inconsistent blank lines slightly weaken separation. Nesting: Entirely flat method bodies make the code easy to scan. Clarity of intent: DummyCache and conventional cache method names convey a no-op implementation, although a brief docstring would clarify its behavior and unused parameters. Code length: Concise, with repeated key validation appropriate for separate interface methods. Action granularity: Each line performs a single clear action. Reading flow: Predictable signatures and consistent validation-first behavior support natural reading, with minor interruptions from uneven spacing.