diff --git a/docs/conf.py b/docs/conf.py index 009c886..7d81290 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,6 +2,7 @@ https://www.sphinx-doc.org/en/master/usage/configuration.html """ + from termux_language_server import __version__ as version # type: ignore from termux_language_server._metainfo import ( # type: ignore author, diff --git a/src/termux_language_server/__init__.py b/src/termux_language_server/__init__.py index 75a4216..bfd559c 100644 --- a/src/termux_language_server/__init__.py +++ b/src/termux_language_server/__init__.py @@ -1,6 +1,7 @@ r"""Provide ``__version__`` for `importlib.metadata.version() `_. """ + from typing import Literal try: diff --git a/src/termux_language_server/__main__.py b/src/termux_language_server/__main__.py index 063f7fe..5b65e56 100644 --- a/src/termux_language_server/__main__.py +++ b/src/termux_language_server/__main__.py @@ -1,6 +1,7 @@ r"""This module can be called by `python -m `_. """ + from argparse import ArgumentParser, RawDescriptionHelpFormatter from contextlib import suppress from datetime import datetime diff --git a/src/termux_language_server/finders.py b/src/termux_language_server/finders.py index be35b0c..15c5a27 100644 --- a/src/termux_language_server/finders.py +++ b/src/termux_language_server/finders.py @@ -1,6 +1,7 @@ r"""Finders =========== """ + from copy import deepcopy from dataclasses import dataclass diff --git a/src/termux_language_server/misc/__init__.py b/src/termux_language_server/misc/__init__.py index 6a09d40..6b74d27 100644 --- a/src/termux_language_server/misc/__init__.py +++ b/src/termux_language_server/misc/__init__.py @@ -1,6 +1,7 @@ r"""Misc ======== """ + from typing import Any from .. import FILETYPE diff --git a/src/termux_language_server/misc/color_map.py b/src/termux_language_server/misc/color_map.py index b944992..2182fe6 100644 --- a/src/termux_language_server/misc/color_map.py +++ b/src/termux_language_server/misc/color_map.py @@ -1,6 +1,7 @@ r"""Portage's color.map ======================= """ + from typing import Any from tree_sitter_lsp.misc import get_soup diff --git a/src/termux_language_server/misc/ebuild.py b/src/termux_language_server/misc/ebuild.py index 7a3870e..051d5c8 100644 --- a/src/termux_language_server/misc/ebuild.py +++ b/src/termux_language_server/misc/ebuild.py @@ -1,6 +1,7 @@ r"""Portage's ebuild ==================== """ + from typing import Any from tree_sitter_lsp.misc import get_soup diff --git a/src/termux_language_server/misc/licenses.py b/src/termux_language_server/misc/licenses.py index 8078c78..24f72bd 100644 --- a/src/termux_language_server/misc/licenses.py +++ b/src/termux_language_server/misc/licenses.py @@ -1,6 +1,7 @@ r"""Licenses ============ """ + from license_expression import get_license_index LICENSES = [ diff --git a/src/termux_language_server/misc/make_conf.py b/src/termux_language_server/misc/make_conf.py index dda22fe..22baedb 100644 --- a/src/termux_language_server/misc/make_conf.py +++ b/src/termux_language_server/misc/make_conf.py @@ -1,6 +1,7 @@ r"""Portage's make.conf ======================= """ + from typing import Any from tree_sitter_lsp.misc import get_soup diff --git a/src/termux_language_server/misc/makepkg_conf.py b/src/termux_language_server/misc/makepkg_conf.py index 43af06b..8c34e93 100644 --- a/src/termux_language_server/misc/makepkg_conf.py +++ b/src/termux_language_server/misc/makepkg_conf.py @@ -1,6 +1,7 @@ r"""makepkg.conf ================ """ + from typing import Any from tree_sitter_lsp.misc import get_soup diff --git a/src/termux_language_server/misc/pkgbuild.py b/src/termux_language_server/misc/pkgbuild.py index 4204394..f1f603b 100644 --- a/src/termux_language_server/misc/pkgbuild.py +++ b/src/termux_language_server/misc/pkgbuild.py @@ -1,6 +1,7 @@ r"""PKGBUILD ============ """ + import os from typing import Any diff --git a/src/termux_language_server/misc/termux.py b/src/termux_language_server/misc/termux.py index 54e13ad..e2b9628 100644 --- a/src/termux_language_server/misc/termux.py +++ b/src/termux_language_server/misc/termux.py @@ -1,6 +1,7 @@ r"""Termux ========== """ + from typing import Any from tree_sitter_lsp.misc import get_soup @@ -137,11 +138,9 @@ def init_schema() -> dict[str, dict[str, Any]]: } schemas["build.sh"]["propertyNames"]["not"]["anyOf"] += [obj] - schemas["build.sh"]["properties"]["TERMUX_PKG_HOMEPAGE"][ - "format" - ] = schemas["build.sh"]["properties"]["TERMUX_PKG_SRCURL"][ - "format" - ] = "uri" + schemas["build.sh"]["properties"]["TERMUX_PKG_HOMEPAGE"]["format"] = ( + schemas["build.sh"]["properties"]["TERMUX_PKG_SRCURL"]["format"] + ) = "uri" schemas["build.sh"]["properties"]["TERMUX_PKG_MAINTAINER"][ "default" ] = "@termux" diff --git a/src/termux_language_server/packages/__init__.py b/src/termux_language_server/packages/__init__.py index bedae70..bdc924f 100644 --- a/src/termux_language_server/packages/__init__.py +++ b/src/termux_language_server/packages/__init__.py @@ -1,6 +1,7 @@ r"""Packages ============ """ + from .. import FILETYPE PACKAGE_VARIABLES = { diff --git a/src/termux_language_server/packages/pkgbuild.py b/src/termux_language_server/packages/pkgbuild.py index b65cacf..3e750af 100644 --- a/src/termux_language_server/packages/pkgbuild.py +++ b/src/termux_language_server/packages/pkgbuild.py @@ -1,6 +1,7 @@ r"""PKGBUILD packages ===================== """ + from pathlib import Path from jinja2 import Template diff --git a/src/termux_language_server/schema.py b/src/termux_language_server/schema.py index 40a79b8..66b92b6 100644 --- a/src/termux_language_server/schema.py +++ b/src/termux_language_server/schema.py @@ -1,6 +1,7 @@ r"""Schema ========== """ + from dataclasses import dataclass from typing import Literal diff --git a/src/termux_language_server/server.py b/src/termux_language_server/server.py index 31d8419..bf3418a 100644 --- a/src/termux_language_server/server.py +++ b/src/termux_language_server/server.py @@ -1,6 +1,7 @@ r"""Server ========== """ + import re from typing import Any @@ -263,11 +264,15 @@ def completions(params: CompletionParams) -> CompletionList: [ CompletionItem( k, - kind=CompletionItemKind.Function - if v.get("const") == 0 - else CompletionItemKind.Field - if v.get("type") == "array" - else CompletionItemKind.Variable, + kind=( + CompletionItemKind.Function + if v.get("const") == 0 + else ( + CompletionItemKind.Field + if v.get("type") == "array" + else CompletionItemKind.Variable + ) + ), documentation=MarkupContent( MarkupKind.Markdown, v["description"] ), diff --git a/src/termux_language_server/tools/namcap.py b/src/termux_language_server/tools/namcap.py index 47b7ea3..bbe94e1 100644 --- a/src/termux_language_server/tools/namcap.py +++ b/src/termux_language_server/tools/namcap.py @@ -1,6 +1,7 @@ r"""Namcap ========== """ + from lsprotocol.types import Diagnostic, DiagnosticSeverity, Position, Range diff --git a/src/termux_language_server/utils.py b/src/termux_language_server/utils.py index 828c57d..e3ca619 100644 --- a/src/termux_language_server/utils.py +++ b/src/termux_language_server/utils.py @@ -1,6 +1,7 @@ r"""Utils ========= """ + import json import os from typing import Any, Literal diff --git a/tests/test_schema.py b/tests/test_schema.py index 6267e46..5cad765 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -1,4 +1,5 @@ r"""Test schema.""" + import os from tree_sitter_languages import get_parser diff --git a/tests/test_utils.py b/tests/test_utils.py index dbb907f..fd88b8c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ r"""Test utils.""" + from termux_language_server.utils import get_schema