diff --git a/lib/galaxy/datatypes/constructive_solid_geometry.py b/lib/galaxy/datatypes/constructive_solid_geometry.py index 1eb4c2809b08..0830c6e50f45 100644 --- a/lib/galaxy/datatypes/constructive_solid_geometry.py +++ b/lib/galaxy/datatypes/constructive_solid_geometry.py @@ -813,18 +813,19 @@ def get_next_line(fh): fh.readline() return line.strip() + class VtkXml(GenericXml): """Format for defining VTK (XML based) and its sub-datatypes. https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html""" edam_format = "edam:format_2332" file_ext = "vtkxml" - #The same MetadataElements are also available for legacy VTK datatypes. + # The same MetadataElements are also available for legacy VTK datatypes. MetadataElement(name="vtk_version", default=None, desc="Vtk version", readonly=True, optional=True, visible=True) MetadataElement(name="file_format", default=None, desc="File format", readonly=True, optional=True, visible=True) MetadataElement(name="dataset_type", default=None, desc="Dataset type", readonly=True, optional=True, visible=True) - def extract_version(self, line: str) -> str: + def extract_version(self, line: str) -> str: match = re.search(r'version="([^"]+)"', line) if match: return match.group(1) @@ -843,10 +844,9 @@ def set_meta(self, dataset: DatasetProtocol, **kwd) -> None: first_line = file.readline() if first_line.startswith(" None: """Set the peek and blurb text for VTK dataset files.""" if not dataset.dataset.purged: @@ -868,4 +868,3 @@ def sniff_prefix(self, file_prefix: FilePrefix) -> bool: False """ return self._has_root_element_in_prefix(file_prefix, "VTKFile") - \ No newline at end of file diff --git a/test/unit/data/datatypes/test_constructive_solid_geometry.py b/test/unit/data/datatypes/test_constructive_solid_geometry.py index 4785becb29ea..4319ecfa9927 100644 --- a/test/unit/data/datatypes/test_constructive_solid_geometry.py +++ b/test/unit/data/datatypes/test_constructive_solid_geometry.py @@ -1,18 +1,18 @@ - -from galaxy.datatypes.constructive_solid_geometry import VtkXml +from galaxy.datatypes.constructive_solid_geometry import VtkXml from .util import ( get_input_files, MockDataset, ) + def test_vtkXml_set_meta(): - vtkXml = VtkXml() - with get_input_files("data.vtu") as input_files: - dataset = MockDataset(1) - dataset.set_file_name(input_files[0]) + vtkXml = VtkXml() + with get_input_files("data.vtu") as input_files: + dataset = MockDataset(1) + dataset.set_file_name(input_files[0]) - vtkXml.set_meta(dataset) + vtkXml.set_meta(dataset) - assert dataset.metadata.vtk_version == "0.1" - assert dataset.metadata.file_format == "XML" - assert dataset.metadata.dataset_type == "UnstructuredGrid" \ No newline at end of file + assert dataset.metadata.vtk_version == "0.1" + assert dataset.metadata.file_format == "XML" + assert dataset.metadata.dataset_type == "UnstructuredGrid"