Skip to content

Commit

Permalink
update mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Mar 21, 2024
1 parent 624d9a9 commit 4bdf6be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions deal/_runtime/_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def pre(
exception=exception or _exceptions.PreContractError,
)
func = partial(Contracts.attach, 'pres', contract)
return func # type: ignore[return-value]
return func


def post(
Expand Down Expand Up @@ -107,7 +107,7 @@ def post(
exception=exception or _exceptions.PostContractError,
)
func = partial(Contracts.attach, 'posts', contract)
return func # type: ignore[return-value]
return func


def ensure(
Expand Down Expand Up @@ -155,7 +155,7 @@ def ensure(
exception=exception or _exceptions.PostContractError,
)
func = partial(Contracts.attach, 'ensures', contract)
return func # type: ignore[return-value]
return func


def raises(
Expand Down Expand Up @@ -204,7 +204,7 @@ def raises(
exception=exception or _exceptions.RaisesContractError,
)
func = partial(Contracts.attach, 'raises', contract)
return func # type: ignore[return-value]
return func


def has(
Expand Down Expand Up @@ -248,7 +248,7 @@ def has(
exception=exception,
)
func = partial(Contracts.attach_has, patcher)
return func # type: ignore[return-value]
return func


def reason(
Expand Down Expand Up @@ -303,7 +303,7 @@ def reason(
exception=exception or _exceptions.ReasonContractError,
)
func = partial(Contracts.attach, 'reasons', contract)
return func # type: ignore[return-value]
return func


def inv(
Expand Down Expand Up @@ -394,7 +394,7 @@ def example(validator: Callable[[], bool]) -> Callable[[C], C]:
exception=_exceptions.ExampleContractError,
)
func = partial(Contracts.attach, 'examples', contract)
return func # type: ignore[return-value]
return func


@overload
Expand Down
4 changes: 2 additions & 2 deletions deal/_runtime/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@


if TYPE_CHECKING:
Args = tuple[object, ...] # type: ignore[misc]
Kwargs = dict[str, object] # type: ignore[misc]
Args = tuple[object, ...]
Kwargs = dict[str, object]


@lru_cache(maxsize=16)
Expand Down
2 changes: 2 additions & 0 deletions deal/_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def _collect_trace_results(t: Trace, func, file_name: str, func_result) -> Trace
last_line = max(all_lines)

covered_lines: set[int] = set()
fname: str
lineno: int
for fname, lineno in t.counts: # type: ignore
assert fname == file_name
if lineno < first_line:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ has-astroid = "not is_installed('astroid')"

[tool.mypy]
files = ["deal"]
python_version = 3.8
python_version = "3.9"
plugins = ["deal.mypy"]
ignore_missing_imports = true
show_error_codes = true
Expand Down

0 comments on commit 4bdf6be

Please sign in to comment.