Return the content at `url` as text. Return the content as bytes is `as_text` is False.
(path, as_text=True)
| 1887 | |
| 1888 | |
| 1889 | def get_local_file_content(path, as_text=True): |
| 1890 | """ |
| 1891 | Return the content at `url` as text. Return the content as bytes is |
| 1892 | `as_text` is False. |
| 1893 | """ |
| 1894 | if path.startswith("file://"): |
| 1895 | path = path[7:] |
| 1896 | |
| 1897 | mode = "r" if as_text else "rb" |
| 1898 | with open(path, mode) as fo: |
| 1899 | return fo.read() |
| 1900 | |
| 1901 | |
| 1902 | class RemoteNotFetchedException(Exception): |
no test coverage detected