Skip to content
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

DNM: Test dataclasses.field assignments in stubs #13415

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 6 additions & 5 deletions stdlib/pstats.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import StrOrBytesPath
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Iterable
from cProfile import Profile as _cProfile
from profile import Profile
Expand Down Expand Up @@ -43,17 +43,18 @@
TIME = "time"

if sys.version_info >= (3, 9):
from dataclasses import dataclass
from dataclasses import dataclass, field

# ruff: noqa: PYI015
@dataclass(unsafe_hash=True)
class FunctionProfile:
ncalls: str
tottime: float
percall_tottime: float
cumtime: float
percall_cumtime: float
file_name: str
line_number: int
percall_cumtime: float = field(default=2) # noqa: Y015
file_name: str = field(default_factory=Incomplete) # noqa: Y015

Check failure on line 56 in stdlib/pstats.pyi

View workflow job for this annotation

GitHub Actions / Test typeshed with pyright (Linux, 3.12)

Type "Any" is not assignable to declared type "str"   "Any" is not assignable to "str" (reportAssignmentType)
line_number: int = field(kw_only=True) # noqa: Y015

@dataclass(unsafe_hash=True)
class StatsProfile:
Expand Down
Loading