I am using subprocess.CompletedProcess as a return type of a function. When running mypy with --strict, it complains about Missing type parameters for generic type "CompletedProcess". This is a short example for which the problem occurs:
import subprocess
def run_command() -> subprocess.CompletedProcess:
return subprocess.CompletedProcess(args=[], returncode=0, stdout='')
I do not understand how CompletedProcess is a generic. I checked the reference (https://docs.python.org/3.9/library/subprocess.html#subprocess.CompletedProcess) and can't find any mention.
Randomly adding a generic parameter, for example -> subprocess.CompletedProcess[str], removes the error, but obviously that's not the point. I'd like to be able to hint the return type without defining a generic parameter.
I am using python 3.8.5 and mypy 0.761 and 0.910 (both give the same output).