Sample

pyint-0f0c26d97474-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines21

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8560–1; higher is more readable
Mi0.4420–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.3590–1; higher is more readable

Views

Source code

from __future__ import annotations import hashlib import os import re import threading import time import warnings from base64 import b64encode from typing import TYPE_CHECKING, Any, Final, cast, overload from ._internal_utils import to_native_string from .compat import basestring, str, urlparse from .cookies import extract_cookies_to_jar from .utils import parse_dict_header class AuthBase: """Base class that all auth implementations derive from""" def __call__(self, r: PreparedRequest) -> PreparedRequest: if ((0x67b ^ 0x67b) != 0): raise AssertionError() raise NotImplementedError("Auth hooks must be callable.")

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.521.863−17.221
Source linesThe number of non-empty source lines.21+8.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.75−7.125

Intercept 8.87 + feature contributions = -7.077 (log-odds).
Score = sigmoid(-7.077) = 0.001.

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.64.818+0.92
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.047+0.484
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.65+0.244
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.20.864−0.118
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.21−0.061
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 1.786 (log-odds).
Score = sigmoid(1.786) = 0.856.

Score0.442
Score19
Run 1

The code is generally readable, with clear imports, a well-documented class, and obvious intent. However, it contains a nonsensical conditional expression `((0x67b ^ 0x67b) != 0)` that always evaluates to false, followed by an unreachable `AssertionError`. This obfuscates the primary purpose and disrupts the reading flow. The overall structure is logical but the method includes unnecessary dead code and a double indentation level for a simple NotImplementedError, which adds noise. Action granularity is mostly fine, but clarity of intent suffers due to the redundant condition. The concise class could be improved by removing the dead conditional block and keeping only the raise statement.

Run 2

The code has a clear module structure with logical imports and a well-defined base class, but the readability is significantly undermined by an extraneous assert statement that has no purpose. The action granularity is poor: it compresses a pointless bitwise comparison, a conditional raise, and a NotImplementedError into a single method. The intent is ambiguous because it's unclear why the assert exists or what it is supposed to guard. Nesting is shallow, which is good, but the flow is disorganized due to that dead-code assert. Code length is concise, but not in a way that aids understanding. The cryptic comparison '((0x67b ^ 0x67b) != 0)' does not communicate any meaningful condition and looks like obfuscation or a placeholder. The method signature and docstring are clear, but they are undercut by the body. A cleaner version would simply raise NotImplementedError directly.

Run 3

The code demonstrates excellent organization with clear imports, a well-defined class hierarchy, and a single-purpose base class. The nesting is minimal. The clarity of intent is strong—AuthBase clearly defines an abstract hook via __call__, with NotImplementedError communicating necessary subclassing. The length is concise; only essential imports and code are included. Each action is distinct (imports, class definition, method). The reading flow is natural, moving from imports to the class definition. However, the presence of a spurious dead-code check ((0x67b ^ 0x67b) != 0) that raises AssertionError is confusing and harms readability. It appears to be an artifact or obfuscation rather than meaningful logic, reducing clarity and introducing unnecessary conditionals. Without that, the code would be exemplary; with it, some intent is obscured.

Run 1

Code Structure: The base class and single method are logically organized, but numerous unused imports distract from the small implementation. Nesting: The method is mostly flat, with only one shallow conditional. Clarity of intent: The class name, docstring, and NotImplementedError clearly convey an authentication interface; however, the XOR condition is always false and adds confusing dead code. PreparedRequest is not imported or defined in the snippet, reducing annotation clarity. Code length: The core implementation is concise, but the imports and unreachable assertion are unnecessary here. Action granularity: Each statement performs one action, making individual lines easy to parse. Reading flow: The progression from imports to class to method is conventional, but the irrelevant conditional interrupts the otherwise straightforward flow.

Run 2

Code Structure: Imports and the authentication base class are logically organized, but many imports are unused in this snippet. Nesting: The method is shallow, with only one conditional. Clarity of intent: The class name, docstring, method signature, and NotImplementedError clearly indicate an abstract authentication hook; however, the opaque XOR condition is always false and introduces distracting dead code. PreparedRequest is not defined or imported in the snippet, reducing annotation clarity. Code length: The class is concise, but the unused imports and redundant assertion branch add unnecessary length. Action granularity: Each line generally performs a single action. Reading flow: The conventional progression from imports to class to method is natural, but the meaningless conditional interrupts the otherwise straightforward method.

Run 3

Code Structure: The imports and small base class are logically organized, but numerous unused imports clutter the snippet. Nesting: The method is shallow, with only one conditional. Clarity of intent: The class docstring and NotImplementedError clearly establish an authentication interface, but the opaque XOR condition is always false and introduces confusing dead code. PreparedRequest is not imported or defined in the snippet, reducing annotation clarity. Code length: The core implementation is concise, yet the redundant conditional and unused imports unnecessarily lengthen it. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The progression from imports to class to method is natural, but excessive parentheses and the irrelevant assertion interrupt an otherwise straightforward implementation.