You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a general Python question than specific to Yamale, I guess.
PyLance complains about how Yamale implements the tag attribute on validators.
classSomeValidator(Validator):
tag="some_validator"def_is_valid(self, value):
ifvalue:
returnTruereturnFalsedeffail(self, value):
returnf"Value '{value}' is not valid."
Expression of type "Literal['some_validator']" cannot be assigned to declared type "property" "Literal['some_validator']" is incompatible with "property"
The validator works of course, as this is how the tags are implemented by default.
Is there a reason as to why tag was implemented as a property instead of as a class attribute (which PyLance does not complain about)? E.g
classValidator(object):
"""Base class for all Validators"""constraints= []
value_type=Nonedef__init__(self, *args, **kwargs):
self.args=argsself.kwargs=kwargsself.tag=self.__class__
...
The text was updated successfully, but these errors were encountered:
This is more of a general Python question than specific to Yamale, I guess.
PyLance complains about how Yamale implements the
tag
attribute on validators.Expression of type "Literal['some_validator']" cannot be assigned to declared type "property" "Literal['some_validator']" is incompatible with "property"
The validator works of course, as this is how the tags are implemented by default.
Is there a reason as to why
tag
was implemented as a property instead of as a class attribute (which PyLance does not complain about)? E.gThe text was updated successfully, but these errors were encountered: