Skip to content

module has no attribute error on 'attrs' module. #10084

@chrisbeardy

Description

@chrisbeardy

I have the following in an attrs decorated class:

import attr

@attr.s
class test:
    test_mode: Union[str, int] = attr.ib(
        init=False,
        default=0,
        converter=test_mode_to_string,
        on_setattr=attr.setters.convert,
    )

mypy is giving me the following error:

image

I am not expecting this to be an error as the attr.setters.convert does exist.

  • Mypy version used: 0.800
  • Mypy configuration options from mypy.ini (and other config files):
  • mypi.ini
check_untyped_defs = True
pretty = True
show_column_numbers = True
show_error_codes = True
show_error_context = True
strict_equality = True
warn_redundant_casts = True
warn_return_any = True
warn_unreachable = True
warn_unused_configs = True
warn_unused_ignores = True
allow_untyped_globals = True
  • Python version used: 3.6
  • Operating system and version: Windows 10

Using attrs: 20.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions