Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v5
- uses: extractions/setup-just@v3
Expand Down
7 changes: 4 additions & 3 deletions auto_typing_final/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ def _find_identifiers_made_by_node(node: SgNode) -> Iterable[SgNode]: # noqa: C
yield from _find_identifiers_in_import_statement(node)
case "as_pattern":
match tuple((child.kind(), child) for child in node.children()):
case (
(("identifier", _), ("as", _), ("as_pattern_target", alias))
| (("case_pattern", _), ("as", _), ("identifier", alias))
case (("identifier", _), ("as", _), ("as_pattern_target", alias)) | (
("case_pattern", _),
("as", _),
("identifier", alias),
):
yield alias
case "keyword_pattern":
Expand Down
2 changes: 1 addition & 1 deletion auto_typing_final/lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def code_action(ls: CustomLanguageServer, params: lsp.CodeActionParams) -> list[
@LSP_SERVER.feature(lsp.CODE_ACTION_RESOLVE)
def resolve_code_action(ls: CustomLanguageServer, params: lsp.CodeAction) -> lsp.CodeAction:
if ls.service:
text_document: Final = ls.workspace.get_text_document(cast(str, params.data))
text_document: Final = ls.workspace.get_text_document(cast("str", params.data))
params.edit = lsp.WorkspaceEdit(
document_changes=[
lsp.TextDocumentEdit(
Expand Down
2 changes: 1 addition & 1 deletion auto_typing_final/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main() -> int:
file.write(transformed_content)
file.truncate()

match changed_files_count, cast(bool, args.check):
match changed_files_count, cast("bool", args.check):
case 0, _:
result_message = "No errors found!"
case 1, True:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "auto-typing-final"
description = "Automagically set typing.Final inside your functions"
authors = [{ name = "Lev Vereshchagin", email = "mail@vrslev.com" }]
dependencies = ["ast-grep-py==0.39.5", "pygls==1.3.1"]
dependencies = ["ast-grep-py==0.39.6", "pygls==1.3.1"]
requires-python = ">=3.10"
readme = "README.md"
license = { text = "MIT" }
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

@pytest.fixture(params=IMPORT_STYLES_TO_IMPORT_CONFIGS.values())
def import_config(request: pytest.FixtureRequest) -> ImportConfig:
return typing.cast(ImportConfig, request.param)
return typing.cast("ImportConfig", request.param)


@pytest.fixture(params=[True, False])
def ignore_global_vars(request: pytest.FixtureRequest) -> bool:
return typing.cast(bool, request.param)
return typing.cast("bool", request.param)


def parse_md_test_cases(file_name: str) -> list[str]:
Expand Down