Skip to content

Getting started: attrs not supported #146

@ayroblu

Description

@ayroblu

Hi, I wanted to try this out after mypy, but I don't understand some of the errors I'm getting.

First

This looks like an attr.s thing

  10:17 - error: Expected no arguments to 'Foo' constructor
  10:17 - error: 'dq.Foo(dq.Bar.Thing.value)' has type 'Type[Foo]' and is not callable

Declaration:

import attr
from enum import Enum

@attr.s(frozen=True)
class Foo:
    name: str = attr.ib()

class Bar(Enum):
    Thing = "Thing"

Usage:

    a=dq.Foo(dq.Bar.Thing.value),

Second

This looks like it doesn't like @classmethod? Or it's an attr.s thing again

  45:6 - error: Argument of type '(cls: Type[Bar], details: Dict[str, Any]) -> Rule' cannot be assigned to parameter 'f' of type 'function'
@attr.s(auto_attribs=True, frozen=True)
class Foo(Rule):
    @classmethod # this line
    def _deserialize(cls, details: Dict[str, Any]) -> Rule:
        pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions