(url : AnyStr)
| 32 | return urlparse(url).scheme == "file" |
| 33 | |
| 34 | def file_uri_to_path(url : AnyStr) -> AnyStr: |
| 35 | file_uri = urlparse(url) |
| 36 | file_path = file_uri.path |
| 37 | |
| 38 | # URI is something like "file://~/..." |
| 39 | if file_uri.netloc == '~': |
| 40 | file_path = f'~{file_uri.path}' |
| 41 | return os.path.expanduser(file_path) |
| 42 | |
| 43 | return file_path |
| 44 | |
| 45 | def is_executable(fpath: AnyStr) -> bool: |
| 46 | return fpath is not None and os.path.isfile(fpath) and os.access(fpath, os.X_OK) |