-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
247 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def read_in_SSObjectID_file(readin_path): | ||
"""Reads in a list of SSOIDs from a text file and performs basic validation. | ||
Parameters | ||
----------- | ||
readin_path : str | ||
String containing filepath to text file. | ||
Returns | ||
----------- | ||
ssoid_list : list | ||
A list of SSOIDs. | ||
""" | ||
|
||
with open(readin_path) as f: | ||
ssoid_list = f.read().splitlines() | ||
|
||
# bit of validation here: we expect these to cast nicely to ints | ||
for ssoid in ssoid_list: | ||
try: | ||
int(ssoid) | ||
except ValueError: | ||
logger.error( | ||
"ValueError: One or more of the SSObjectIDs in the supplied list does not seem to be valid." | ||
) | ||
raise ValueError("One or more of the SSObjectIDs in the supplied list does not seem to be valid.") | ||
|
||
return ssoid_list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.