From 029b5630e69eb720c3d9efd33d43d75f0bb1f361 Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Sun, 26 Oct 2025 13:48:53 +0300 Subject: [PATCH 1/2] refactor: changes pyright check mode to standard. --- Makefile | 2 +- pyproject.toml | 2 +- src/codeplag/codeplagcli.py | 9 +++++---- src/codeplag/types.py | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index df25c52..3d5f39e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -UTIL_VERSION := 0.5.26 +UTIL_VERSION := 0.5.27 UTIL_NAME := codeplag PWD := $(shell pwd) diff --git a/pyproject.toml b/pyproject.toml index 92ff297..cb26497 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ executionEnvironments = [ { root = "docs/notebooks", extraPaths = ["src"] } ] -typeCheckingMode = "basic" +typeCheckingMode = "standard" [build-system] requires = ["setuptools", "Cython"] diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index 1c4b999..9c06d0f 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -6,6 +6,7 @@ import builtins import getpass from pathlib import Path +from typing import Sequence from typing_extensions import Self @@ -34,11 +35,11 @@ class CheckUniqueStore(argparse.Action): """Checks that the list of arguments contains no duplicates, then stores.""" - def __call__( + def __call__( # pyright: ignore[reportIncompatibleMethodOverride] self: Self, _parser: argparse.ArgumentParser, namespace: argparse.Namespace, - values: list[str], + values: Sequence[str], _option_string: str | None = None, ) -> None: if len(values) > len(set(values)): @@ -53,7 +54,7 @@ def __call__( class PasswordPromptAction(argparse.Action): - def __call__( + def __call__( # pyright: ignore[reportIncompatibleMethodOverride] self: Self, _parser: argparse.ArgumentParser, namespace: argparse.Namespace, @@ -474,7 +475,7 @@ def validate_args(self: Self, parsed_args: argparse.Namespace) -> None: ): self.error(_("All paths must be provided.")) - def parse_args(self: Self, args: list[str] | None = None) -> argparse.Namespace: + def parse_args(self: Self, args: Sequence[str] | None = None) -> argparse.Namespace: # pyright: ignore[reportIncompatibleMethodOverride] parsed_args = super(CodeplagCLI, self).parse_args(args) self.validate_args(parsed_args) return parsed_args diff --git a/src/codeplag/types.py b/src/codeplag/types.py index 7e6a425..89d7e0a 100644 --- a/src/codeplag/types.py +++ b/src/codeplag/types.py @@ -95,14 +95,14 @@ def __post_init__(self: Self) -> None: else: self.modify_date = "" - def __eq__(self: Self, other: "ASTFeatures") -> bool: + def __eq__(self: Self, other: object) -> bool: if not isinstance(other, self.__class__): - raise NotImplementedError + raise NotImplementedError(f"Can't compare '{type(other)}' with '{ASTFeatures}'.") return str(self.filepath) == str(other.filepath) - def __lt__(self: Self, other: "ASTFeatures") -> bool: + def __lt__(self: Self, other: object) -> bool: if not isinstance(other, self.__class__): - raise NotImplementedError + raise NotImplementedError(f"Can't compare '{type(other)}' with '{ASTFeatures}'.") return str(self.filepath) < str(other.filepath) def get_sha256(self: Self) -> str: From 77d0e39b2fadf771c60b955dd1fb6c32c32bb46d Mon Sep 17 00:00:00 2001 From: Artanias <43622365+Artanias@users.noreply.github.com> Date: Sun, 26 Oct 2025 14:08:29 +0300 Subject: [PATCH 2/2] fix: pre-commit format. --- src/codeplag/codeplagcli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index 9c06d0f..85e7726 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -35,7 +35,7 @@ class CheckUniqueStore(argparse.Action): """Checks that the list of arguments contains no duplicates, then stores.""" - def __call__( # pyright: ignore[reportIncompatibleMethodOverride] + def __call__( # pyright: ignore[reportIncompatibleMethodOverride] self: Self, _parser: argparse.ArgumentParser, namespace: argparse.Namespace, @@ -54,7 +54,7 @@ def __call__( # pyright: ignore[reportIncompatibleMethodOverride] class PasswordPromptAction(argparse.Action): - def __call__( # pyright: ignore[reportIncompatibleMethodOverride] + def __call__( # pyright: ignore[reportIncompatibleMethodOverride] self: Self, _parser: argparse.ArgumentParser, namespace: argparse.Namespace,