Commit b3fb43a5 authored by Matthias Weidenthaler's avatar Matthias Weidenthaler
Browse files

Fixed unreliable function argument ordering and made code more clear

parent 22dd7754
......@@ -2,13 +2,13 @@ from astropy.io import fits
from ..fsspec_fileobj import open_fileobj
from ..s3_config import load_s3_options
def open(filename, s3_options=load_s3_options(), *args, **kwargs):
return fits.open(filename, fsspec_kwargs=s3_options, *args, **kwargs)
def open(filename, *args, s3_options=load_s3_options(), **kwargs):
return fits.open(filename, *args, fsspec_kwargs=s3_options, **kwargs)
def getdata(filename, s3_options=load_s3_options(), *args, **kwargs):
def getdata(filename, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(filename, s3_options, mode='rb')
return fits.getdata(fileobj, *args, **kwargs)
def getheader(filename, s3_options=load_s3_options(), *args, **kwargs):
def getheader(filename, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(filename, s3_options, mode='rb')
return fits.getheader(fileobj, *args, **kwargs)
\ No newline at end of file
......@@ -3,12 +3,12 @@ from astropy.io import fits
from ..fsspec_fileobj import open_fileobj
from ..s3_config import load_s3_options
def tofile(fits_header, out_path, s3_options=load_s3_options(), *args, **kwargs):
def tofile(fits_header, out_path, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(out_path, s3_options, mode='wb')
fits_header.tofile(fileobj, *args, **kwargs)
if hasattr(fileobj, 'close'):
fileobj.close()
def fromfile(filename, s3_options=load_s3_options(), *args, **kwargs):
def fromfile(filename, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(filename, s3_options, mode='rb')
return fits.Header.fromfile(fileobj, *args, **kwargs)
\ No newline at end of file
......@@ -3,10 +3,10 @@ from astropy import table
from ..fsspec_fileobj import open_fileobj
from ..s3_config import load_s3_options
def read(filename, s3_options=load_s3_options(), *args, **kwargs):
def read(filename, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(filename, s3_options, mode='rb')
return table.Table.read(fileobj, *args, **kwargs)
def write(table_to_write: table.Table, filename, s3_options=load_s3_options(), *args, **kwargs):
def write(table_to_write: table.Table, filename, *args, s3_options=load_s3_options(), **kwargs):
fileobj = open_fileobj(filename, s3_options, mode='wb')
return table_to_write.write(fileobj, *args, **kwargs)
\ No newline at end of file
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