Return open function for path. gzip.open if suffixed with .gz, else open.
(path: Union[pathlib.Path, str])
| 802 | |
| 803 | |
| 804 | def get_open_fn(path: Union[pathlib.Path, str]) -> Callable: |
| 805 | """ |
| 806 | Return open function for path. gzip.open if suffixed with .gz, else open. |
| 807 | """ |
| 808 | path = pathlib.Path(path) |
| 809 | if path.suffix == ".gz": |
| 810 | return gzip.open |
| 811 | return open |
| 812 | |
| 813 | |
| 814 | def urlopen(url: str, auth_headers: dict[str, str]) -> http.client.HTTPResponse: |