-
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
[FCL-644] Improve typing and code robustness #260
base: main
Are you sure you want to change the base?
[FCL-644] Improve typing and code robustness #260
Conversation
9012489
to
609679f
Compare
6a6f534
to
91be496
Compare
91be496
to
323208c
Compare
@@ -336,23 +337,38 @@ def test_store_metadata(self, api_client, v2_ingest): | |||
def test_store_file_success(self, mock_print): | |||
session = boto3.Session |
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.
These could probably use moto
but maybe not this PR.
xml_file = extract_xml_file(tar, xml_file_name) | ||
if xml_file: | ||
contents = xml_file.read() | ||
contents = xml_file.read().decode("utf-8") # We assume here that our XML is in UTF-8 |
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.
Whilst true in practice, I don't think this should be something we have to assume. I think lxml will raise an exception if it receives str
XML with a document type preamble, since it's now not accurately describing the document.
s3_client.copy(source, public_bucket, key, extra_args) | ||
|
||
|
||
def parse_xml(xml) -> ET.Element: | ||
def parse_xml(xml: str) -> ET.Element: |
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.
bytes? (see other comment )
323208c
to
8f4bd35
Compare
This method isn't accessible from any code path.
8f4bd35
to
a7fb4ef
Compare
So that we're more confident making changes in future, add some missing type annotations to the codebase.