I'm creating a dataclass in 3.8.8 to store result from REST API call, and one of its attributes is used to store HTTP response status:
from dataclasses import dataclass
from http import HTTPStatus
@dataclass
class APICallResult:
response_text: str
http_status: HTTPStatus
When I try to create an object of this class as below:
result = APICallResult('foo', HTTPStatus.OK)
PyCharm 2020.3.3 just flags HTTPStatus.OK with error:
Expected type 'HTTPStatus', got 'int' instead`.
Now I wonder what's the proper type hint for IntEnum in this case? I think Literal might be an awkward option here.