From a671de01d418a8981f6056e19a72feba2e9d16ce Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sat, 14 Sep 2024 00:08:05 +0200 Subject: [PATCH] enable pyright again --- flake.nix | 3 +++ poetry.lock | 31 ++++++++++++++++++++++++++++++- pyproject.toml | 2 +- vatsim/types.py | 4 ++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 872d7a8..8c1d9e7 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,9 @@ urllib3 = prev.urllib3.overridePythonAttrs (attrs: { nativeBuildInputs = attrs.nativeBuildInputs ++ [ final.hatch-vcs ]; }); + pyright = prev.pyright.overridePythonAttrs (attrs: { + nativeBuildInputs = attrs.nativeBuildInputs ++ [ final.setuptools ]; + }); } ); python-vatsim = pkgs'.poetry2nix.mkPoetryApplication { diff --git a/poetry.lock b/poetry.lock index 3b340e7..ce11fc9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -238,6 +238,17 @@ files = [ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, ] +[[package]] +name = "nodeenv" +version = "1.9.1" +description = "Node.js virtual environment builder" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, + {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, +] + [[package]] name = "packaging" version = "24.1" @@ -388,6 +399,24 @@ files = [ [package.dependencies] typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" +[[package]] +name = "pyright" +version = "1.1.380" +description = "Command line wrapper for pyright" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pyright-1.1.380-py3-none-any.whl", hash = "sha256:a6404392053d8848bacc7aebcbd9d318bb46baf1a1a000359305481920f43879"}, + {file = "pyright-1.1.380.tar.gz", hash = "sha256:e6ceb1a5f7e9f03106e0aa1d6fbb4d97735a5e7ffb59f3de6b2db590baf935b2"}, +] + +[package.dependencies] +nodeenv = ">=1.6.0" + +[package.extras] +all = ["twine (>=3.4.1)"] +dev = ["twine (>=3.4.1)"] + [[package]] name = "pytest" version = "8.3.3" @@ -608,4 +637,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "980c357b2d837b77fc09dc5a5100e2175dd9e1a3b9eb0d901da4c25e4d5f97b3" +content-hash = "1c03fa4b044c3bd41e23382e720054ea80fe6caa12f241cdd8321b0f2fb9c6f2" diff --git a/pyproject.toml b/pyproject.toml index 5b5a43e..0e57192 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ regex = ">=2023.12.25,<2025.0.0" ruff = "0.6.1" pytest = "^8" pytest-cov = ">=4.1,<6.0" -#pyright = "1.1.379" +pyright = "1.1.380" [tool.pytest.ini_options] addopts = ["--cov-report=term", "--cov-report=xml:cov.xml", "--cov=vatsim"] diff --git a/vatsim/types.py b/vatsim/types.py index 781f25b..989e39b 100644 --- a/vatsim/types.py +++ b/vatsim/types.py @@ -30,8 +30,8 @@ def callsign_validator(cls, v: str) -> str: @model_validator(mode="before") @classmethod - def atis_validator(cls, data: dict[str, Any] | Any) -> Any: - if isinstance(data, dict) and "text_atis" in data: + def atis_validator(cls, data: dict[str, Any]) -> dict[str, Any]: + if "text_atis" in data: if data["text_atis"] is not None: if not isinstance(data["text_atis"], str): data["text_atis"] = "\n".join(cast(list[str], data["text_atis"]))