Skip to content

Commit

Permalink
Replace attrs with dataclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtucker committed Aug 24, 2024
1 parent bf700d9 commit 63102ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
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

0 comments on commit 63102ec

Please sign in to comment.