Download catalog/patterns.json from tailot/lingologos-thinkingpython: direct link, hf CLI and curl.
- Browser
- Download file 9.71 kB
-
https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/catalog/patterns.json
- Command line
-
hf download hf://datasets/tailot/lingologos-thinkingpython/catalog/patterns.json
-
curl -L -o patterns.json https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/catalog/patterns.json
9.71 kB
| { | |
| "version": 1, | |
| "entries": [ | |
| { | |
| "id": "mutable-default", | |
| "family": "refactoring", | |
| "shape": "mutable-default", | |
| "source": "Effective Python item 17", | |
| "effect": "the default is no longer built once at definition time", | |
| "lock": "calling the function twice returns an independent empty value", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "mutable-default" | |
| ] | |
| }, | |
| { | |
| "id": "magic-literal", | |
| "family": "refactoring", | |
| "shape": "magic-literal", | |
| "source": "Refactoring, chapter 7", | |
| "effect": "the value is named once at module level", | |
| "lock": "the module exposes the constant and the body refers to it", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "DYNAMIC_REACH" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "magic-literal" | |
| ] | |
| }, | |
| { | |
| "id": "guard-clause", | |
| "family": "refactoring", | |
| "shape": "guard-clause", | |
| "source": "Refactoring, guard clause", | |
| "effect": "the body is no longer wrapped in one condition", | |
| "lock": "the function still returns the same value for the same input", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "guard-clause" | |
| ] | |
| }, | |
| { | |
| "id": "dead-import", | |
| "family": "refactoring", | |
| "shape": "dead-import", | |
| "source": "static property of the syntax tree", | |
| "effect": "the name is no longer bound and the module still imports", | |
| "lock": "the module imports cleanly and the name is gone", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "GENERATED_TARGET", | |
| "AMBIGUOUS_TARGET" | |
| ], | |
| "min_assurance": 1, | |
| "frames": [ | |
| "dead-import" | |
| ] | |
| }, | |
| { | |
| "id": "loop-comprehension", | |
| "family": "python_idiom", | |
| "shape": "loop-comprehension", | |
| "source": "the idiom of the language", | |
| "effect": "the list is built in one expression", | |
| "lock": "the list is equal to the one the loop built", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "DYNAMIC_REACH", | |
| "AMBIGUOUS_TARGET" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "loop-comprehension" | |
| ] | |
| }, | |
| { | |
| "id": "concat-fstring", | |
| "family": "python_idiom", | |
| "shape": "concat-fstring", | |
| "source": "the idiom of the language", | |
| "effect": "the message is built by one formatted literal", | |
| "lock": "the produced string is byte equal to the concatenation", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "NOT_ASCII_TARGET", | |
| "AMBIGUOUS_TARGET" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "concat-fstring" | |
| ] | |
| }, | |
| { | |
| "id": "add-assertion", | |
| "family": "methodology", | |
| "shape": "add-assertion", | |
| "source": "design by contract", | |
| "effect": "a caller passing the wrong type fails at the boundary", | |
| "lock": "the function raises AssertionError on a wrong argument", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "ASSERTION_REMOVED", | |
| "AMBIGUOUS_TARGET" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "add-assertion" | |
| ] | |
| }, | |
| { | |
| "id": "unused-local", | |
| "family": "dead_code", | |
| "shape": "unused-local", | |
| "source": "witness fixtures/lab/registry.py tally", | |
| "effect": "a local value computed and never read", | |
| "lock": "the body no longer assigns the dead name", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "unused-local" | |
| ] | |
| }, | |
| { | |
| "id": "unreachable-code", | |
| "family": "dead_code", | |
| "shape": "unreachable-code", | |
| "source": "witness fixtures/lab/registry.py describe", | |
| "effect": "the statements that can never run are gone", | |
| "lock": "no statement survives after the return", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "unreachable-code" | |
| ] | |
| }, | |
| { | |
| "id": "empty-except", | |
| "family": "error_handling", | |
| "shape": "empty-except", | |
| "source": "witness fixtures/lab/registry.py ignore_late", | |
| "effect": "the exception is no longer swallowed", | |
| "lock": "the handler body is no longer a bare pass", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "empty-except" | |
| ] | |
| }, | |
| { | |
| "id": "bare-except", | |
| "family": "error_handling", | |
| "shape": "bare-except", | |
| "source": "witness fixtures/lab/registry.py quiet_read", | |
| "effect": "the handler names what it catches", | |
| "lock": "the except clause names an exception type", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "bare-except" | |
| ] | |
| }, | |
| { | |
| "id": "bool-prefix", | |
| "family": "simplification", | |
| "shape": "bool-prefix", | |
| "source": "witness fixtures/lab/registry.py is_empty", | |
| "effect": "the condition is returned instead of mapped onto a bool", | |
| "lock": "the function returns the condition it was mapping", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "bool-prefix" | |
| ] | |
| }, | |
| { | |
| "id": "len-zero", | |
| "family": "simplification", | |
| "shape": "len-zero", | |
| "source": "witness fixtures/lab/registry.py is_empty", | |
| "effect": "emptiness is tested by truthiness, not by length", | |
| "lock": "no comparison of a length with zero remains", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "len-zero" | |
| ] | |
| }, | |
| { | |
| "id": "bool-compare", | |
| "family": "simplification", | |
| "shape": "bool-compare", | |
| "source": "witness fixtures/lab/registry.py flag_text", | |
| "effect": "the value is tested, not compared to a bool literal", | |
| "lock": "no comparison with a bool literal remains", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "bool-compare" | |
| ] | |
| }, | |
| { | |
| "id": "dict-get", | |
| "family": "python_idiom", | |
| "shape": "dict-get", | |
| "source": "witness fixtures/lab/registry.py lookup", | |
| "effect": "the default comes from the mapping, not from a caught KeyError", | |
| "lock": "the mapping supplies the default without an exception", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "dict-get" | |
| ] | |
| }, | |
| { | |
| "id": "redundant-list", | |
| "family": "python_idiom", | |
| "shape": "redundant-list", | |
| "source": "witness fixtures/lab/registry.py names_of", | |
| "effect": "the comprehension is returned as it is", | |
| "lock": "the comprehension is returned without a list call", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "redundant-list" | |
| ] | |
| }, | |
| { | |
| "id": "str-of-string", | |
| "family": "python_idiom", | |
| "shape": "str-of-string", | |
| "source": "witness fixtures/lab/registry.py shout", | |
| "effect": "the value is used without a conversion it does not need", | |
| "lock": "the value is used without str around a string", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "str-of-string" | |
| ] | |
| }, | |
| { | |
| "id": "open-context", | |
| "family": "python_idiom", | |
| "shape": "open-context", | |
| "source": "witness fixtures/lab/registry.py read_notes", | |
| "effect": "the file is closed by the block that opened it", | |
| "lock": "the file is opened inside a with block", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "open-context" | |
| ] | |
| }, | |
| { | |
| "id": "range-len", | |
| "family": "python_idiom", | |
| "shape": "range-len", | |
| "source": "witness fixtures/lab/registry.py indexed", | |
| "effect": "the loop walks the items and their positions together", | |
| "lock": "the loop uses enumerate instead of range(len(...))", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "range-len" | |
| ] | |
| }, | |
| { | |
| "id": "dataclass-init", | |
| "family": "python_idiom", | |
| "shape": "dataclass-init", | |
| "source": "witness fixtures/lab/registry.py Record", | |
| "effect": "the constructor assignments are generated", | |
| "lock": "the class carries the dataclass decorator", | |
| "refusals": [ | |
| "NO_SHAPE", | |
| "AMBIGUOUS_TARGET", | |
| "NO_EDIT", | |
| "ASSERTION_REMOVED" | |
| ], | |
| "min_assurance": 2, | |
| "frames": [ | |
| "dataclass-init" | |
| ] | |
| } | |
| ] | |
| } | |