Skip to content

Commit 3559266

Browse files
committed
Update required python version to 3.12
1 parent d5f901c commit 3559266

5 files changed

Lines changed: 29 additions & 51 deletions

File tree

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8
1+
3.12

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "HCP"
33
version = "1.0"
44
description = "Hulpmiddel controle protocol. Scripts ter ondersteuning van onderdeel A van het Controleprotocol Centraal Stembureau."
5-
requires-python = "~= 3.8.0"
5+
requires-python = "~= 3.12.0"
66
readme = "README.md"
7-
dependencies = ["defusedxml == 0.7.1", "polars == 0.20.3"]
7+
dependencies = ["defusedxml == 0.7.1", "polars == 0.20.18"]
88

99
[dependency-groups]
1010
dev = ["pytest", "pytest-cov"]

src/csv_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"Stembureaunummer",
2222
"Stembureaunaam",
2323
]
24-
PROTOCOL_VERSION = "EP2024"
24+
PROTOCOL_VERSION = "TK2025"
2525

2626
ZIP_CODE_PATTERN = re.compile(r"\(\s*postcode:\s*\d{4}\s*[A-Z]{2}\s*\)")
2727
STEMBUREAU_PREFIX_PATTERN = re.compile(r"^(Stembureau\s)+")

src/xml_parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from xml.etree.ElementTree import Element as XmlElement
44

55
from defusedxml import ElementTree as ET
6+
67
from eml_types import (
78
CandidateIdentifier,
89
EmlMetadata,
@@ -33,6 +34,9 @@ def parse_xml(file_name: Union[str, IO[bytes]]) -> XmlElement:
3334
tree = ET.parse(file_name)
3435
tree_root = tree.getroot()
3536

37+
if tree_root is None:
38+
raise InvalidEmlException(f"{file_name} could not be parsed as XML")
39+
3640
return tree_root
3741

3842

@@ -46,7 +50,7 @@ def get_eml_type(root: XmlElement) -> Optional[str]:
4650
The ID of the EML file (e.g. `"510b"` for municipality counts).
4751
"""
4852
root_element = root.find(".")
49-
if root_element and root_element.tag == f"{{{NAMESPACE.get('eml')}}}EML":
53+
if root_element is not None and root_element.tag == f"{{{NAMESPACE.get('eml')}}}EML":
5054
return _get_attrib(root_element, "Id")
5155

5256
return None

uv.lock

Lines changed: 20 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)