[mypy] Fix error: "type" has no attribute "type"
Error:
yams/constraints.py:461: error: "type" has no attribute "type" BoundConstraint.type = lambda x: "BoundaryConstraint"
Fix:
Add a method named "type" inside the BoundaryConstraint class. This method should explicitely return the string "BoundaryConstraint". Finally, remove the dynamically added type attribute.
Check:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/ubuntu/yams/yams/constraints.py(464)<module>()
-> _("value %(KEY-value)s must be < %(KEY-boundary)s")
(Pdb) l
459
460 BoundConstraint = class_renamed("BoundConstraint", BoundaryConstraint)
461
462 breakpoint()
463
464 -> _("value %(KEY-value)s must be < %(KEY-boundary)s")
465 _("value %(KEY-value)s must be > %(KEY-boundary)s")
466 _("value %(KEY-value)s must be <= %(KEY-boundary)s")
467 _("value %(KEY-value)s must be >= %(KEY-boundary)s")
468
469
(Pdb) foo = BoundConstraint("<=")
(Pdb) foo.type()
'BoundaryConstraint'
(Pdb)