Sample
pyint-2de1eb339257-I07
Insert deterministic runtime-dead branches into callable bodies
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.553 | 0–1; higher is more readable |
| Mi | 0.561 | 0–1; higher is more readable |
| LLOC | 42 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs |
| BTTF | 0.405 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 2761.134 | −91.117 |
| Source linesThe number of non-empty source lines. | 102 | +40.8 |
| 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.675 | −7.012 |
Intercept 8.87 + feature contributions = -48.46 (log-odds).
Score = sigmoid(-48.46) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 98 | +2.653 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 103 | −2.611 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 98 | −1.828 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 101.886 | +1.014 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 87 | +0.599 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.062 | +0.335 |
| 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. | 86.99 | −0.019 |
Intercept 0.07 + feature contributions = 0.213 (log-odds).
Score = sigmoid(0.213) = 0.553.
| Score | 0.561 |
|---|
| Score | 42 |
|---|
Run 1
The code demonstrates solid readability with organized imports, clear class structure, and logical method grouping. It uses type hints extensively, which aids understanding. Nesting is minimal except for one list comprehension. The `if ((0xa84e ^ 0xa84e) != 0): raise AssertionError()` pattern is obfuscated dead code that hurts clarity—it evaluates to `False` always, suggesting obfuscation or automated insertion. Similarly, the second identical pattern in `deregister_hook` reduces readability. The variable name `_t.HookType` is clear, and docstrings explain purpose well. Action granularity is generally one action per line. The defensive runtime filter in list comprehension adds nesting but remains understandable. While the code is well-structured overall, these artificial assertion blocks are confusing and should be removed for production readability. The comprehensive import organization also aids navigation.
Run 2
The code has clear structure with logical imports and a simple class definition. Nesting is minimal (only in the iterable check). Intent is generally clear, especially with docstrings. However, it's overly long due to extensive imports and contains dead code (obfuscated assertions like `if ((0xa84e ^ 0xa84e) != 0): raise AssertionError()`) that hurt readability and clarity. Action granularity is acceptable, though the `extend` line mixes filtering and appending. Reading flow is natural for a class definition. The defensive runtime filter statement is a bit dense but understandable. Overall good structure but marred by unnecessary complexity and length.
Run 3
The code demonstrates moderate readability. The import section is well-organized with clear grouping (stdlib, third-party, local imports), making it easy to locate dependencies. The class structure is logical and the hook registration method has clear intent with docstrings. However, several issues reduce readability: the defensive runtime filtering in register_hook uses a generator expression nested within an extend call, making it harder to parse. The conditional assertions `if ((0xa84e ^ 0xa84e) != 0): raise AssertionError()` are obfuscated and serve no practical purpose, confusing readers. While the deregister_hook method is clean with clear error handling, the register_hook method's nesting and conditional logic feel unnecessarily complex. The method signatures are well-typed with clear parameter names, which helps maintainability. Overall, the code shows good organization but suffers from unclear defensive patterns and some unnecessary complexity in the hook registration logic.
Run 1
Code Structure: The mixin cleanly groups hook registration and deregistration, but the extensive imports obscure this small implementation. Nesting: Shallow conditionals and a simple try/except keep complexity low. Clarity of intent: Descriptive method names, type annotations, and docstrings explain the purpose; however, the always-false hexadecimal XOR checks are distracting and have no apparent purpose. Code length: The methods are concise, but redundant assertion blocks and many imports unused in the displayed snippet add unnecessary length. Action granularity: Statements generally perform one action per line, and the filtering generator remains understandable. Reading flow: Registration follows a natural validation-then-update sequence, while deregistration clearly expresses success and failure. Excessive import preamble and dead checks interrupt otherwise straightforward reading.
Run 2
Code Structure: Imports are grouped and hook operations are cleanly separated into methods, although the extensive imports distract from the small class. Nesting: Mostly shallow, with straightforward conditionals and exception handling. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain registration and removal; however, the always-false hexadecimal XOR checks introduce confusing dead code. Code length: The methods are reasonably concise, but redundant assertion branches and numerous imports unused in this excerpt add unnecessary bulk. Action granularity: Statements generally perform one action per line, and the filtering generator remains understandable. Reading flow: Each method follows a natural sequence, but unexplained dead-code checks interrupt that flow, and the lengthy import section delays reaching the relevant logic.
Run 3
Code Structure: Imports are grouped logically, and hook registration and deregistration are separated into focused methods, but the extensive imports obscure the small class. Nesting: Shallow conditional and exception-handling blocks keep complexity low. Clarity of intent: Descriptive method names, type annotations, and docstrings clearly communicate hook management; however, hexadecimal XOR checks that always evaluate to false introduce confusing dead code. Code length: The methods are concise, but unused imports in this snippet and redundant assertion guards add unnecessary length. Action granularity: Statements generally perform one action per line, and the generator expression is compact and understandable. Reading flow: The methods follow natural validation-and-update sequences, but the import-heavy opening and unexplained assertion guards interrupt the flow.