Sample
pyint-ef1d68efdbbb-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.58 | 0–1; higher is more readable |
| Mi | 0.443 | 0–1; higher is more readable |
| LLOC | 17 | 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.743 | 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. | 901.892 | −29.762 |
| Source linesThe number of non-empty source lines. | 24 | +9.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.562 | −6.843 |
Intercept 8.87 + feature contributions = -18.136 (log-odds).
Score = sigmoid(-18.136) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| 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.058 | +0.383 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 25 | +0.151 |
| 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. | 84 | +0.107 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 23.906 | −0.076 |
Intercept 0.07 + feature contributions = 0.322 (log-odds).
Score = sigmoid(0.322) = 0.58.
| Score | 0.443 |
|---|
| Score | 17 |
|---|
Run 1
The code demonstrates good readability. Structure is logical: imports are grouped, and the class has a clear purpose. Nesting is minimal—only one nested call inside `get_by_natural_key`, which is necessary and clearly formatted. Intent is clear: the manager retrieves a permission by its natural key components. Code length is concise; no extra methods or comments are needed. Action granularity is appropriate: one meaningful action per line, with keyword arguments kept on separate lines for clarity. Reading flow is natural—signature, return, and nested call follow a top-to-bottom order. Minor deductions: unused imports (`auth`, `AbstractBaseUser`, etc.) could confuse readers, and the `use_in_migrations = True` line lacks context for novices, but these are minor. Overall, the code is well-structured and easy to follow.
Run 2
The code is well-organized with clear imports and a single, focused class. The PermissionManager class has a clear purpose and overrides get_by_natural_key in a straightforward manner. Nesting is minimal, with only one level inside the method. The use of keyword arguments in the get() call enhances clarity. The code is concise and avoids unnecessary repetition. Action granularity is appropriate, with one logical operation per line. The main readability challenge is the line continuation for content_type, which slightly interrupts flow but follows PEP 8. Overall, this is highly readable Django model manager code.
Run 3
The code is well-structured and highly readable. It uses clear import organization from standard library, Django core, and local modules. The PermissionManager class has a single purpose with a flat, non-nested method and good naming. The get_by_natural_key method retrieves a ContentType via natural key, with clear variable names (codename, app_label, model). Although the nested db_manager call adds indentation, it remains explicit and avoids unnecessary line breaks. The code is concise, with one logical action per line, and follows Django conventions.
Run 1
Code Structure: Imports precede a focused manager class, providing clear organization, although many imports are unused in this snippet. Nesting: Shallow structure; the nested database lookup is easy to follow. Clarity of intent: Descriptive class, method, and parameter names clearly communicate retrieval by a natural key. Code length: The implementation is concise, but the extensive imports add visual overhead relative to the small method. Action granularity: Each statement has a distinct purpose, and multiline arguments keep the compound lookup readable. Reading flow: Conventional formatting and logical argument ordering support a natural top-to-bottom reading flow; an additional blank line before the class would improve separation.
Run 2
Code Structure: Imports and a focused manager class provide clear organization, though most imports are unused in this snippet. Nesting: Minimal control-flow nesting; the nested lookup is formatted clearly. Clarity of intent: Descriptive class, method, and parameter names communicate a natural-key permission lookup, although understanding the details requires Django familiarity. Code length: The implementation is concise, but the extensive import block adds unnecessary visual overhead for the code shown. Action granularity: A single return expression combines two related database lookups, with line breaks making their relationship easy to follow. Reading flow: Conventional formatting and sensible argument ordering support natural reading, slightly weakened by the disproportionate import section.
Run 3
Code Structure: Imports and the manager class are logically organized, although many imports are unused in this snippet. Nesting: Shallow method nesting; the nested lookup remains easy to follow. Clarity of intent: Descriptive class, method, and parameter names make the natural-key permission lookup clear, assuming familiarity with Django. Code length: The implementation is concise, but the lengthy import list adds clutter relative to the small method. Action granularity: The return statement combines content-type resolution and permission retrieval, though multiline formatting clearly separates their arguments. Reading flow: Conventional indentation and formatting provide a natural top-to-bottom flow; an additional blank line before the class would improve separation.