Sample
pyint-311398a83e10-I07
Insert deterministic runtime-dead branches into callable bodies
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.43 | 0–1; higher is more readable |
| Mi | 0.451 | 0–1; higher is more readable |
| LLOC | 19 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 15 | 0–20; mean of three runs |
| BTTF | 0.37 | 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. | 1018.168 | −33.6 |
| Source linesThe number of non-empty source lines. | 26 | +10.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.619 | −6.928 |
Intercept 8.87 + feature contributions = -21.258 (log-odds).
Score = sigmoid(-21.258) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.064 | +0.323 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 26 | −0.176 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 26 | +0.162 |
| 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. | 83.963 | +0.109 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 27 | +0.08 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 25.929 | −0.047 |
Intercept 0.07 + feature contributions = -0.283 (log-odds).
Score = sigmoid(-0.283) = 0.43.
| Score | 0.451 |
|---|
| Score | 19 |
|---|
Run 1
The code is generally well-structured and readable. It has a logical import order, clear class and method naming, and a single method with a straightforward purpose. The nesting level is minimal; the only nesting is inside the return statement, which uses keyword arguments for clarity. The use of `ContentType.objects.db_manager(self.db).get_by_natural_key(...)` is slightly long but readable. However, the code includes an obfuscated, meaningless conditional check (`if ((0x423b ^ 0x423b) != 0): raise AssertionError()`), which severely harms clarity of intent and appears to be dead code or a bad attempt at obfuscation. This directly contradicts the criteria of clear purpose and natural reading flow. Excluding that line, the code would score much higher. Code length is good, and action granularity is appropriate, with one logical action per line.
Run 2
The code is short but has severe readability issues. The import block is excessively long for what the code actually uses, suggesting copy-paste from a larger module. The method `get_by_natural_key` is simple, but the presence of dead code (`if ((0x423b ^ 0x423b) != 0): raise AssertionError()`) is confusing and misleading. The method call chain for `ContentType.objects.db_manager(self.db).get_by_natural_key` is acceptable but adds complexity. Overall, the code lacks clarity of intent due to unused imports and obfuscated dead code, making it hard to read despite its brevity.
Run 3
The code has a clear import structure and a simple class definition, which aids readability. However, the `get_by_natural_key` method includes a nonsensical line `if ((0x423b ^ 0x423b) != 0): raise AssertionError()` that is confusing and breaks the logical flow. The method itself is short and mostly clear, but the return statement is nested and could be flattened by assigning the `content_type` lookup to a variable first. The class-level `use_in_migrations = True` is straightforward. Action granularity is mostly one action per line except for the chained `ContentType.objects.db_manager(self.db).get_by_natural_key()` call. Overall, the code is readable except for the suspicious assertion line, which lowers the score significantly.
Run 1
1. Code Structure: Imports and the manager class are logically organized, although many imports are unused in this snippet. 2. Nesting: Shallow overall; the nested lookup in the return statement is manageable. 3. Clarity of intent: Descriptive names clearly communicate permission lookup by natural key, but the hexadecimal XOR condition is always false and introduces confusing dead code. 4. Code length: The method is concise, but the unnecessary assertion branch and unused imports add clutter. 5. Action granularity: Statements are separated appropriately, with readable multiline arguments; the nested lookup combines related operations without excessive complexity. 6. Reading flow: The lookup reads naturally, but the unexplained condition interrupts the flow.
Run 2
Code Structure: The manager class and method are logically organized, but numerous unused imports add clutter. Nesting: Shallow overall; the nested query is manageable, while the conditional introduces needless nesting. Clarity of intent: The natural-key lookup is clear from naming and keyword arguments, but the hexadecimal XOR condition is obscure and always false, making its assertion dead code. Code length: The lookup is concise, but irrelevant imports and the redundant conditional unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action each, and the multiline return neatly separates arguments. Reading flow: Conventional Django structure and formatting support natural reading, but the unexplained assertion interrupts the straightforward lookup.
Run 3
Code Structure: Imports and the manager class are logically organized, although many imports are unused in this snippet. Nesting: Shallow control flow; the nested lookup in the return expression remains manageable. Clarity of intent: Descriptive method and parameter names make the natural-key lookup clear, but the always-false hexadecimal XOR condition and unreachable assertion obscure intent. Code length: The method is concise, though the dead conditional and unused imports add unnecessary bulk. Action granularity: Most lines represent a single action, with sensible multiline formatting for the nested query. Reading flow: The lookup reads naturally, but the unexplained assertion branch interrupts the progression from method entry to return.