MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _get_version

Function _get_version

src/bcf/bcf/bcfxml.py:57–74  ·  view source on GitHub ↗

Returns the version of the BCF file. Args: filepath: The path to the BCF file. xml_handler: The XML handler. If none is given, XmlParserSerializer is used. Returns: The version of the BCF file.

(filepath: Union[str, Path], xml_handler: Optional[AbstractXmlParserSerializer] = None)

Source from the content-addressed store, hash-verified

55
56
57def _get_version(filepath: Union[str, Path], xml_handler: Optional[AbstractXmlParserSerializer] = None) -> str:
58 """
59 Returns the version of the BCF file.
60
61 Args:
62 filepath: The path to the BCF file.
63 xml_handler: The XML handler. If none is given, XmlParserSerializer is used.
64
65 Returns:
66 The version of the BCF file.
67 """
68 xml_handler = xml_handler or XmlParserSerializer()
69 with zipfile.ZipFile(filepath) as bcf_zip:
70 try:
71 version = xml_handler.parse(bcf_zip.read("bcf.version"), Version3)
72 except:
73 version = xml_handler.parse(bcf_zip.read("bcf.version"), Version2)
74 return version.version_id

Callers 1

loadFunction · 0.85

Calls 3

XmlParserSerializerClass · 0.90
parseMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected