Sample

Dorn/python/51

Human rating uses the original dataset scale.

DatasetDorn
Human3.65
Lines10

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.0130–1; higher is more readable
68.5Δ 5.0
Scalabrino0.6190–1; higher is more readable
62.4Δ 11.1
Dorn0.7150–1; higher is more readable
67.1Δ 6.4
Mi0.6280–1; higher is more readable
67.7Δ 5.8
LLOC8Logical lines; fewer is more readable
63.9Δ 9.6
DeepSeek V4 Pro130–20; mean of three runs
59.3Δ 14.2
GPT-6.1 Sol160–20; mean of three runs
66.0Δ 7.5
BTTF0.5170–1; higher is more readable
49.3Δ 24.2
Human3.651–5; original rating
73.5

Views

Source code

if hasattr(self, handler): getattr(self, handler)(name) def CharacterDataHandler(self, data): handler = self.elements[-1] + '_data' if hasattr(self, handler): getattr(self, handler)(data) def character_start(self, name, attributes): self.charid = attributes['id']

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.333.731−11.013
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.105−6.158
Source linesThe number of non-empty source lines.10+4

Intercept 8.87 + feature contributions = -4.301 (log-odds).
Score = sigmoid(-4.301) = 0.013.

Score0.619

Feature contributions

FeatureValueContribution
(log-odds)
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.48+1.632
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.9+0.718
Indentation frequencyHow rapidly indentation changes from line to line.9−0.426
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.9.265−0.28
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.10+0.191
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.116−0.182

Intercept 0.07 + feature contributions = 0.919 (log-odds).
Score = sigmoid(0.919) = 0.715.

Score0.628
Score8
Run 1

The code lacks context, making it hard to understand its purpose. The structure is tangled due to fragmented methods and reliance on dynamic handler lookup via `hasattr` and `getattr`, which obscures intent. Nesting is low, but clarity suffers because method names (`CharacterDataHandler`, `character_start`) seem inconsistent and the relationship between elements like `self.elements` and `self.charid` is unclear. Code length is concise, but unnecessary indirection (dynamic dispatch) makes it harder to follow. Action granularity is fine—one action per line—but the reading flow is disorganized: the first block appears truncated, and the snippet lacks surrounding class context or initialization of key attributes (`self.elements`, `self.charid`), forcing the reader to guess. Overall, the code is readable only at the surface syntax level, while the semantic flow is confusing.

Run 2

The code is highly readable. It uses clear, descriptive names for methods and variables (CharacterDataHandler, character_start, handler). The structure is logical, with each method handling a specific part of event processing. Nesting is minimal—only one level of indentation within each conditional. The intent is straightforward: dispatch to a dynamically-named handler if it exists. The code is concise; there is no unnecessary verbosity. Each line performs a distinct action (checking attribute, fetching handler, calling it). The reading flow is natural, moving from condition to dispatch or from input to assignment. Minor deductions: reliance on hasattr/getattr makes the dispatch pattern slightly implicit, and the snippet begins mid-block, but within the given excerpt, clarity is excellent.

Run 3

The code is relatively readable but has several issues. Structure is logical with repetitive patterns, but the repeated 'hasattr/getattr' blocks indicate inconsistent indentation and possible missing context. Nesting is flat, which is good. Intent is mostly clear—dispatching events to handlers—but the method signatures feel incomplete. Code length is concise. Each block performs one main action, though the getattr call is slightly dense. Reading flow is natural but disrupted by the apparent missing method definition before the first block. The main problems are the inconsistent structure, lack of error handling for missing attributes, and the ambiguous self.elements context. Overall, it's understandable but not polished.

Run 1

Code Structure: The methods are logically separated by event type, though the opening fragment lacks context. Nesting: A single conditional level keeps the code easy to follow. Clarity of intent: Dynamic handler dispatch is recognizable, but handler naming conventions and the relationship between elements and callbacks are implicit; mixed method naming styles reduce consistency. Code length: The snippet is concise without unnecessary statements. Action granularity: Each line performs one primary action, although getattr followed by invocation combines lookup and execution clearly. Reading flow: Straightforward within each method, but the incomplete opening block and unexplained state such as self.elements and self.charid slightly interrupt comprehension.

Run 2

Code Structure: Handler methods are logically separated, though the opening lines are an incomplete fragment. Nesting: Shallow conditionals make the code easy to scan. Clarity of intent: Event dispatch and character ID assignment are understandable, but dynamically constructed handler names, unexplained element state, and inconsistent method naming reduce clarity. Code length: Concise, with little unnecessary code. Action granularity: Each line performs a focused operation; the combined lookup and invocation is still readable. Reading flow: Straightforward within each method, but the truncated beginning and implicit naming conventions interrupt the overall flow.

Run 3

Code Structure: Small, logically separated handler methods, though the opening fragment lacks its enclosing method. Nesting: Shallow conditionals keep complexity low. Clarity of intent: Event dispatch and character ID assignment are understandable, but dynamically constructed handler names and reliance on self.elements require surrounding context. Code length: Concise with no obvious unnecessary code. Action granularity: Each line performs one primary action; the getattr invocation is compact and idiomatic. Reading flow: Straightforward within each method, but the truncated opening and inconsistent method naming styles slightly interrupt readability.