Skip to content

Commit d2cb890

Browse files
Update ty's JSON schema (SchemaStore#5428)
This updates ty's JSON schema to [2bd0252435a1ad19b91863f37beab60bb8e68a14](astral-sh/ty@2bd0252)
1 parent 2687b13 commit d2cb890

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/schemas/json/ty.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,16 @@
541541
}
542542
]
543543
},
544+
"final-on-non-method": {
545+
"title": "detects `@final` applied to non-method functions",
546+
"description": "## What it does\nChecks for `@final` decorators applied to non-method functions.\n\n## Why is this bad?\nThe `@final` decorator is only meaningful on methods and classes.\nApplying it to a module-level function or a nested function has no\neffect and is likely a mistake.\n\n## Example\n\n```python\nfrom typing import final\n\n# Error: @final is not allowed on non-method functions\n@final\ndef my_function() -> int:\n return 0\n```",
547+
"default": "error",
548+
"oneOf": [
549+
{
550+
"$ref": "#/definitions/Level"
551+
}
552+
]
553+
},
544554
"final-without-value": {
545555
"title": "detects `Final` declarations without a value",
546556
"description": "## What it does\nChecks for `Final` symbols that are declared without a value and are never\nassigned a value in their scope.\n\n## Why is this bad?\nA `Final` symbol must be initialized with a value at the time of declaration\nor in a subsequent assignment. At module or function scope, the assignment must\noccur in the same scope. In a class body, the assignment may occur in `__init__`.\n\n## Examples\n```python\nfrom typing import Final\n\n# Error: `Final` symbol without a value\nMY_CONSTANT: Final[int]\n\n# OK: `Final` symbol with a value\nMY_CONSTANT: Final[int] = 1\n```",
@@ -1231,6 +1241,16 @@
12311241
}
12321242
]
12331243
},
1244+
"shadowed-type-variable": {
1245+
"title": "detects type variables that shadow type variables from outer scopes",
1246+
"description": "## What it does\nChecks for type variables in nested generic classes or functions that shadow type variables\nfrom an enclosing scope.\n\n## Why is this bad?\nShadowing type variables makes the code confusing and is disallowed by the typing spec.\n\n## Examples\n```python\nclass Outer[T]:\n # Error: `T` is already used by `Outer`\n class Inner[T]: ...\n\n # Error: `T` is already used by `Outer`\n def method[T](self, x: T) -> T: ...\n```\n\n## References\n- [Typing spec: Generics](https://typing.python.org/en/latest/spec/generics.html#introduction)",
1247+
"default": "error",
1248+
"oneOf": [
1249+
{
1250+
"$ref": "#/definitions/Level"
1251+
}
1252+
]
1253+
},
12341254
"static-assert-error": {
12351255
"title": "Failed static assertion",
12361256
"description": "## What it does\nMakes sure that the argument of `static_assert` is statically known to be true.\n\n## Why is this bad?\nA `static_assert` call represents an explicit request from the user\nfor the type checker to emit an error if the argument cannot be verified\nto evaluate to `True` in a boolean context.\n\n## Examples\n```python\nfrom ty_extensions import static_assert\n\nstatic_assert(1 + 1 == 3) # error: evaluates to `False`\n\nstatic_assert(int(2.0 * 3.0) == 6) # error: does not have a statically known truthiness\n```",

0 commit comments

Comments
 (0)