Sample

pyint-3a2cbb943e96-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines19

Scores

MethodScoreScale
Posnett0.010–1; higher is more readable
Dorn0.8730–1; higher is more readable
Mi0.5240–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol17.330–20; mean of three runs
BTTF0.6920–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, key: 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.718−7.077

Intercept 8.87 + feature contributions = -4.562 (log-odds).
Score = sigmoid(-4.562) = 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.75+0.923
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.035+0.602
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.833−0.147
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.925 (log-odds).
Score = sigmoid(1.925) = 0.873.

Score0.524
Score17
Run 1

The code is highly readable with a clear, logical structure. It organizes imports logically (standard library first, then third-party/local), uses modern Python features like `from __future__ import annotations` and type hints, and defines a concise, well-documented base class. The class has a single method with a clear purpose and an explicit error message. Nesting is minimal, and the action granularity is appropriate—each line serves one purpose. The reading flow is natural and easy to follow. Minor deductions: the import section is slightly dense and includes some unused or legacy imports (`warnings`, `b64encode`), and the method signature uses a parameter name (`key`) that may be confusing without context. Overall, it is very readable.

Run 2

The code is generally readable. It has clear imports, reasonable use of typing (e.g., `Final`, `cast`, `overload`), and a simple class with a clear docstring and a single method. Nesting is flat. The intent of `AuthBase` is evident. However, the import section is somewhat long for a snippet and includes several unused imports (e.g., `hashlib`, `os`, `re`, `threading`, `time`, `b64encode`, `urlparse`, `extract_cookies_to_jar`, `parse_dict_header`) which reduce clarity of relevant dependencies. The method body is concise but raises `NotImplementedError` without explaining the expected implementation, which is standard but could be slightly more explicit. Overall, readability is above average but would benefit from removing unused imports and perhaps adding a brief comment about the `__call__` method's purpose.

Run 3

This code is highly readable and well-structured. The file begins with essential imports organized by type: standard library (hashlib, os, re, threading, time, warnings), then third-party (typing, base64), followed by relative/internal imports grouped separately. The AuthBase class is minimal and clear: a one-sentence docstring states purpose, and the __call__ method immediately raises NotImplementedError with a helpful message explaining how subclasses should implement it. Indentation is flat with no nesting. The type hint 'PreparedRequest' appears twice but is not imported (likely used via TYPE_CHECKING or forward reference), which is a minor consistency question but does not hinder readability. Variable naming is clear. Line length is reasonable. The __future__ import and Final/cast/overload imports suggest this is a small portion of a larger well-typed library. Overall the code follows idiomatic Python conventions and could be understood by a junior developer with minimal effort.

Run 1

Code Structure: A clearly defined base class and callable interface provide logical organization, though the many unused imports clutter this snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, type annotations, and explicit NotImplementedError clearly communicate an authentication interface; the parameter name 'key' is less descriptive than 'request', and PreparedRequest is not defined or imported here. Code length: The implementation is concise, but the import list is disproportionately long for the shown functionality. Action granularity: Each statement occupies its own line. Reading flow: Imports naturally precede the class and method, although additional blank lines between import groups and before the class would improve visual separation.

Run 2

Code Structure: Imports precede a clearly defined base class, providing logical organization, though many imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, type annotations, and explicit NotImplementedError clearly establish an authentication interface; the parameter name 'key' is less descriptive than 'request', and PreparedRequest is not defined or imported here. Code length: The implementation is concise, but the extensive import list adds unnecessary reading overhead for the shown functionality. Action granularity: Each statement occupies its own line, with no compound actions. Reading flow: The progression from imports to class to callable method is natural, although import grouping and spacing before the class could be improved.

Run 3

Code Structure: The imports and authentication base class are logically organized, although numerous unused imports clutter this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class docstring and explicit NotImplementedError clearly establish an interface for callable authentication hooks; however, the parameter name 'key' is less descriptive than 'request', and PreparedRequest is not defined or imported in the shown code. Code length: The implementation is concise, but the import section is disproportionately long for its functionality. Action granularity: Each line performs a single action. Reading flow: The progression from imports to class to method is natural, though import grouping and an additional blank line before the class would improve readability.