Skip to content

Commit

Permalink
fix type of self.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
jtherrmann committed Jan 18, 2025
1 parent 5f9b390 commit cedfe05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/burst2safe/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
self.information_package_map: Optional[ET._Element] = None
self.metadata_section: Optional[ET._Element] = None
self.data_object_section: Optional[ET._Element] = None
self.xml: Union[ET._Element, ET._ElementTree, None] = None
self.xml: Optional[ET._ElementTree] = None
self.path: Optional[Path] = None
self.crc: Optional[str] = None

Expand Down Expand Up @@ -161,7 +161,7 @@ def write(self, out_path: Path, update_info: bool = True) -> None:
out_path: The path to write the manifest to
update_info: Whether to update the path and CRC
"""
assert isinstance(self.xml, ET._ElementTree)
assert self.xml is not None
self.xml.write(out_path, pretty_print=True, xml_declaration=True, encoding='utf-8')
if update_info:
self.path = out_path
Expand All @@ -178,7 +178,7 @@ def __init__(self, bbox: Polygon):
bbox: The bounding box of the product
"""
self.bbox = bbox
self.xml: Union[ET._Element, ET._ElementTree, None] = None
self.xml: Optional[ET._ElementTree] = None

def assemble(self):
"""Assemble the components of the SAFE KML preview file."""
Expand Down Expand Up @@ -213,7 +213,7 @@ def write(self, out_path: Path, update_info: bool = True) -> None:
out_path: The path to write the manifest to
update_info: Whether to update the path
"""
assert isinstance(self.xml, ET._ElementTree)
assert self.xml is not None
self.xml.write(out_path, pretty_print=True, xml_declaration=True, encoding='utf-8')
if update_info:
self.path = out_path
Expand Down
1 change: 0 additions & 1 deletion tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_create_data_object_section(self, manifest):

def test_assemble(self, manifest):
manifest.assemble()
assert isinstance(manifest.xml, ET._ElementTree)
assert manifest.xml.getroot().tag == '{urn:ccsds:schema:xfdu:1}XFDU'
assert manifest.xml.getroot().get('version') == 'esa/safe/sentinel-1.0/sentinel-1/sar/level-1/slc/standard/iwdp'
assert manifest.xml.find('{*}informationPackageMap') is not None
Expand Down

0 comments on commit cedfe05

Please sign in to comment.