(thefile: str)
| 4 | |
| 5 | |
| 6 | def which(thefile: str) -> Optional[str]: |
| 7 | path = os.environ.get("PATH", os.defpath).split(os.pathsep) |
| 8 | for d in path: |
| 9 | fname = os.path.join(d, thefile) |
| 10 | fnames = [fname] |
| 11 | if sys.platform == "win32": |
| 12 | exts = os.environ.get("PATHEXT", "").split(os.pathsep) |
| 13 | fnames += [fname + ext for ext in exts] |
| 14 | for name in fnames: |
| 15 | if os.access(name, os.F_OK | os.X_OK) and not os.path.isdir(name): |
| 16 | return name |
| 17 | return None |
no test coverage detected
searching dependent graphs…