Sample

pyint-8e2175591b9a-I01

Remove comments and docstrings

Matched original source

Lines19

Scores

MethodScoreScale
Posnett0.0140–1; higher is more readable
Dorn0.6980–1; higher is more readable
Mi0.50–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.6870–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: 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.414.917−13.692
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.71−7.065

Intercept 8.87 + feature contributions = -4.287 (log-odds).
Score = sigmoid(-4.287) = 0.014.

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
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.039+0.559
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.20+0.328
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 = 0.836 (log-odds).
Score = sigmoid(0.836) = 0.698.

Score0.5
Score16
Run 1

The code shows reasonable import organization with standard library, third-party, and local imports grouped together. The class definition is clear with a single method. However, there are several readability issues: the blank line between the class declaration and method contains whitespace, which is inconsistent and unnecessary. The type hint uses PreparedRequest which isn't imported or defined in this snippet, creating ambiguity. The method has no docstring explaining the contract or purpose of the authentication hook. The NotImplementedError message is clear but minimal. Overall the code is relatively clean but incomplete context makes it harder to fully assess intent. The structure is logical for a base authentication class, but missing documentation and the stray whitespace reduce overall readability. Score reflects functional but not exemplary code organization and clarity.

Run 2

The code is generally readable with a clear structure: imports are organized, and the AuthBase class has a single, well-defined purpose. The use of type hints and future annotations improves clarity. However, there are minor issues: the class body begins with an unnecessary blank line, and the __call__ method raises NotImplementedError with a clear message but lacks a docstring explaining the expected behavior of auth hooks. Imports include several unused names (hashlib, os, re, threading, time, warnings, b64encode, cast, overload, extract_cookies_to_jar, parse_dict_header), which adds noise. The overall logic is flat and action granularity is appropriate, but the unused imports and missing documentation slightly reduce readability.

Run 3

The code is clean, well-structured, and follows standard Python conventions. It opens with future annotations and organizes imports logically: standard library first (hashlib, os, re, threading, time, warnings), then third-party/local imports. Type checking imports are properly guarded with TYPE_CHECKING, and typing features like Final, cast, overload, and Any are imported clearly. The AuthBase class has a single, focused responsibility with a clear docstring-like signature and a single method that raises NotImplementedError with a helpful message. Indentation and spacing are consistent, and the class structure is flat with no nesting. The intent is unambiguous: define an abstract callable for authentication hooks. There is slight unused-import concern (many imports unused in this snippet) and the method body is minimal, but the overall organization, clarity, and readability are strong. Minor deductions for the unused imports and lack of class-level docstring explaining purpose.

Run 1

Code Structure: Imports precede a clearly defined authentication base class, providing logical organization, though many imports are unused in this snippet. Nesting: Minimal, with only a class and method. Clarity of intent: AuthBase, __call__, and the explicit NotImplementedError clearly communicate a callable authentication interface; however, PreparedRequest is not defined or imported here. Code length: The implementation is concise, but unused imports and excessive blank space add clutter. Action granularity: Each statement occupies its own line. Reading flow: Straightforward from imports to class to method, although separating standard-library and relative imports would improve scanning.

Run 2

Code Structure: The base class and its single method are logically organized, but numerous unused imports clutter this snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: AuthBase, __call__, and the explicit NotImplementedError clearly establish a callable authentication interface, although the parameter name 'r' is vague and PreparedRequest is not defined or imported in the snippet. Code length: The implementation is concise, but the import block is disproportionately long. Action granularity: Each import and the exception statement occupy separate lines, avoiding bundled actions. Reading flow: The method reads naturally, but excessive blank space inside the class and the unrelated imports interrupt the otherwise straightforward flow.

Run 3

Code Structure: Imports precede a small, logically organized base class, though many imports are unused in this snippet. Nesting: Minimal, with only a class and method. Clarity of intent: AuthBase and the explicit NotImplementedError clearly establish an authentication-hook interface; the parameter name r is less descriptive, and PreparedRequest is not defined or imported in the snippet. Code length: The class is concise, but the large import block is disproportionate to its functionality. Action granularity: Each statement occupies its own line. Reading flow: Straightforward top-to-bottom flow, slightly weakened by excess blank lines and unused imports.