Sample
pyint-fb63a9d58800-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.869 | 0–1; higher is more readable |
| Mi | 0.375 | 0–1; higher is more readable |
| LLOC | 40 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.463 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 2118.047 | −69.896 |
| Source linesThe number of non-empty source lines. | 60 | +24 |
| 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.381 | −6.571 |
Intercept 8.87 + feature contributions = -43.596 (log-odds).
Score = sigmoid(-43.596) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 57 | +1.234 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 61 | −1.123 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 88 | +0.615 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 59.854 | +0.427 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.063 | +0.332 |
| 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. | 88 | −0.062 |
Intercept 0.07 + feature contributions = 1.891 (log-odds).
Score = sigmoid(1.891) = 0.869.
| Score | 0.375 |
|---|
| Score | 40 |
|---|
Run 1
This code demonstrates strong readability with clear structure and purpose. Each method has a single responsibility, and action granularity is well-maintained - one logical operation per line. The __init__ method handles optional parameters cleanly without unnecessary complexity. The __call__ method is concise and its intent is immediately clear through the docstring and variable naming (regex_matches, invalid_input). Nesting is minimal with no deep conditionals. Import organization is logical with standard library, Django, and local imports separated. Minor deductions: the __eq__ method could use slightly better formatting with fewer parentheses, and the conditional logic in __call__ could benefit from a brief comment explaining inverse_match behavior, though the variable names help mitigate this. Overall the code follows Django's established patterns and maintains a natural reading flow.
Run 2
The code is highly readable with clear structure, minimal nesting, and explicit intent. The class is well-organized with logical attribute defaults and a straightforward constructor that validates inputs. The __call__ method is concise and uses descriptive variable names (regex_matches, invalid_input) to clarify logic. Action granularity is appropriate—each step is on its own line. The __eq__ method is flat and readable, though it is slightly verbose. Overall, the code follows Django conventions, uses type-checking appropriately, and maintains a natural reading flow from imports to class definition to methods.
Run 3
The code demonstrates clear logical organization, with a single class focused on regex validation. The structure is clean: class attributes are defined upfront, followed by a well-organized __init__ method with sensible parameter handling. Nesting is minimal, with only one conditional inside __call__ and no deeply nested logic. Intent is clear from descriptive names like RegexValidator, regex_matches, and invalid_input. Code length is appropriate—concise but not overly compressed. Action granularity is mostly good, with one meaningful operation per line, though some lines like the __eq__ comparison chain could be split for readability. Reading flow is natural: imports are grouped, the class is well-documented, and methods follow logical order. The code maintains Django conventions and is largely self-explanatory. Minor deductions for the dense __eq__ method and slightly long __init__ signature, but overall it is highly readable.
Run 1
Code Structure: The class is logically organized into defaults, initialization, validation, and equality comparison, though several imports are unused in this snippet. Nesting: Control flow is shallow, with straightforward conditionals and no deeply nested blocks. Clarity of intent: Descriptive names, a useful validation docstring, and an explicit error message make the purpose clear; the inverse-match conditional requires slight extra thought. Code length: The implementation is appropriately concise, although initialization repeats similar assignment checks. Action granularity: Each statement performs a single clear action, and multiline expressions are formatted cleanly. Reading flow: Methods follow a natural sequence, with consistent indentation and spacing; an additional blank line before the class would improve separation from imports.
Run 2
Code Structure: Imports, class defaults, initialization, validation, and equality comparison are logically organized into focused methods. Nesting: Mostly flat, with simple conditionals and no deeply nested control flow. Clarity of intent: Descriptive names and the validation docstring make the purpose clear, though the inverse-match expression requires brief attention. Code length: Concise overall; repeated initialization checks are understandable, but several imports are unused in this snippet. Action granularity: Each statement performs one clear action, and multiline expressions are formatted consistently. Reading flow: The progression from configuration to validation to comparison is natural. Minor drawbacks include the unused imports, limited documentation of initialization options, and redundant parentheses in some equality checks.
Run 3
Code Structure: The class is logically organized into defaults, initialization, validation, and equality comparison, though unused imports add clutter. Nesting: Control flow is shallow, with straightforward conditionals and no deeply nested blocks. Clarity of intent: Descriptive names and the validation docstring make the purpose clear; the inverse-match expression requires slightly more attention. Code length: The implementation is appropriately concise, although repeated initialization checks add some verbosity. Action granularity: Each statement performs one clear action, and longer expressions are formatted across lines for readability. Reading flow: Methods follow a natural sequence, with consistent formatting and readable error handling. Minor distractions include unnecessary parentheses in parts of the equality comparison and imports unrelated to the displayed class.