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 platform 

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' 

12 

13 

14if platform.system() == 'Windows': # pragma: no cover 

15 import subprocess 

16 

17 def get_startupinfo() -> subprocess.STARTUPINFO: # pytype: disable=module-attr 

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

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

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

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

22 return startupinfo