(binary: Optional[str])
| 861 | return shutil.which(str(Path(binary).expanduser())) or shutil.which(str(binary)) or binary |
| 862 | |
| 863 | def bin_hash(binary: Optional[str]) -> Optional[str]: |
| 864 | if binary is None: |
| 865 | return None |
| 866 | abs_path = bin_path(binary) |
| 867 | if abs_path is None or not Path(abs_path).exists(): |
| 868 | return None |
| 869 | |
| 870 | file_hash = md5() |
| 871 | with io.open(abs_path, mode='rb') as f: |
| 872 | for chunk in iter(lambda: f.read(io.DEFAULT_BUFFER_SIZE), b''): |
| 873 | file_hash.update(chunk) |
| 874 | |
| 875 | return f'md5:{file_hash.hexdigest()}' |
| 876 | |
| 877 | def find_chrome_binary() -> Optional[str]: |
| 878 | """find any installed chrome binaries in the default locations""" |
no test coverage detected