17 lines
584 B
Plaintext
17 lines
584 B
Plaintext
=== on 12 May 2021, 00:45:18 Mike Heyns wrote:
|
|
This rule does not appear to be working for https://docs.python.org/3/library/dataclasses.html#init-only-variables[Dataclass Init-Only variables]:
|
|
|
|
|
|
----
|
|
@dataclass
|
|
class Book:
|
|
name: str
|
|
condition: InitVar[str] = ''
|
|
----
|
|
|
|
____Assign to "condition" a value of type "InitVar[str]" instead of "str" or update its type hint.____
|
|
|
|
|
|
In fact, most examples including the official documentation use ``++None++`` as the default for init-only arguments. Attempting to use ``++InitVar[Optional[str]]++`` has the same effect as above.
|
|
|