7

Pycharm is complaining about an unexpected argument to MyClass instance. Is there a way around this?

import attr

@attr.s
class _Super:
    """ My Super class"""
    x: str = attr.ib(validator=attr.validators.instance_of(str))

@attr.s
class MyClass(_Super):
    """ My Sub class"""
    y:str = attr.ib(validator=attr.validators.instance_of(str))

x = MyClass(x="a", y="b")  # (x variable) Pycharm Typehint: "Unexpected argument"
GlaceCelery
  • 921
  • 1
  • 13
  • 30
  • It would be helpful to know what your PyCharm version is and the output of a `pip freeze` command couldn't be bad, no? – colidyre Sep 25 '18 at 22:57
  • Which python version (interpreter) are you using? I cannot reproduce your problem with PyCharm 2018.2 and also not with PyCharm 2018.1 (although [attrs support](https://www.jetbrains.com/pycharm/whatsnew/#toc-2018-2) is only available in 2018.2 and higher) – colidyre Sep 25 '18 at 23:22
  • I am using Python 3.6, Pycharm 2018.2 and attrs 18.1.0 (SO won't let me paste the entire pip freeze) – GlaceCelery Sep 27 '18 at 08:05

1 Answers1

2

This is a bug in PyCharm 2018.2

https://youtrack.jetbrains.com/issue/PY-28506

Marcel Wilson
  • 3,842
  • 1
  • 26
  • 55