Skip to content

Commit

Permalink
from_file: update function signature
Browse files Browse the repository at this point in the history
  • Loading branch information
rien333 committed Dec 6, 2024
1 parent 93cb226 commit 3a89373
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mdto/mdto.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,7 @@ def create_checksum(
return ChecksumGegevens(checksumAlgoritme, checksumWaarde, checksumDatum)


# Q: should this also accept file objects?
def from_file(xmlfile: str) -> Object:
def from_file(mdto_xml: TextIO | str) -> Object:
"""Construct a Informatieobject/Bestand object from a MDTO XML file.
Note:
Expand All @@ -859,10 +858,10 @@ def from_file(xmlfile: str) -> Object:
```
Args:
filename (str): The MDTO XML file to construct an Informatieobject/Bestand from
mdto_xml (TextIO | str): The MDTO XML file to construct an Informatieobject/Bestand from
Returns:
Informatieobject | Bestand: A new MDTO object
Object: A new MDTO object (Bestand or Informatieobject)
"""

# Parsers:
Expand Down Expand Up @@ -1030,7 +1029,7 @@ def elem_to_mdto(elem: ET.Element, mdto_class: classmethod, mdto_xml_parsers: di
parse_bestand = lambda e: elem_to_mdto(e, Bestand, bestand_parsers)

# read xmlfile
tree = ET.parse(xmlfile)
tree = ET.parse(mdto_xml)
root = tree.getroot()
children = list(root[0])

Expand Down

0 comments on commit 3a89373

Please sign in to comment.