question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@responses.activate triggers untyped decorator error in mypy

See original GitHub issue

Environment

responses==0.17.0 mypy==0.931 Python 3.8.12

disallow_untyped_decorators = True in mypy.ini

Steps to Reproduce

After upgrade to responses==0.17.0, reran mypy with settings unchanged from before.

Expected Result

mypy passes as happened with responses==0.16.0

Actual Result

Every instance of @responses.activate throws up:

error: Untyped decorator makes function "<function_name>" untyped  [misc]
    @responses.activate

The issue seems to be related to the change here where the type hint for activate was changed from a callback protocol to Any.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
markstorycommented, Jan 12, 2022

any idea why disallow_untyped_decorators did not raise on our side?

It looks like that check has been disabled in this project’s mypy.ini. I can work on merging our stubs with the implementation and removing some of the disabled warnings.

0reactions
beliaev-maksimcommented, Jan 12, 2022

@markstory any idea why disallow_untyped_decorators did not raise on our side?

any test we can add to prevent this in the future?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mypy: Untyped decorator makes function "my_method" untyped
The mypy documentation contains the section describing the declaration of decorators for functions with an arbitrary signature.
Read more >
Mypy Documentation - Read the Docs
Mypy is a static type checker for Python. Type checkers help ensure that you're using variables and functions in your code correctly.
Read more >
mypy-django/Lobby - Gitter
I'm getting error: "Parent" has no attribute "children". Nikita Sobolev ... Request, *args: Any, **kwargs: Any) -> Response: # type: ignore[override].
Read more >
2017 - The Mypy Blog
We've just uploaded mypy 0.560 to the Python Package Index (PyPI). This release includes new features, bug fixes and library stub (typeshed) ...
Read more >
Understanding type annotation in Python - LogRocket Blog
It will focus on the mypy static type-checking tool and its operations in ... int x = 4; x = "hello"; // this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found