Skip to content

[mypy] Fix has no attribute errors

  • Rewrite IConstraint as a Protocol
  • For this protocol, define the attributes expression, operator, boundary

And fix the following errors:

  • yams/diff.py:145: error: "IConstraint" has no attribute "expression"
  • yams/diff.py:153: error: "IConstraint" has no attribute "operator"
  • yams/diff.py:153: error: "IConstraint" has no attribute "boundary"

I've written IConstraint as this:

class IConstraint(Protocol):
    """Represents a constraint on a relation."""

    expression: Any
    operator: Any
    boundary: Any

That is of course a quick fix, I will probably come back and add specific annotations for expression, operator & boundary attributes.

Merge request reports

Loading