-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMaHT ingestion related work. #293
Conversation
Pull Request Test Coverage Report for Build 7045798624Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments, nothing major
def unpack_zip_file_to_temporary_directory(file: str) -> str: | ||
with temporary_directory() as tmp_directory_name: | ||
with zipfile.ZipFile(file, "r") as zipf: | ||
zipf.extractall(tmp_directory_name) | ||
yield tmp_directory_name | ||
|
||
|
||
@contextmanager | ||
def unpack_tar_file_to_temporary_directory(file: str) -> str: | ||
with temporary_directory() as tmp_directory_name: | ||
with tarfile.open(file, "r") as tarf: | ||
tarf.extractall(tmp_directory_name) | ||
yield tmp_directory_name | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to allow optional args to these functions in case additional options are needed/desired
with tempfile.TemporaryDirectory() as tmp_directory_name: | ||
yield tmp_directory_name | ||
finally: | ||
remove_temporary_directory(tmp_directory_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought temp directories were removed automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, wait a minute, I think you should be right; I think I did this for a reason, need to remind myself.
def __init__(self): | ||
super().__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not the default behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's not. A derived init must explicitly call its base init, if it wants that behavior.
found = True | ||
for item in item_ref: | ||
if not lookup_table.get(item): | ||
found = False | ||
break | ||
return True if found else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why mixed return value (None + bool, why not just bool). Also, why not just
for item in item_ref:
if not lookup_table.get(item):
return None
return True
found = True | ||
for item in item_ref: | ||
info = get_metadata(f"/{to_camel_case(item_type)}/{item}", | ||
ff_env=self.portal_env, vapp=self.portal_vapp) | ||
if not isinstance(info, dict) or 'uuid' not in info: | ||
found = False | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same pattern here as above can be simplified
No description provided.