8000 Replace attrs with dataclasses by dmtucker · Pull Request #173 · realpython/pytest-mypy · GitHub
[go: up one dir, main page]

Skip to content

Replace attrs with dataclasses #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2024
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
Replace attrs with dataclasses
  • Loading branch information
dmtucker committed Aug 24, 2024
commit 63102ec8b897e15b0c07f40e74e753c81f7cc593
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ classifiers = [
]
requires-python = ">=3.7"
dependencies = [
"attrs>=19.0",
"filelock>=3.0",
"mypy>=1.0",
"pytest>=7.0",
Expand Down
16 changes: 8 additions & 8 deletions src/pytest_mypy.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Mypy static type checker plugin for Pytest"""

from dataclasses import dataclass
import json
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import Dict, List, Optional, TextIO
import warnings

import attr
from filelock import FileLock # type: ignore
import mypy.api
import pytest
Expand Down Expand Up @@ -197,18 +197,18 @@ def runtest(self):
raise MypyError(f"mypy exited with status {results.status}.")


@attr.s(frozen=True, kw_only=True)
@dataclass(frozen=True) # compat python < 3.10 (kw_only=True)
class MypyResults:
"""Parsed results from Mypy."""

_abspath_errors_type = Dict[str, List[str]]

opts = attr.ib(type=List[str])
stdout = attr.ib(type=str)
stderr = attr.ib(type=str)
status = attr.ib(type=int)
abspath_errors = attr.ib(type=_abspath_errors_type)
unmatched_stdout = attr.ib(type=str)
opts: List[str]
stdout: str
stderr: str
status: int
abspath_errors: _abspath_errors_type
unmatched_stdout: str

def dump(self, results_f: TextIO) -> None:
"""Cache results in a format that can be parsed by load()."""
Expand Down
Loading
0