Sample

pyint-1ca001ba821f-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines19

Scores

MethodScoreScale
Posnett0.010–1; higher is more readable
Dorn0.8730–1; higher is more readable
Mi0.4970–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6880–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: 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.422.873−13.955
Source linesThe number of non-empty source lines.19+7.6
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.708−7.062

Intercept 8.87 + feature contributions = -4.547 (log-odds).
Score = sigmoid(-4.547) = 0.01.

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.7+0.925
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.035+0.6
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.20+0.328
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.18.894−0.146
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.19−0.015

Intercept 0.07 + feature contributions = 1.927 (log-odds).
Score = sigmoid(1.927) = 0.873.

Score0.497
Score17
Run 1

The code is highly readable. It begins with clear future import and standard imports, organized logically (standard library, then local modules). Constants like `Final` are properly imported. The `AuthBase` class has a clear docstring and a single, focused method with a descriptive parameter type hint and return type. Nesting is non-existent, action granularity is one action per line, and overall structure is flat. The only minor deduction is that some imported names (e.g., `overload`, `cast`, `Any`) are not used in the shown code, which slightly reduces clarity of intent for a reviewer seeing only this fragment.

Run 2

The code is well-structured and highly readable. It begins with a clear import section organized logically: standard library imports, third-party/type-related imports, and internal module imports. The use of `from __future__ import annotations` and type hints like `Final`, `cast`, and `overload` indicates modern, well-maintained code. The `AuthBase` class is minimal but clear in intent—it defines a base class for authentication implementations and explicitly raises `NotImplementedError` with a helpful message. Nesting is non-existent, and the code is concise without sacrificing clarity. Action granularity is appropriate: each import, class definition, and method occupies its own logical line. Reading flow is natural, moving from imports to class definition to method signature. Minor deductions: some imported names (`TYPE_CHECKING`, `Any`, `to_native_string`) are unused in the visible snippet, which could slightly reduce perceived clarity. Overall, the code is clean, purposeful, and easy to follow.

Run 3

The code is highly readable. It begins with a clean import section, with clear separation of standard library, third-party, and local modules. Type hints, `Final`, `cast`, and `overload` imports suggest attention to clarity and correctness. The `AuthBase` class is minimal and logical, with a clear docstring and a single purpose. The `__call__` method is short, explicit, and fulfills the class contract. Nesting is absent. Action granularity is one action per line. Naming follows Python conventions. Minor deductions: unused imports (e.g., `os`, `re`, `threading`, `warnings`) would add noise but do not affect readability for this snippet, and the use of a `PreparedRequest` type implies readability depends on context outside the snippet, but within the given code, the intent is unambiguous.

Run 1

Code Structure: Imports are grouped before a small, logically organized base class, although standard-library and local imports lack a separating blank line. Nesting: Minimal, with only a class and its method. Clarity of intent: The class name, docstring, type annotations, and explicit NotImplementedError clearly establish an authentication interface; the parameter name 'r' is less descriptive. Code length: The implementation is concise, but many imports are unused in the shown snippet, adding visual noise. Action granularity: Each import and the exception statement occupy separate lines. Reading flow: Natural top-to-bottom progression from dependencies to interface definition, with minor spacing improvements possible.

Run 2

Code Structure: Imports followed by a small base class provide logical organization, though many imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive class name, docstring, type annotations, and explicit NotImplementedError clearly establish an authentication interface. PreparedRequest is not defined or imported in the shown code, leaving some context unclear. Code length: The class is concise, but the extensive import list adds unnecessary length for the functionality shown. Action granularity: Each statement occupies its own line. Reading flow: The progression from imports to class documentation to the callable method is natural; additional spacing between import groups and before the class would improve readability.

Run 3

Code Structure: Imports followed by a small base class provide clear organization, though many imports are unused in this snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: The class name, docstring, type annotations, and explicit NotImplementedError clearly communicate the authentication hook contract; the parameter name 'r' is less descriptive. Code length: The implementation is concise, but the extensive imports add visual overhead relative to its size. Action granularity: Each statement occupies its own line. Reading flow: Straightforward from dependencies to interface definition, though separating import groups and adding standard blank lines before the class would improve scanning.