Sample
pyint-923035fd1ea3-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.207 | 0–1; higher is more readable |
| Mi | 0.335 | 0–1; higher is more readable |
| LLOC | 100 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.443 | 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. | 9397.215 | −310.108 |
| Source linesThe number of non-empty source lines. | 235 | +94 |
| 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.356 | −6.534 |
Intercept 8.87 + feature contributions = -213.773 (log-odds).
Score = sigmoid(-213.773) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 236 | −7.32 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 210 | +6.527 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 210 | −4.398 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 234.909 | +2.874 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 85.907 | +0.582 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.062 | +0.342 |
| 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.949 | −0.018 |
Intercept 0.07 + feature contributions = -1.341 (log-odds).
Score = sigmoid(-1.341) = 0.207.
| Score | 0.335 |
|---|
| Score | 100 |
|---|
Run 1
The code demonstrates excellent structure and readability despite its complexity. It is organized logically with clear sections and well-named methods. Nesting is reasonable, with only 2-3 levels deep in more complex areas. Intent is clarified through docstrings and explanatory comments, particularly in the _add_view and user_change_password methods. The code follows Django admin conventions, making it familiar to experienced Django developers. While somewhat lengthy due to inherent complexity of User admin functionality, it maintains concise well-focused methods. Action granularity is appropriate with one operation per line. The reading flow is natural, progressing through permissions checks, form processing, and response generation. Minor improvements could include extracting the password change context dictionary into a helper method for more modular organization.
Run 2
The code demonstrates strong readability through clear structure and logical organization. It follows Django admin conventions consistently, making it immediately recognizable to experienced Django developers. The class is well-organized with attributes grouped logically, methods following a clear flow, and decorators applied appropriately. Nesting is generally shallow, though the user_change_password method has some depth with nested conditionals. The code's intent is clear throughout - each method has a focused purpose, and comments explain non-obvious business logic (like the permission check in _add_view). Code length is appropriate for the complexity - while user_change_password is long, it handles a complex workflow without unnecessary verbosity. Action granularity is mostly good, with one primary action per line, though some lines combine multiple operations. Reading flow is natural and follows Django admin patterns. Minor deductions for the long user_change_password method which could potentially be refactored into smaller helper methods, and for some dense multi-purpose lines in the form handling logic.
Run 3
This Django admin class demonstrates strong readability through its well-organized structure and clear separation of concerns. The code benefits from Django's inherent patterns, using declarative attributes like `fieldsets`, `list_display`, and `search_fields` that make configuration explicit. Methods are purposefully named and logically grouped, with each serving distinct responsibilities. Nesting levels remain manageable - even the most complex method (`user_change_password`) follows a linear flow rather than deep nesting. Comments are sparse but effective, explaining non-obvious business logic like permission checks. The method `_add_view` is cleanly extracted to separate transaction handling from logic. Each action occupies its own line, with appropriate line breaks for readability. The code maintains a natural reading flow from imports through configuration to methods. Minor deductions for the long `user_change_password` method (which handles multiple concerns including form processing, validation, and context building) and some multi-line string concatenations that could be sectioned further. Overall, this is exemplary Django admin code that balances framework conventions with understandable organization.
Run 1
Code Structure: Well organized into a Django admin class, with declarative configuration followed by focused lifecycle methods; user_change_password combines several responsibilities. Nesting: Most methods are flat and use early returns, but password submission handling has moderately deep conditional nesting. Clarity of intent: Descriptive method and variable names, explanatory comments, and explicit permission checks make purpose clear, though Django conventions require framework familiarity. Code length: Mostly justified by configuration and workflow requirements, but the password-change method and some comments are lengthy. Action granularity: Statements generally perform one action per line, and multiline expressions are consistently formatted. Reading flow: Configuration, validation, updates, redirects, and rendering follow a natural progression; nested URL construction and the large context dictionary slightly interrupt the flow.
Run 2
Code Structure: Configuration is grouped at the top, and focused methods separate form selection, permissions, routing, and responses. The password-change method combines several responsibilities. Nesting: Most methods are shallow and use early returns, but POST validation and redirect construction introduce deeper nesting. Clarity of intent: Descriptive names, standard Django conventions, and explanatory security comments make the purpose clear, although framework-specific behavior requires Django knowledge. Code length: Most verbosity comes from necessary configuration, context dictionaries, and helpful comments; the password-change method is comparatively long. Action granularity: Statements generally perform one action per line, with complex expressions formatted across multiple lines. Reading flow: Imports, configuration, and related methods follow a coherent sequence, and the password workflow proceeds naturally from authorization through validation, persistence, feedback, and rendering.
Run 3
Code Structure: Configuration is grouped clearly, and distinct admin behaviors are separated into focused methods; user_change_password handles several responsibilities and could be decomposed. Nesting: Most methods are shallow and use early exits, but POST processing contains multiple nested conditions and a visually deep redirect expression. Clarity of intent: Descriptive names, explanatory security comments, and familiar Django conventions make the purpose clear, though framework knowledge is required. Code length: Most length comes from necessary configuration and context dictionaries; the password-change handler and some comments are lengthy. Action granularity: Statements generally perform one action per line, with multiline expressions formatted consistently. Reading flow: The progression from configuration through form selection, permissions, request handling, and responses is logical; nested submission handling slightly interrupts the otherwise natural flow.