Skip to content
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

chore(xmlupload): improve parse xml function #819

Merged
merged 5 commits into from Feb 22, 2024

Conversation

Nora-Olivia-Ammann
Copy link
Collaborator

@Nora-Olivia-Ammann Nora-Olivia-Ammann commented Feb 20, 2024

Currently for the validate xml, the comments were not removed. This caused problems when finding the encodings attributes. However, we need the namespaces for the first validation step. Therefore a function was created that only parses the file and removes the comments.

Copy link
Collaborator

@jnussbaum jnussbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have 2 functions that almost do the same:

  • parse_and_remove_comments_xml_file()
  • parse_and_clean_xml_file()

This is confusing, because it is almost duplicating things, but with slight deviations. This makes it very hard to understand the paths that the program can take.

These code paths should be disentangled.

src/dsp_tools/utils/xml_utils.py Outdated Show resolved Hide resolved
src/dsp_tools/utils/xml_utils.py Outdated Show resolved Hide resolved
src/dsp_tools/utils/xml_utils.py Outdated Show resolved Hide resolved
src/dsp_tools/utils/xml_utils.py Outdated Show resolved Hide resolved
@Nora-Olivia-Ammann
Copy link
Collaborator Author

Now we have 2 functions that almost do the same:

* `parse_and_remove_comments_xml_file()`

* `parse_and_clean_xml_file()`

This is confusing, because it is almost duplicating things, but with slight deviations. This makes it very hard to understand the paths that the program can take.

These code paths should be disentangled.

I agree, the reason why I did not do this here is because it opens a typing can of worms. If you would like to combine the functions, I am happy to do that, but I suggest another PR for that.

@jnussbaum
Copy link
Collaborator

Now we have 2 functions that almost do the same:

* `parse_and_remove_comments_xml_file()`

* `parse_and_clean_xml_file()`

This is confusing, because it is almost duplicating things, but with slight deviations. This makes it very hard to understand the paths that the program can take.
These code paths should be disentangled.

I agree, the reason why I did not do this here is because it opens a typing can of worms. If you would like to combine the functions, I am happy to do that, but I suggest another PR for that.

Why would you like to do it in another PR? AFAIU, you introduced the duplication in the present PR. It doesn't seem natural to me to introduce a duplication/bad architecture in one PR, and then schedule a follow-up PR...?

@Nora-Olivia-Ammann
Copy link
Collaborator Author

Nora-Olivia-Ammann commented Feb 21, 2024

Now we have 2 functions that almost do the same:

* `parse_and_remove_comments_xml_file()`

* `parse_and_clean_xml_file()`

This is confusing, because it is almost duplicating things, but with slight deviations. This makes it very hard to understand the paths that the program can take.
These code paths should be disentangled.

I agree, the reason why I did not do this here is because it opens a typing can of worms. If you would like to combine the functions, I am happy to do that, but I suggest another PR for that.

Why would you like to do it in another PR? AFAIU, you introduced the duplication in the present PR. It doesn't seem natural to me to introduce a duplication/bad architecture in one PR, and then schedule a follow-up PR...?

Because I wanted to focus on PR that introduces the new feature and this stood in the way. But if it is a deal-breaker, then I can do it here.

@Nora-Olivia-Ammann Nora-Olivia-Ammann merged commit 9947607 into main Feb 22, 2024
10 checks passed
@Nora-Olivia-Ammann Nora-Olivia-Ammann deleted the chore-improve-parse-xml-for-xmlvalidation branch February 22, 2024 08:34
@daschbot daschbot mentioned this pull request Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants