Commit fdf621ed authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add *args

parent 8630bd81
Pipeline #12154 passed with stage
in 0 seconds
...@@ -47,12 +47,12 @@ def prepare_fits_files_for_ingestion(files: list[str]) -> list[dict]: ...@@ -47,12 +47,12 @@ def prepare_fits_files_for_ingestion(files: list[str]) -> list[dict]:
return ingestion_files return ingestion_files
def open(filename, **kwargs) -> HDUList: def open(filename, *args, **kwargs) -> HDUList:
if filename.startswith(s3_prefix): if filename.startswith(s3_prefix):
# read FITS file from s3 # read FITS file from s3
return HDUList( return HDUList(
astropy_fits.open( astropy_fits.open(
filename, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs filename, *args, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs
) )
) )
else: else:
...@@ -60,33 +60,33 @@ def open(filename, **kwargs) -> HDUList: ...@@ -60,33 +60,33 @@ def open(filename, **kwargs) -> HDUList:
return HDUList(astropy_fits.open(filename, **kwargs)) return HDUList(astropy_fits.open(filename, **kwargs))
def getheader(filename, **kwargs) -> astropy_fits.Header: def getheader(filename, *args, **kwargs) -> astropy_fits.Header:
if filename.startswith(s3_prefix): if filename.startswith(s3_prefix):
# read FITS file from s3 # read FITS file from s3
return astropy_fits.getheader( return astropy_fits.getheader(
filename, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs filename, *args, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs
) )
else: else:
# read FITS file from local # read FITS file from local
return astropy_fits.getheader(filename, **kwargs) return astropy_fits.getheader(filename, **kwargs)
def getval(filename, **kwargs) -> Any: def getval(filename, *args, **kwargs) -> Any:
if filename.startswith(s3_prefix): if filename.startswith(s3_prefix):
# read FITS file from s3 # read FITS file from s3
return astropy_fits.getval( return astropy_fits.getval(
filename, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs filename, *args, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs
) )
else: else:
# read FITS file from local # read FITS file from local
return astropy_fits.getval(filename, **kwargs) return astropy_fits.getval(filename, **kwargs)
def getdata(filename, **kwargs) -> Any: def getdata(filename, *args, **kwargs) -> Any:
if filename.startswith(s3_prefix): if filename.startswith(s3_prefix):
# read FITS file from s3 # read FITS file from s3
return astropy_fits.getdata( return astropy_fits.getdata(
filename, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs filename, *args, use_fsspec=True, fsspec_kwargs=s3_options, **kwargs
) )
else: else:
# read FITS file from local # read FITS file from local
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment