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.

Pylint complaining `abstract-class-instantiated` because of type hint stunt for `init`

See original GitHub issue

Environment

How do you use Sentry? Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?) Saas

Which SDK and version? python-sdk v1.0.0 in Python 3.9

Steps to Reproduce

In my code, I call

sentry_sdk.init(dsn=os.getenv('SENTRY_DSN')

I use pylint that just released a version 2.7.4 to statically check my code for lint errors

Expected Result

No lint error found (that was the case three weeks ago)

Actual Result

I get this pylint error

E0110: Abstract class 'init' with abstract methods instantiated (abstract-class-instantiated)

I believe this is due to the stunt to have nicer autocompletion that is now detected by pylint.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:19
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
mike-hartcommented, Apr 27, 2022

mypy 0.950 now also shows an error for this: error: Cannot instantiate abstract class "init" with abstract attribute "__exit__"

1reaction
belm0commented, Jun 7, 2021

isn’t the fix straightforward?

if MYPY:
    class _MyContextManager(ContextManager[Any]):
        def __exit__(self, exc_type, exc_value, traceback):
            pass

    class init(ClientConstructor, _MyContextManager):  # noqa: N801
        pass

Read more comments on GitHub >

github_iconTop Results From Across the Web

abstract-class-instantiated / E0110 - Pylint 2.16.0-dev ...
Used when an abstract class with `abc.ABCMeta` as metaclass has abstract methods and is instantiated. Problematic code: import abc class Animal(abc.
Read more >
Pylint W0223: Method ... is abstract in class ... but is not ...
For some reason pylint think the class isn't abstract (currenly detection is done by checking for method which raise NotImplementedError).
Read more >
E0110 (abstract-class-instantiated) | pylint-errors - GitHub Pages
Rationale: Used when an abstract class with abc. ABCMeta or abc. ABC as metaclass has abstract methods and is instantiated.
Read more >
Untitled
The primary use is for navigational items (nav bars, menus, etc), but it works well wherever small type is needed. In order to...
Read more >
2012-February.txt - Python mailing list
Using metaclass to generate a class for each register also doesn't feel good, because you still need to instantiate them *once again* to...
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