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

add lxml as parser in from_xml calls #442

Closed

Conversation

colobas
Copy link
Contributor

@colobas colobas commented Nov 1, 2022

Description

Add parser="lxml" to ome_types.from_xml calls.
This silences a FutureWarning, which lets us know that ome_types's default parser will be changing from xmlschema to lxml. This way we're adopting the incoming change explicitly, and since we're already depending on lxml we're not requiring any additional libs and we can stop requiring xmlschema.

I wanted to add a test to make sure the right error is raised here but not quite sure how to produce a corrupted ome.tiff

Pull request recommendations:

  • Name your pull request your-development-type/short-description. Ex: feature/read-tiff-files
  • Link to any relevant issue in the PR description. Ex: Resolves [gh-], adds tiff file format support
  • Provide relevant tests for your feature or bug fix.
  • Provide or update documentation for any feature added by your pull request.

Thanks for contributing!

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2022

Codecov Report

Base: 93.90% // Head: 68.79% // Decreases project coverage by -25.11% ⚠️

Coverage data is based on head (65a7981) compared to base (8099b70).
Patch coverage: 66.66% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #442       +/-   ##
===========================================
- Coverage   93.90%   68.79%   -25.12%     
===========================================
  Files          46       46               
  Lines        4001     4002        +1     
===========================================
- Hits         3757     2753     -1004     
- Misses        244     1249     +1005     
Impacted Files Coverage Δ
aicsimageio/writers/ome_tiff_writer.py 66.23% <50.00%> (-26.07%) ⬇️
aicsimageio/readers/ome_tiff_reader.py 84.54% <75.00%> (-13.62%) ⬇️
aicsimageio/tests/test_aics_image.py 0.00% <0.00%> (-100.00%) ⬇️
aicsimageio/tests/test_dimensions.py 0.00% <0.00%> (-100.00%) ⬇️
aicsimageio/tests/utils/test_io_utils.py 0.00% <0.00%> (-100.00%) ⬇️
aicsimageio/tests/readers/test_glob_reader.py 0.00% <0.00%> (-100.00%) ⬇️
aicsimageio/tests/writers/test_ome_tiff_writer.py 0.00% <0.00%> (-100.00%) ⬇️
...icsimageio/tests/readers/test_array_like_reader.py 0.00% <0.00%> (-100.00%) ⬇️
aicsimageio/tests/readers/test_tiff_reader.py 0.00% <0.00%> (-99.04%) ⬇️
aicsimageio/tests/test_transforms.py 0.00% <0.00%> (-99.00%) ⬇️
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@evamaxfield evamaxfield left a comment

Choose a reason for hiding this comment

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

Would approve but it seems like you just need to update the tests which handle / check exceptions that are returned from bad parsing.

@colobas
Copy link
Contributor Author

colobas commented Nov 1, 2022

So I updated the errors we're checking for related to XML parsing here which solved part of the problem with the tests.

However, there are three test cases which should be failing but aren't:

  • variance-cfe.ome.tiff and pre-variance-cfe.ome.tiff used to fail with a XMLSchemaChildrenValidationError saying

    failed validating <Element '{http://www.openmicroscopy.org/Schemas/OME/2016-06}Pixels' at 0x7f1acc837830> with  XsdGroup(model='sequence', occurs=[1, 1]):
    E
    E                   Reason: Unexpected child with tag 'OME:Plane' at position 5. Tag ('OME:BinData' | 'OME:TiffData' |  'OME:MetadataOnly') expected.
    
  • 3d-cell-viewer.ome.tiff used to fail with a XMLSchemaChildrenValidationError saying

    failed validating <Element '{http://www.openmicroscopy.org/Schemas/OME/2016-06}Pixels' at 0x7f1acc8f41d0> with XsdGroup(model='sequence', occurs=[1, 1]):
    E
    E                   Reason: Unexpected child with tag 'OME:Channel' at position 302.
    

Any ideas why these wouldn't get thrown with parser="lxml" but do get thrown by parser="xmlschema"? Or tips on where to look for answers?

@SeanLeRoy
Copy link
Collaborator

Duplicate of #478 now?

@toloudis
Copy link
Collaborator

toloudis commented Apr 5, 2023

oops, I totally forgot about this. I suppose it is a duplicate yes

@SeanLeRoy
Copy link
Collaborator

Closing as duplicate of #478

@SeanLeRoy SeanLeRoy closed this Apr 13, 2023
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

5 participants