Sample

pyint-7d520b13f7b6-SRC

Unmodified source class

Lines69

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8910–1; higher is more readable
Mi0.3980–1; higher is more readable
LLOC43Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.5350–1; higher is more readable

Views

Source code

from __future__ import annotations import ast import collections.abc as cabc import importlib.metadata import inspect import os import platform import re import sys import traceback import typing as t from functools import update_wrapper from operator import itemgetter from types import ModuleType import click from click.core import ParameterSource from werkzeug import run_simple from werkzeug.serving import is_running_from_reloader from werkzeug.utils import import_string from .globals import current_app from .helpers import get_debug_flag from .helpers import get_load_dotenv class CertParamType(click.ParamType): # type: ignore[type-arg] """Click option type for the ``--cert`` option. Allows either an existing file, the string ``'adhoc'``, or an import for a :class:`~ssl.SSLContext` object. """ name = "path" def __init__(self) -> None: self.path_type = click.Path(exists=True, dir_okay=False, resolve_path=True) def convert( self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None ) -> t.Any: try: import ssl except ImportError: raise click.BadParameter( 'Using "--cert" requires Python to be compiled with SSL support.', ctx, param, ) from None try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() # type: ignore[union-attr] if value == "adhoc": try: import cryptography # noqa: F401 except ImportError: raise click.BadParameter( "Using ad-hoc certificates requires the cryptography library.", ctx, param, ) from None return value obj = import_string(value, silent=True) if isinstance(obj, ssl.SSLContext): return obj raise

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.1694.374−55.914
Source linesThe number of non-empty source lines.69+27.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.394−6.59

Intercept 8.87 + feature contributions = -26.035 (log-odds).
Score = sigmoid(-26.035) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.70−1.442
Indentation frequencyHow rapidly indentation changes from line to line.63+1.442
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.971+0.599
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.68.864+0.553
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.045+0.502
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.86.929−0.017

Intercept 0.07 + feature contributions = 2.104 (log-odds).
Score = sigmoid(2.104) = 0.891.

Score0.398
Score43
Run 1

The code is highly readable, with good modularity, clear naming, and logical error handling. Structure is clean: a simple class with a single conversion method and flat, linear flow. Nesting is moderate but purposeful—try/except blocks handle SSL/cryptography imports and fallback logic, but the ad-hoc branch introduces a second level. Clarity of intent is strong: each failure mode has a specific, informative error message. Length is appropriate; no unnecessary verbosity. Action granularity is mostly one action per line. Reading flow is natural: SSL import, path validation, ad-hoc handling, then import-string fallback. Slight deductions for the nested try/except in the ad-hoc branch and reliance on re-raising a caught exception to trigger fallback, which can obscure control flow.

Run 2

The code has clear structure with logical imports and a well-contained class. Nested exception handling for SSL and 'adhoc' certificates adds some depth but remains manageable. Intent is explicit through method names and docstrings. However, the convert() method is long and handles multiple responsibilities (SSL compilation check, path resolution, 'adhoc' string handling, import validation), reducing clarity. The repeated use of click.BadParameter with context and param arguments creates verbosity. While line-level granularity is acceptable, the two try/except blocks with silent import failure and re-raised generic exception (raise without argument) makes the flow slightly disorganized, especially for maintaining error context. The code requires some backtracking to understand what conditions trigger the final raise. Overall, it is readable but could benefit from splitting convert() into smaller helper methods or clearer error control flow.

Run 3

The code is highly readable with clear logical organization, minimal nesting, and explicit error handling. The CertParamType class follows a natural sequence: import SSL, attempt file path conversion, fall back to 'adhoc' or import_string. Each action is on its own line, and error messages are descriptive. Minor deductions for the slightly complex convert method with multiple exception branches and the nested try/except blocks, but overall the structure is clean and intent is evident.

Run 1

Code Structure: Imports, a documented parameter class, and focused methods provide logical organization. Nesting: The fallback logic nests exception handling and conditionals several levels deep, making convert slightly harder to follow. Clarity of intent: The docstring, descriptive names, type annotations, and specific error messages clearly explain the supported certificate inputs. Code length: The implementation is concise for its responsibilities, although many imports are unused in this excerpt. Action granularity: Statements generally perform one action each, with readable multiline calls. Reading flow: Processing moves naturally from SSL availability to file-path validation, then alternative certificate forms. The final bare raise requires remembering the enclosing exception context, and lowercasing the entire input makes the handling of import paths less intuitive.

Run 2

Code Structure: The class cleanly separates initialization from conversion, although the extensive imports distract from this small excerpt. Nesting: Mostly manageable, but the nested exception handling and conditional SSL checks add depth. Clarity of intent: The docstring, descriptive names, type annotations, and informative errors clearly explain the accepted certificate inputs; the final bare raise requires tracking the enclosing exception. Code length: The implementation is reasonably concise, though many imports are unused in the excerpt. Action granularity: Statements generally perform one action per line, and multiline calls are formatted consistently. Reading flow: Processing follows a natural progression from SSL availability to file validation, ad-hoc certificates, and SSLContext imports, with whitespace separating stages. Exception-driven fallback slightly complicates following the control flow.

Run 3

Code Structure: Imports, a focused parameter class, and separate initialization and conversion methods provide logical organization. Nesting: Nested exception handling and the ad-hoc certificate branch add moderate depth, but remain manageable. Clarity of intent: The docstring, descriptive names, type annotations, and specific error messages clearly explain accepted inputs and requirements. The final bare raise and conversion of import strings to lowercase are less immediately obvious. Code length: Concise overall, although many imports are unused in this excerpt and add visual clutter. Action granularity: Statements generally perform one action per line; multiline calls improve readability. Reading flow: Conversion proceeds naturally from file validation to special-value handling to SSLContext resolution, though placing fallback logic inside an exception handler slightly complicates following the alternatives.