Skip to content

Complete type annotations #342

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

Closed
wants to merge 14 commits into from
Closed
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
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
]


def pytest_configure():
def pytest_configure() -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be an awful lot of these and they don't add a lot of value. Is there a mypy option that would allow this to be the default annotation, saving all the noise?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No; for compatibility with untyped code, mypy needs to assume that a function without a type annotation is untyped, and treat its parameters and return values as Any.

remove_importlib_metadata()


def remove_importlib_metadata():
def remove_importlib_metadata() -> None:
"""
Because pytest imports importlib_metadata, the coverage
reports are broken (#322). So work around the issue by
Expand Down
14 changes: 7 additions & 7 deletions exercises.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
from pytest_perf.deco import extras


@extras('perf')
def discovery_perf():
@extras('perf') # type: ignore[misc]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see if it's possible to ignore this file altogether. This file has a special purpose and isn't integrated with any of the codebase. Is it possible to simply exclude it from the checks to avoid the noise?

def discovery_perf() -> None:
"discovery"
import importlib_metadata # end warmup

importlib_metadata.distribution('ipython')


def entry_points_perf():
def entry_points_perf() -> None:
"entry_points()"
import importlib_metadata # end warmup

importlib_metadata.entry_points()


@extras('perf')
def cached_distribution_perf():
@extras('perf') # type: ignore[misc]
def cached_distribution_perf() -> None:
"cached distribution"
import importlib_metadata

importlib_metadata.distribution('ipython') # end warmup
importlib_metadata.distribution('ipython')


@extras('perf')
def uncached_distribution_perf():
@extras('perf') # type: ignore[misc]
def uncached_distribution_perf() -> None:
"uncached distribution"
import importlib
import importlib_metadata
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy