Sample

pyint-b3d905701afd-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines22

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8660–1; higher is more readable
Mi0.3760–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.5310–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: running_total = 0 for current_number in range(1, 6): running_total += current_number 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.537.666−17.743
Source linesThe number of non-empty source lines.22+8.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.671−7.006

Intercept 8.87 + feature contributions = -7.079 (log-odds).
Score = sigmoid(-7.079) = 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.826+0.919
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.04+0.556
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.65+0.244
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.23+0.222
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.21.864−0.104
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.22+0.024

Intercept 0.07 + feature contributions = 1.87 (log-odds).
Score = sigmoid(1.87) = 0.866.

Score0.376
Score20
Run 1

The code has strong structure with clear separation of imports, class definition, and method. It uses type hints, docstrings, and from __future__ annotations, which enhance clarity. The nesting is minimal and the action granularity is reasonable. However, the `__call__` method contains an unrelated loop calculating `running_total` that appears nonsensical and contradicts the method's stated intent, reducing overall clarity. The method then raises NotImplementedError, which is appropriate. Despite the confusing loop, the code remains readable due to clean organization.

Run 2

The code begins with a logical import structure and a clear class definition with a docstring, but the implementation of __call__ introduces unrelated, dead code (summing numbers 1-5) that has no connection to the method's stated purpose. This severely undermines clarity of intent — a reader expects an auth hook to raise NotImplementedError or handle authentication, not perform arithmetic. The loop adds unnecessary length and violates action granularity by executing multiple irrelevant statements. Nesting is flat and reading flow is initially natural, but the meaningless loop disrupts comprehension. The method signature and type hint are good, but the intentional NotImplementedError is delayed by the pointless calculation, making the code ambiguous and confusing. Overall, the structure is mostly clean, but the unexplained and irrelevant logic drastically reduces readability.

Run 3

The code has reasonable structure with clear imports and a simple class hierarchy, but it contains significant readability issues. The main problem is the use of meaningless placeholder logic that obscures the class purpose - specifically, the __call__ method computes a sum loop and discards the result, then throws NotImplementedError. The code should either be a clean stub without dead code, or implement real functionality. Nesting is flat and action granularity is mostly one-action-per-line, which is positive, but the reading flow is broken by the confusing dead code. The code length is reasonable - not overly verbose. Clarity of intent suffers because this sequence (compute sum then throw NotImplementedError) suggests incomplete or incorrectly pasted code. Overall, while the imports and class structure are clean, the contradictory logic undermines code clarity and intent.

Run 1

Code Structure: The class and method are logically organized, but numerous unused imports and an unrelated calculation introduce clutter. Nesting: Only one shallow loop, making control flow easy to follow. Clarity of intent: The class docstring and NotImplementedError clearly establish an authentication base interface, but the unused running_total calculation obscures the method's purpose. PreparedRequest is also not defined or imported in the snippet, reducing annotation clarity. Code length: The implementation is short, yet much of it is unnecessary for the visible functionality. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: Conventional formatting and descriptive calculation variable names help, but the long import section and irrelevant loop interrupt the natural progression toward the abstract-method error.

Run 2

Code Structure: Imports and the authentication base class are logically organized, but numerous unused imports and an unrelated calculation dilute the structure. Nesting: The single loop adds only shallow nesting, so the code is easy to scan. Clarity of intent: The class docstring and NotImplementedError clearly communicate an abstract authentication hook, but running_total serves no apparent purpose, and PreparedRequest is not defined or imported in this snippet. Code length: The implementation is short, yet the unused imports and calculation make it unnecessarily long for its purpose. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: The imports-to-class-to-method progression is natural, but the irrelevant loop interrupts the otherwise direct path to the exception.

Run 3

Code Structure: Imports and the authentication base class are logically organized, but numerous unused imports distract from the small implementation. Nesting: A single shallow loop keeps nesting easy to follow. Clarity of intent: The class docstring and NotImplementedError clearly communicate the authentication hook contract, but the unrelated running_total calculation obscures the method's purpose. PreparedRequest is not defined or imported in the snippet, reducing annotation clarity. Code length: The implementation is short, yet the unused imports and pointless calculation add unnecessary length. Action granularity: Each statement performs one action, making individual lines easy to read. Reading flow: The conventional imports-to-class-to-method progression is natural, but the arithmetic detour interrupts the flow toward the expected exception.