Skip to content

Commit

Permalink
Add doc to LazyReferenceMapper.create
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Nov 9, 2023
1 parent 0c829ec commit df0a776
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion fsspec/implementations/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,28 @@ def open_refs(field, record):
self.open_refs = open_refs

@staticmethod
def create(record_size, root, fs, **kwargs):
def create(root, storage_options=None, fs=None, record_size=10000, **kwargs):
"""Make empty parquet reference set
Parameters
----------
root: str
Directory to contain the output; will be created
storage_options: dict | None
For making the filesystem to use for writing is fs is None
fs: FileSystem | None
Filesystem for writing
record_size: int
Number of references per parquet file
kwargs: passed to __init__
Returns
-------
LazyReferenceMapper instance
"""
met = {"metadata": {}, "record_size": record_size}
if fs is None:
fs, root = fsspec.core.url_to_fs(root, **(storage_options or {}))
fs.makedirs(root, exist_ok=True)
fs.pipe("/".join([root, ".zmetadata"]), json.dumps(met).encode())
return LazyReferenceMapper(root, fs, **kwargs)
Expand Down

0 comments on commit df0a776

Please sign in to comment.