Sample
pyint-4689fd3961d7-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.186 | 0–1; higher is more readable |
| Mi | 0.518 | 0–1; higher is more readable |
| LLOC | 122 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.284 | 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. | 7774.442 | −256.557 |
| Source linesThe number of non-empty source lines. | 234 | +93.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.398 | −6.596 |
Intercept 8.87 + feature contributions = -160.683 (log-odds).
Score = sigmoid(-160.683) = 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. | 235 | −7.284 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 187 | +5.731 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 187 | −3.87 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 233.875 | +2.859 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 86.591 | +0.593 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.447 |
| 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.974 | −0.019 |
Intercept 0.07 + feature contributions = -1.474 (log-odds).
Score = sigmoid(-1.474) = 0.186.
| Score | 0.518 |
|---|
| Score | 122 |
|---|
Run 1
The code is well-structured with clear class organization, logical grouping of properties and methods, and consistent docstrings explaining intent. Imports are organized, and helper methods break down complex operations. Nesting is generally shallow, with only a few conditional branches. However, readability is slightly reduced by the dense list comprehensions in properties like `fields`, `field_types`, and `field_widths`, which pack multiple operations into single expressions. Some methods such as `_set_spatial_filter` have multiple nested conditionals and inline comments that add clarity but also increase cognitive load. The dummy score variables in `test_capability` create confusion and appear to be leftover debug code. Overall, the code is readable and maintainable with minor clarity issues.
Run 2
The code is well-structured with clear class organization and logical grouping of properties and methods. It maintains consistent naming conventions and uses docstrings effectively to explain purpose. Nesting is mostly flat except in the spatial filter setter, where a 3-level conditional is still readable. Intent is clear through descriptive method names and property decorators. Code length is appropriate, with helper methods like _make_feature preventing duplication. Action granularity is good, though a few lines combine multiple operations (e.g., chained calls in extent and srs properties). Reading flow is natural, with related functionality grouped together and consistent import ordering. The test_capability method contains an unrelated performance score comparison block that appears to be misplaced dead code, slightly reducing clarity.
Run 3
The code demonstrates strong readability through clear structure, logical organization, and consistent patterns. The class is well-documented with docstrings explaining purpose and behavior. Properties and methods are grouped logically, with property accessors clearly separated from methods. Nesting is minimal — only 2-3 levels in conditional logic and loops. The intent is transparent for each method, particularly in handling different index types in __getitem__ and capability testing. Code length is appropriate; no unnecessary verbosity despite the class's inherent complexity with GDAL/OGR bindings. Each action typically occupies its own line, improving traceability. Reading flow follows a natural progression from constructor through dunder methods, properties, then methods. Minor inconsistencies exist, such as the dead code at the end of test_capability where dummy variable assignments don't affect the final return, and some logic spans multiple lines with nested function calls that could be extracted for clarity. However, these are minor issues in an otherwise exemplary example of Python library code.
Run 1
Code Structure: Methods are logically grouped into initialization, collection behavior, properties, and layer operations; unrelated score calculations in test_capability weaken cohesion. Nesting: Mostly shallow, with manageable branching and loops. Clarity of intent: Descriptive names, docstrings, and comments explain the wrapper and its C API interactions, though unused score variables and inconsistent ptr/_ptr usage introduce distractions. Code length: Most methods are concise; repeated field-access patterns, occasional redundant comments, and dead score calculations add unnecessary length. Action granularity: Statements generally perform one action per line, although nested API calls in comprehensions require extra parsing. Reading flow: Conventional formatting and predictable method organization support smooth reading; low-level API abbreviations and the unexplained scoring block interrupt it.
Run 2
Code Structure: Well-organized class with distinct initialization, indexing, properties, and methods; unrelated score-comparison code in test_capability disrupts cohesion. Nesting: Mostly shallow, with manageable branching in feature lookup and spatial-filter validation. Clarity of intent: Descriptive names, docstrings, and explanatory comments make the wrapper's purpose clear, although abbreviated C API identifiers and inconsistent ptr/_ptr usage require extra attention. Code length: Most methods are concise; repetitive field accessors, some redundant comments, and unused score calculations add unnecessary length. Action granularity: Generally one action per statement, though nested API calls in comprehensions compress several operations into single expressions. Reading flow: Logical grouping and consistent formatting support smooth reading; the older property construction style and irrelevant calculations near the end introduce minor interruptions.
Run 3
Code Structure: Well-organized class with distinct initialization, protocol methods, properties, and operations; unrelated score calculations in test_capability disrupt cohesion. Nesting: Generally shallow, with manageable conditionals and loops. Clarity of intent: Descriptive method names, docstrings, and explanatory comments make the wrapper's purpose clear, though abbreviated C API names and inconsistent ptr/_ptr usage require extra attention. Code length: Most methods are concise, but repetitive property implementations, some redundant comments, and unused score calculations add unnecessary length. Action granularity: Statements generally perform one action per line; nested API calls in comprehensions slightly increase cognitive load. Reading flow: Logical ordering and consistent formatting support natural reading, although legacy-style property construction and the irrelevant final conditional interrupt that flow.