Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow load_icgem_gdf to take open file objects (#155)
Previously just assumed `fname` was a string and called `open` on it. Now, check if it's a file-like object (has a `read` method) and don't open it if that's the case. Use `contextlib` to keep the `with` statement in case we do have to open the file. This is useful if the file is compressed and can be opened with `bz2.open`, `gzip.open`, etc before passing on to the function.
- Loading branch information