civics-cdf-validator 1.68.dev16__tar.gz → 1.68.dev18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {civics_cdf_validator-1.68.dev16/civics_cdf_validator.egg-info → civics_cdf_validator-1.68.dev18}/PKG-INFO +1 -1
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/committee_rules.py +11 -10
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/common_rules.py +226 -204
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/election_dates_rules.py +7 -1
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/election_results_rules.py +2 -1
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/officeholder_rules.py +43 -29
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/voter_information_rules.py +11 -10
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/version.py +1 -1
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/README.md +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/__init__.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/base.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/loggers.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/office_utils.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rules.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/__init__.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/election_rules.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/metadata_rules.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/rule_util.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/setup.cfg +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/setup.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/stats.py +0 -0
- {civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/validator.py +0 -0
{civics_cdf_validator-1.68.dev16 → civics_cdf_validator-1.68.dev18}/rulesets/committee_rules.py
RENAMED
|
@@ -21,15 +21,16 @@ from civics_cdf_validator import base
|
|
|
21
21
|
from civics_cdf_validator import loggers
|
|
22
22
|
from civics_cdf_validator.rulesets import common_rules
|
|
23
23
|
from civics_cdf_validator.rulesets import rule_util
|
|
24
|
+
from lxml import etree
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class CommitteeClassificationEndDateOccursAfterStartDate(base.DateRule):
|
|
27
28
|
"""CommitteeClassification elements should have end dates that occur after the start dates."""
|
|
28
29
|
|
|
29
|
-
def elements(self):
|
|
30
|
+
def elements(self) -> list[str]:
|
|
30
31
|
return ["CommitteeClassification"]
|
|
31
32
|
|
|
32
|
-
def check(self, element):
|
|
33
|
+
def check(self, element: etree._Element) -> None:
|
|
33
34
|
self.reset_instance_vars()
|
|
34
35
|
self.gather_dates(element)
|
|
35
36
|
|
|
@@ -42,10 +43,10 @@ class CommitteeClassificationEndDateOccursAfterStartDate(base.DateRule):
|
|
|
42
43
|
class AffiliationEndDateOccursAfterStartDate(base.DateRule):
|
|
43
44
|
"""Affiliation elements should have end dates that occur after the start dates."""
|
|
44
45
|
|
|
45
|
-
def elements(self):
|
|
46
|
+
def elements(self) -> list[str]:
|
|
46
47
|
return ["Affiliation"]
|
|
47
48
|
|
|
48
|
-
def check(self, element):
|
|
49
|
+
def check(self, element: etree._Element) -> None:
|
|
49
50
|
self.reset_instance_vars()
|
|
50
51
|
self.gather_dates(element)
|
|
51
52
|
|
|
@@ -58,15 +59,15 @@ class AffiliationEndDateOccursAfterStartDate(base.DateRule):
|
|
|
58
59
|
class EinMatchesFormat(base.BaseRule):
|
|
59
60
|
"""EIN id should be in the following format: XX-XXXXXXX."""
|
|
60
61
|
|
|
61
|
-
def __init__(self, *args, **kwargs):
|
|
62
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
62
63
|
super(EinMatchesFormat, self).__init__(*args, **kwargs)
|
|
63
64
|
regex = r"\d{2}(-\d{7})?"
|
|
64
65
|
self.ein_id_matcher = re.compile(regex, flags=re.U)
|
|
65
66
|
|
|
66
|
-
def elements(self):
|
|
67
|
+
def elements(self) -> list[str]:
|
|
67
68
|
return ["Committee"]
|
|
68
69
|
|
|
69
|
-
def check(self, element):
|
|
70
|
+
def check(self, element: etree._Element) -> None:
|
|
70
71
|
external_identifiers = element.find("ExternalIdentifiers")
|
|
71
72
|
if external_identifiers is not None:
|
|
72
73
|
ein_ids = rule_util.get_external_id_values(external_identifiers, "ein")
|
|
@@ -74,7 +75,7 @@ class EinMatchesFormat(base.BaseRule):
|
|
|
74
75
|
e_id = ein_ids.pop()
|
|
75
76
|
if not self.ein_id_matcher.match(e_id):
|
|
76
77
|
raise loggers.ElectionError.from_message(
|
|
77
|
-
"EIN id '{}' is not in the correct format."
|
|
78
|
+
f"EIN id '{e_id}' is not in the correct format.",
|
|
78
79
|
[element],
|
|
79
80
|
)
|
|
80
81
|
|
|
@@ -82,10 +83,10 @@ class EinMatchesFormat(base.BaseRule):
|
|
|
82
83
|
class AffiliationHasEitherPartyOrPerson(base.BaseRule):
|
|
83
84
|
"""Affiliation should contain either a Party or a Person objectId."""
|
|
84
85
|
|
|
85
|
-
def elements(self):
|
|
86
|
+
def elements(self) -> list[str]:
|
|
86
87
|
return ["Affiliation"]
|
|
87
88
|
|
|
88
|
-
def check(self, element):
|
|
89
|
+
def check(self, element: etree._Element) -> None:
|
|
89
90
|
party_id = element.find("PartyId")
|
|
90
91
|
person_id = element.find("PersonId")
|
|
91
92
|
if not ((party_id is None) ^ (person_id is None)):
|