Skip to content

Commit a910cd9

Browse files
committed
Fixes for unix passin for --inlist when using --inlist {cmd}
1 parent 01eb2c7 commit a910cd9

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

autonicer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def run(args=None):
5454
"-inlist",
5555
"--inlist",
5656
help="Input .csv list with path to OBSID dirs or mpu7_cl.evt files for use with --reprocess and/or --checkcal",
57-
type=str,
5857
default=None,
58+
nargs="+",
5959
)
6060

6161
argp = p.parse_args(args)

autonicer/reprocess.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,21 @@ def inlist(argp):
165165
cwd = os.getcwd()
166166
curr_cals = autonicer.get_caldb_ver()
167167
try:
168-
df = pd.read_csv(f"{argp.inlist}")
169-
for i in df["Input"]:
170-
path_sep = i.split("/xti/event_cl/")
171-
os.chdir(path_sep[0])
172-
if argp.checkcal is True or argp.reprocess is True:
173-
reprocess_check(argp, curr_cals)
174-
os.chdir(cwd)
168+
if len(argp.inlist) == 1:
169+
df = pd.read_csv(f"{argp.inlist[0]}")
170+
for i in df["Input"]:
171+
path_sep = i.split("/xti/event_cl/")
172+
os.chdir(path_sep[0])
173+
if argp.checkcal is True or argp.reprocess is True:
174+
reprocess_check(argp, curr_cals)
175+
os.chdir(cwd)
176+
else:
177+
raise FileNotFoundError
175178

176179
except FileNotFoundError:
177-
dirs = glob.glob(f"{argp.inlist}")
180+
dirs = argp.inlist
181+
if len(argp.inlist) == 1:
182+
dirs = glob.glob(f"{argp.inlist[0]}")
178183
if len(dirs) != 0:
179184
for i in dirs:
180185
try:
@@ -188,7 +193,7 @@ def inlist(argp):
188193
else:
189194
print(colored(f"DATASETS NOT FOUND", "red"))
190195
except pd.errors.ParserError:
191-
print(colored(f"Unable to resolve --inlist {argp.inlist}", "red"))
196+
print(colored(f"Unable to resolve --inlist {argp.inlist[0]}", "red"))
192197
except KeyError:
193-
print(colored(f"{argp.inlist} format not readable", "red"))
198+
print(colored(f"{argp.inlist[0]} format not readable", "red"))
194199
print("Format must be csv with Input column for inlist files...")

tests/test_autonicer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_inlist_readin(capsys):
286286
os.chdir(f"{base_dir}")
287287
files = ["requirements.txt", "README.md"]
288288
for i in files:
289-
autonicer.run(["--checkcal", f"--inlist={i}"])
289+
autonicer.run(["--checkcal", "--inlist", f"{i}"])
290290
out, err = capsys.readouterr()
291291
pd_err = "Unable to resolve --inlist README.md"
292292
key_err = "requirements.txt format not readable"

0 commit comments

Comments
 (0)