Argument corresponds to parameter "o" in function "__new__"PylancereportUnknownArgumentType```
This is the error i get when I use the PositiveValidator descriptor like this:
```py
class ABCValidator[T](metaclass=ABCMeta):
def __init__(self, default: T | None = None):
self._default = default
def __set_name__(self, owner: Type, name: str):
self.name = name
self.private = "_" + name
def __get__(self, obj: object, obj_type: Type[T]):
return cast(T, getattr(obj, self.private, self._default))
@abstractmethod
def __set__(self, obj: object, value: T):
setattr(obj, self.private, value)
class PositiveValidator[T: float | int](ABCValidator):
def __set__(self, obj: object, value: T):
if value < 0:
raise ValueError(f"{self.name!r} must be a positive number")
setattr(obj, self.private, value)
But when I modify the PositiveValidator, there's no longer a typing error from pylance.
type T = int | float
class PositiveValidator[T]:
def __bytes__(self):
return bytes(str(self.value), 'utf-8')
Who can explain what is the difference between the two versions?
And why does one work and the other doesn't?