Provides a common file-like interface for remote and local files. This will be needed for parsing tasks requiring access to contents of specific files (e.g. license matching).
This PR does the following:
Implement a file-like interface for remote and local files
Add placeholder methods list_files() to the extractor interface
The interface can be used as follows:
from gimie.io import LocalResource, RemoteResource
local = LocalResource("README.md")
url = "https://raw.githubusercontent.com/SDSC-ORD/gimie/main/README.md"
remote = RemoteResource("README.md", url)
def show_contents(resource: Resource):
"""I show what's in a resource, regardless of where it is"""
print(resource.name + " contains:")
with resource.open() as reader:
print(reader.read())
show_contents(local)
show_contents(remote)
Provides a common file-like interface for remote and local files. This will be needed for parsing tasks requiring access to contents of specific files (e.g. license matching).
This PR does the following:
list_files()
to the extractor interfaceThe interface can be used as follows: