Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/graphviz/_compat.py: 80%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

5 statements  

1"""Platform compatibility.""" 

2 

3import sys 

4 

5 

6def get_startupinfo() -> None: 

7 """Return None for startupinfo argument of ``subprocess.Popen``.""" 

8 return None 

9 

10 

11assert get_startupinfo() is None, 'get_startupinfo() defaults to a no-op' # type: ignore[func-returns-value] # noqa: E501 

12 

13 

14# avoid platform.system() to work around https://github.com/python/mypy/issues/8166 

15if sys.platform == 'win32' or sys.platform == 'cygwin' or sys.platform == 'msys': # pragma: no cover # noqa: E501 

16 import subprocess 

17 

18 def get_startupinfo() -> subprocess.STARTUPINFO: # type: ignore[misc] # noqa: E501 

19 """Return subprocess.STARTUPINFO instance hiding the console window.""" 

20 startupinfo = subprocess.STARTUPINFO() # pytype: disable=module-attr 

21 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # pytype: disable=module-attr 

22 startupinfo.wShowWindow = subprocess.SW_HIDE # pytype: disable=module-attr 

23 return startupinfo