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)
| 55 | |
| 56 | |
| 57 | def _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 |
no test coverage detected