From 072ae50c29d57234debba693428a058e7e2add85 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 5 Jul 2023 12:20:45 -0400 Subject: [PATCH] Update ruff's JSON schema (#3048) This updates ruff's JSON schema to [324455f580813a7c7721dc1d7ef1ee7721ae3e76](https://github.com/astral-sh/ruff/commit/324455f580813a7c7721dc1d7ef1ee7721ae3e76) --- src/schemas/json/ruff.json | 47 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/schemas/json/ruff.json b/src/schemas/json/ruff.json index 61257046233c..ac72bc42cd7d 100644 --- a/src/schemas/json/ruff.json +++ b/src/schemas/json/ruff.json @@ -635,6 +635,16 @@ }, "additionalProperties": false }, + "PyUpgradeOptions": { + "type": "object", + "properties": { + "keep-runtime-typing": { + "description": "Whether to avoid PEP 585 (`List[int]` -> `list[int]`) and PEP 604 (`Union[str, int]` -> `str | int`) rewrites even if a file imports `from __future__ import annotations`.\n\nThis setting is only applicable when the target Python version is below 3.9 and 3.10 respectively, and is most commonly used when working with libraries like Pydantic and FastAPI, which rely on the ability to parse type annotations at runtime. The use of `from __future__ import annotations` causes Python to treat the type annotations as strings, which typically allows for the use of language features that appear in later Python versions but are not yet supported by the current version (e.g., `str | int`). However, libraries that rely on runtime type annotations will break if the annotations are incompatible with the current Python version.\n\nFor example, while the following is valid Python 3.8 code due to the presence of `from __future__ import annotations`, the use of `str| int` prior to Python 3.10 will cause Pydantic to raise a `TypeError` at runtime:\n\n```python from __future__ import annotations\n\nimport pydantic\n\nclass Foo(pydantic.BaseModel): bar: str | int ```", + "type": ["boolean", "null"] + } + }, + "additionalProperties": false + }, "Pycodestyle": { "type": "object", "properties": { @@ -744,14 +754,14 @@ "Quote": { "oneOf": [ { - "description": "Use single quotes.", + "description": "Use double quotes.", "type": "string", - "enum": ["single"] + "enum": ["double"] }, { - "description": "Use double quotes.", + "description": "Use single quotes.", "type": "string", - "enum": ["double"] + "enum": ["single"] } ] }, @@ -1216,6 +1226,7 @@ "NPY00", "NPY001", "NPY002", + "NPY003", "PD", "PD0", "PD00", @@ -1239,6 +1250,13 @@ "PERF10", "PERF101", "PERF102", + "PERF2", + "PERF20", + "PERF203", + "PERF4", + "PERF40", + "PERF401", + "PERF402", "PGH", "PGH0", "PGH00", @@ -1263,8 +1281,12 @@ "PL", "PLC", "PLC0", + "PLC01", + "PLC013", + "PLC0132", "PLC02", "PLC020", + "PLC0205", "PLC0208", "PLC04", "PLC041", @@ -1453,6 +1475,10 @@ "PYI0", "PYI00", "PYI001", + "PYI002", + "PYI003", + "PYI004", + "PYI005", "PYI006", "PYI007", "PYI008", @@ -1803,7 +1829,7 @@ "TabSize": { "description": "The size of a tab.", "type": "integer", - "format": "uint", + "format": "uint8", "minimum": 0.0 }, "Version": { @@ -2220,6 +2246,17 @@ } ] }, + "pyupgrade": { + "description": "Options for the `pyupgrade` plugin.", + "anyOf": [ + { + "$ref": "#/definitions/PyUpgradeOptions" + }, + { + "type": "null" + } + ] + }, "required-version": { "description": "Require a specific version of Ruff to be running (useful for unifying results across many environments, e.g., with a `pyproject.toml` file).", "anyOf": [