Sample
pyint-fd5108bdbbaa-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.299 | 0–1; higher is more readable |
| Mi | 0.473 | 0–1; higher is more readable |
| LLOC | 36 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.446 | 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. | 2511.766 | −82.888 |
| Source linesThe number of non-empty source lines. | 82 | +32.8 |
| 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.702 | −7.053 |
Intercept 8.87 + feature contributions = -48.271 (log-odds).
Score = sigmoid(-48.271) = 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. | 83 | −1.902 |
| 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. | 119.976 | −1.417 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 119.988 | +1.131 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 53 | +1.096 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 53 | −0.795 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 81.851 | +0.734 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.073 | +0.231 |
Intercept 0.07 + feature contributions = -0.851 (log-odds).
Score = sigmoid(-0.851) = 0.299.
| Score | 0.473 |
|---|
| Score | 36 |
|---|
Run 1
The code is generally well-structured and readable, with clear docstrings, type hints, and separation of methods. However, some sections reduce clarity and flow: the `if not (data is None): pass else: data = {}` block is awkward and should be simplified to `if data is None: data = {}`. The `__eq__` method uses a similar inverted conditional and contains a type-ignore comment that adds noise. Variable naming is mostly clear, but `_store.values()` usage in `copy` and `__iter__` could be clarified with unpacking for readability. Nesting is minimal overall, action granularity is appropriate, and the reading flow is natural aside from the mentioned conditionals. The class is concise but not overly compressed. Minor refactoring of conditionals and removal of unnecessary type-ignore comments would improve readability.
Run 2
The code has good type hints, docstrings, and a clear purpose. However, several structural issues reduce readability. The __init__ method has awkward logic: the `if not (data is None): pass else: data = {}` pattern is confusing and should be simplified to `data = data or {}`. The __eq__ method is structurally odd: the else branch creates an unused variable and the flow is broken. The if/else with pass and the unused `other_dict` variable hurt clarity of intent. Nesting is generally flat, and action granularity is acceptable. Reading flow is mostly natural, but the __init__ and __eq__ sections interrupt it. Code length is concise overall, but the docstring is long relative to the implementation. The logic for case-insensitive storage is easy to follow in __setitem__ and __getitem__. Overall, the code is maintainable but would benefit from cleaning up the branching patterns and removing dead code.
Run 3
The code is well-structured with clear separation of methods, consistent type hints, and a thorough docstring that explains behavior with examples. Nesting is minimal, and each action is generally on its own line. The `__init__` method has an awkward and unnecessarily convoluted conditional (`if not (data is None): pass else: data = {}`), which harms clarity and could be simplified to `if data is None: data = {}`. The `__eq__` method also has a mildly awkward conditional returning `NotImplemented`, but it remains readable. Overall, intent is clear, the class API is logical, and reading flow is natural.
Run 1
Code Structure: Well-organized mapping class with small, focused methods and a consistent internal representation. Nesting: Mostly flat; unnecessary else branches in initialization and equality add minor complexity. Clarity of intent: Descriptive names, type annotations, and documentation explain case-insensitive behavior clearly, but _VT is never defined in the provided snippet, and unused imports distract. Code length: Methods are concise, although the lengthy docstring and redundant pass branch could be streamlined. Action granularity: Statements generally perform one action per line; generator expressions remain manageable. Reading flow: Standard mapping methods follow a natural sequence, but negated conditions such as 'if not (data is None)' are less direct than simple positive checks. Overall, highly approachable code with several avoidable distractions.
Run 2
Code Structure: Clearly organized into small mapping methods around a consistent internal store. Nesting: Shallow throughout, although the constructor's no-op branch and the unnecessary else after an early return add clutter. Clarity of intent: Descriptive method names, type annotations, comments, and the class docstring explain case-insensitive behavior well; however, _VT is undefined in the snippet, and negated conditions are less direct than necessary. Code length: Most methods are concise, though the constructor could be simplified and some documentation is verbose. Action granularity: Statements generally perform one action per line; generator expressions remain manageable. Reading flow: Methods follow a natural progression from initialization through mapping operations to comparison and representation. Long annotations and the inline type-ignore comment slightly interrupt scanning.
Run 3
Code Structure: Well organized into small, standard mapping methods with a consistent internal representation. Nesting: Very shallow, although redundant else branches and a no-op pass add unnecessary control flow. Clarity of intent: The class docstring, type annotations, and descriptive method names clearly explain case-insensitive behavior; however, _VT is not defined in the provided snippet, and negated conditions are awkward. Code length: Mostly concise, but the constructor and equality check could be simplified, and the docstring is somewhat lengthy. Action granularity: Statements generally perform one action each; generator expressions are compact and understandable. Reading flow: Methods follow a natural progression from initialization through mapping operations to comparison and copying, with consistent formatting. Minor distractions include unused TypeVar and overload imports, an unnecessary comment, and the long inline type-ignore annotation.