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.

Pycharm incorrectly reports error when __init__ has been re-defined

See original GitHub issue

Describe the bug Pycharm incorrectly reports error when __init__ method has been re-defined

To Reproduce Steps to reproduce the behavior:

import pydantic


class MyModel(pydantic.BaseModel):
    int_field: int
    
    def __init__(self, x=1):
        super().__init__(int_field=x)


m = MyModel()

The final line is seen to be highlighted with the apparent error “parameter int_field” unfilled.

Yes I know this example I should use a default value for int_field, but more generally, it appears that the __init__ signature gets totally ignored on all subclasses of BaseModel.

Expected behavior If __init__ is re-defined, the new signature should be expected, and no error should be reported.

Environments (please complete the following information):

  • IDE: PyCharm Community 2021.1.1
  • OS: Windows 10
  • Pydantic Version: 1.8.1
  • Plugin version: 0.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
PhilReinholdcommented, May 25, 2021

Thanks again! It looks resolved to me, I appreciate the quick response!

0reactions
koxudaxicommented, May 25, 2021

@PhilReinhold The new version 0.3.3 has been released that is fixed the problem 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | PyCharm Documentation - JetBrains
This chapter provides the list of the known problem solutions and workarounds. ... Some import errors are reported in your PyQt code.
Read more >
Start Failed, Internal error: recovering IDE to the working state ...
There are multiple possible causes for this issue: broken or incompatible plug-in, corrupted IDE installation files, failed patch update, broken caches or ...
Read more >
PyCharm 181.4203.547 Release Notes | Knowledge Base
Feature PY‑20770 Support Python 3.6 asynchronous generators and comprehensions Feature PY‑21768 Semantic highlighting for Python Bug PY‑19573 Python console ‑ no output under OS X Bug...
Read more >
pycharm incorrectly stating: `function "__init__" cannot be async`
pycharm thinks that my code won't run and adds squigly red underlines to every file in the directory chain in project view.
Read more >
PyCharm 2020.1 Release Notes | Knowledge Base - YouTrack
No subsystem Bug PY‑39484 Code Insight Feature PY‑39499 Bug PY‑40738 Bug PY‑25838
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