I'm wondering if there's a way to validate type hints more strictly. For instance I had a bug in the following function, it returns None in one of the branches. This should be an error because of type hint, but PyCharm doesn't detect it
def ossystem(cmd, shell=True) -> str:
"""Like os.system, but returns output of command as string."""
p = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE,
(stdout, stderr) = p.communicate()