civics-cdf-validator 1.69.dev5__tar.gz → 1.69.dev7__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.69.dev5/civics_cdf_validator.egg-info → civics_cdf_validator-1.69.dev7}/PKG-INFO +1 -1
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/base.py +3 -2
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/common_rules.py +23 -17
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_rules.py +74 -51
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/version.py +1 -1
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/README.md +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/__init__.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/loggers.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/office_utils.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/__init__.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/committee_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_dates_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_results_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/metadata_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/officeholder_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/rule_util.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/voter_information_rules.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/setup.cfg +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/setup.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/stats.py +0 -0
- {civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/validator.py +0 -0
|
@@ -423,13 +423,14 @@ class MissingFieldRule(BaseRule):
|
|
|
423
423
|
def check(self, element: etree._Element) -> None:
|
|
424
424
|
error_log = []
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
element_class = self.get_element_class(element)
|
|
427
|
+
required_field_tags = self.element_field_mapping()[element_class]
|
|
427
428
|
for field_tag in required_field_tags:
|
|
428
429
|
required_field = element.find(field_tag)
|
|
429
430
|
if (required_field is None or required_field.text is None
|
|
430
431
|
or not required_field.text.strip()):
|
|
431
432
|
error_log.append(loggers.LogEntry(
|
|
432
|
-
f"The element {
|
|
433
|
+
f"The element {element_class} is missing field {field_tag}.",
|
|
433
434
|
[element]))
|
|
434
435
|
|
|
435
436
|
if error_log:
|
|
@@ -409,16 +409,16 @@ class ValidStableID(base.BaseRule):
|
|
|
409
409
|
raise loggers.ElectionError(error_log)
|
|
410
410
|
|
|
411
411
|
|
|
412
|
-
class GpUnitOcdId(base.
|
|
412
|
+
class GpUnitOcdId(base.SchemaRule):
|
|
413
413
|
"""All GpUnits MUST have a valid OCD ID."""
|
|
414
414
|
|
|
415
|
-
def elements(self):
|
|
416
|
-
|
|
415
|
+
def elements(self) -> list[str]:
|
|
416
|
+
# ReportingDevices are not expected to have OCD IDs.
|
|
417
|
+
return ["GpUnit"] + list(
|
|
418
|
+
self.get_all_subtypes("GpUnit") - {"ReportingDevice"}
|
|
419
|
+
)
|
|
417
420
|
|
|
418
421
|
def check(self, element: etree._Element) -> None:
|
|
419
|
-
# ReportingDevices are not expected to have OCD IDs.
|
|
420
|
-
if self.get_element_class(element) == "ReportingDevice":
|
|
421
|
-
return
|
|
422
422
|
type_element = element.find("Type")
|
|
423
423
|
if (
|
|
424
424
|
rule_util.element_has_text(type_element)
|
|
@@ -705,14 +705,14 @@ class BadCharactersInPersonFullName(base.BaseRule):
|
|
|
705
705
|
)
|
|
706
706
|
|
|
707
707
|
|
|
708
|
-
class IndependentPartyName(base.
|
|
708
|
+
class IndependentPartyName(base.SchemaRule):
|
|
709
709
|
"""Warns on parties that contain common names indicating they are an independent party.
|
|
710
710
|
|
|
711
711
|
These should instead supply the IsIndependent attribute.
|
|
712
712
|
"""
|
|
713
713
|
|
|
714
|
-
def elements(self):
|
|
715
|
-
return ["Party"]
|
|
714
|
+
def elements(self) -> list[str]:
|
|
715
|
+
return ["Party"] + list(self.get_all_subtypes("Party"))
|
|
716
716
|
|
|
717
717
|
def check(self, party: etree._Element) -> None:
|
|
718
718
|
is_independent_element = party.find("IsIndependent")
|
|
@@ -777,7 +777,7 @@ class UniqueStableID(base.TreeRule):
|
|
|
777
777
|
|
|
778
778
|
|
|
779
779
|
class MissingStableIds(base.BaseRule):
|
|
780
|
-
"""Check that each
|
|
780
|
+
"""Check that each CDF object in the feed have a stable Id.
|
|
781
781
|
|
|
782
782
|
Add an error message if stable id is missing from the object.
|
|
783
783
|
"""
|
|
@@ -797,6 +797,7 @@ class MissingStableIds(base.BaseRule):
|
|
|
797
797
|
"PartyContest",
|
|
798
798
|
"Person",
|
|
799
799
|
"ReportingUnit",
|
|
800
|
+
"RetentionContest",
|
|
800
801
|
]
|
|
801
802
|
|
|
802
803
|
def elements(self) -> list[str]:
|
|
@@ -922,10 +923,12 @@ class AllCaps(base.BaseRule):
|
|
|
922
923
|
"""
|
|
923
924
|
|
|
924
925
|
_element_field_mapping = {
|
|
926
|
+
"BallotMeasureContest": ["Name"],
|
|
925
927
|
"Candidate": ["BallotName//Text"],
|
|
926
928
|
"CandidateContest": ["Name"],
|
|
927
929
|
"PartyContest": ["Name"],
|
|
928
930
|
"Person": ["FullName//Text"],
|
|
931
|
+
"RetentionContest": ["Name"],
|
|
929
932
|
}
|
|
930
933
|
|
|
931
934
|
def elements(self) -> list[str]:
|
|
@@ -1505,7 +1508,7 @@ class ValidPartyLeadershipDates(base.DateRule):
|
|
|
1505
1508
|
"""
|
|
1506
1509
|
|
|
1507
1510
|
def elements(self) -> list[str]:
|
|
1508
|
-
return ["
|
|
1511
|
+
return ["Leadership"]
|
|
1509
1512
|
|
|
1510
1513
|
def check(self, element: etree._Element) -> None:
|
|
1511
1514
|
self.reset_instance_vars()
|
|
@@ -1515,11 +1518,11 @@ class ValidPartyLeadershipDates(base.DateRule):
|
|
|
1515
1518
|
raise loggers.ElectionError(self.error_log)
|
|
1516
1519
|
|
|
1517
1520
|
|
|
1518
|
-
class GpUnitsHaveInternationalizedName(base.
|
|
1521
|
+
class GpUnitsHaveInternationalizedName(base.SchemaRule):
|
|
1519
1522
|
"""GpUnits must have at least one non-empty InternationlizedName element."""
|
|
1520
1523
|
|
|
1521
|
-
def elements(self):
|
|
1522
|
-
return ["GpUnit"]
|
|
1524
|
+
def elements(self) -> list[str]:
|
|
1525
|
+
return ["GpUnit"] + list(self.get_all_subtypes("GpUnit"))
|
|
1523
1526
|
|
|
1524
1527
|
def check(self, element: etree._Element) -> None:
|
|
1525
1528
|
intl_names = element.findall("InternationalizedName")
|
|
@@ -1578,6 +1581,9 @@ class MissingFieldsError(base.MissingFieldRule):
|
|
|
1578
1581
|
"Party": [
|
|
1579
1582
|
"PartyScopeGpUnitIds",
|
|
1580
1583
|
],
|
|
1584
|
+
"Coalition": [
|
|
1585
|
+
"PartyScopeGpUnitIds",
|
|
1586
|
+
],
|
|
1581
1587
|
}
|
|
1582
1588
|
|
|
1583
1589
|
|
|
@@ -1786,11 +1792,11 @@ class MultipleInternationalizedTextWithSameLanguageCode(base.BaseRule):
|
|
|
1786
1792
|
)
|
|
1787
1793
|
|
|
1788
1794
|
|
|
1789
|
-
class DeprecatedPartyLeadershipSchema(base.
|
|
1795
|
+
class DeprecatedPartyLeadershipSchema(base.SchemaRule):
|
|
1790
1796
|
"""Errors if the deprecated party leadership schema is used."""
|
|
1791
1797
|
|
|
1792
|
-
def elements(self):
|
|
1793
|
-
return ["Party"]
|
|
1798
|
+
def elements(self) -> list[str]:
|
|
1799
|
+
return ["Party"] + list(self.get_all_subtypes("Party"))
|
|
1794
1800
|
|
|
1795
1801
|
def check(self, element: etree._Element) -> None:
|
|
1796
1802
|
if len(rule_util.get_external_id_values(element, "party-leader-id")) or len(
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_rules.py
RENAMED
|
@@ -59,11 +59,24 @@ def _get_type_or_other_type(element: etree._Element) -> str:
|
|
|
59
59
|
return other_type_text if type_text == "other" else type_text
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
class PercentSum(base.
|
|
63
|
-
"""Check that Contest elements have percents summing to 0 or 100.
|
|
62
|
+
class PercentSum(base.SchemaRule):
|
|
63
|
+
"""Check that Contest elements have percents summing to 0 or 100.
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
Sums the total-percent VoteCounts of every BallotSelection and of the
|
|
66
|
+
Contest's AggregateBallotSelection, BlankBallotSelection,
|
|
67
|
+
NoneOfTheAboveBallotSelection and NullBallotSelection.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
_BALLOT_SELECTION_TAGS = (
|
|
71
|
+
"BallotSelection",
|
|
72
|
+
"AggregateBallotSelection",
|
|
73
|
+
"BlankBallotSelection",
|
|
74
|
+
"NoneOfTheAboveBallotSelection",
|
|
75
|
+
"NullBallotSelection",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def elements(self) -> list[str]:
|
|
79
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
67
80
|
|
|
68
81
|
@staticmethod
|
|
69
82
|
def fuzzy_equals(a: float, b: float, epsilon: float = 1e-6) -> bool:
|
|
@@ -71,9 +84,9 @@ class PercentSum(base.BaseRule):
|
|
|
71
84
|
|
|
72
85
|
def check(self, element: etree._Element) -> None:
|
|
73
86
|
sum_percents = 0.0
|
|
74
|
-
for
|
|
75
|
-
for vote_counts in
|
|
76
|
-
"VoteCounts"
|
|
87
|
+
for ballot_selection_tag in self._BALLOT_SELECTION_TAGS:
|
|
88
|
+
for vote_counts in element.findall(
|
|
89
|
+
f"{ballot_selection_tag}/VoteCountsCollection/VoteCounts"
|
|
77
90
|
):
|
|
78
91
|
other_type = vote_counts.find("OtherType")
|
|
79
92
|
if other_type is not None and other_type.text == "total-percent":
|
|
@@ -691,7 +704,7 @@ class ContestHasMultipleOffices(base.BaseRule):
|
|
|
691
704
|
)
|
|
692
705
|
|
|
693
706
|
|
|
694
|
-
class VoteCountTypesCoherency(base.
|
|
707
|
+
class VoteCountTypesCoherency(base.SchemaRule):
|
|
695
708
|
"""Ensure VoteCount types describe the appropriate votable."""
|
|
696
709
|
|
|
697
710
|
PARTY_VC_TYPES = {
|
|
@@ -707,27 +720,29 @@ class VoteCountTypesCoherency(base.BaseRule):
|
|
|
707
720
|
# Ibid.
|
|
708
721
|
CAND_VC_TYPES = {"candidate-votes"}
|
|
709
722
|
|
|
710
|
-
def elements(self):
|
|
711
|
-
return ["Contest"]
|
|
723
|
+
def elements(self) -> list[str]:
|
|
724
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
712
725
|
|
|
713
726
|
def check(self, element: etree._Element) -> None:
|
|
714
727
|
invalid_vc_types = None
|
|
715
728
|
contest_type = ""
|
|
716
|
-
|
|
729
|
+
element_class = self.get_element_class(element)
|
|
730
|
+
if element_class == "CandidateContest":
|
|
717
731
|
invalid_vc_types = self.PARTY_VC_TYPES
|
|
718
732
|
contest_type = "Candidate"
|
|
719
|
-
elif
|
|
733
|
+
elif element_class == "PartyContest":
|
|
720
734
|
invalid_vc_types = self.CAND_VC_TYPES
|
|
721
735
|
contest_type = "Party"
|
|
722
736
|
if invalid_vc_types:
|
|
723
737
|
errors = []
|
|
724
|
-
for
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
738
|
+
for other_type in element.findall(
|
|
739
|
+
"BallotSelection/VoteCountsCollection/VoteCounts/OtherType"
|
|
740
|
+
):
|
|
741
|
+
if not rule_util.element_has_text(other_type):
|
|
742
|
+
continue
|
|
743
|
+
vc_type = other_type.text.strip()
|
|
744
|
+
if vc_type in invalid_vc_types:
|
|
745
|
+
errors.append(vc_type)
|
|
731
746
|
if errors:
|
|
732
747
|
msg = (
|
|
733
748
|
f"VoteCount types {', '.join(errors)} should not be nested in"
|
|
@@ -740,8 +755,10 @@ class VoteCountValidSeatsDeltaTypes(base.SchemaRule):
|
|
|
740
755
|
"""Ensure VoteCount seats delta types are valid."""
|
|
741
756
|
|
|
742
757
|
def elements(self) -> list[str]:
|
|
743
|
-
return
|
|
744
|
-
|
|
758
|
+
return (
|
|
759
|
+
["BallotSelection"]
|
|
760
|
+
+ list(self.get_all_subtypes("BallotSelection"))
|
|
761
|
+
+ list(self.get_element_names_for_type("SpecialBallotSelection"))
|
|
745
762
|
)
|
|
746
763
|
|
|
747
764
|
def check(self, element: etree._Element) -> None:
|
|
@@ -786,11 +803,11 @@ class OfficeHasjurisdictionSameAsElectoralDistrict(base.BaseRule):
|
|
|
786
803
|
)
|
|
787
804
|
|
|
788
805
|
|
|
789
|
-
class ContestHasValidContestStage(base.
|
|
806
|
+
class ContestHasValidContestStage(base.SchemaRule):
|
|
790
807
|
"""Each Contest must have a valid contest-stage."""
|
|
791
808
|
|
|
792
|
-
def elements(self):
|
|
793
|
-
return ["
|
|
809
|
+
def elements(self) -> list[str]:
|
|
810
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
794
811
|
|
|
795
812
|
def check(self, element: etree._Element) -> None:
|
|
796
813
|
contest_stage_values = [
|
|
@@ -1171,13 +1188,15 @@ class FullTextMaxLength(base.BaseRule):
|
|
|
1171
1188
|
raise loggers.ElectionWarning.from_message(msg, [element])
|
|
1172
1189
|
|
|
1173
1190
|
|
|
1174
|
-
class FullTextOrBallotText(base.
|
|
1191
|
+
class FullTextOrBallotText(base.SchemaRule):
|
|
1175
1192
|
"""Warn if BallotText is missing and FullText is short."""
|
|
1176
1193
|
|
|
1177
1194
|
SUGGESTION_CUTOFF_LENGTH = 2500 # about 3 paragraphs, 250-300 words
|
|
1178
1195
|
|
|
1179
|
-
def elements(self):
|
|
1180
|
-
return ["BallotMeasureContest"]
|
|
1196
|
+
def elements(self) -> list[str]:
|
|
1197
|
+
return ["BallotMeasureContest"] + list(
|
|
1198
|
+
self.get_all_subtypes("BallotMeasureContest")
|
|
1199
|
+
)
|
|
1181
1200
|
|
|
1182
1201
|
def check(self, element: etree._Element) -> None:
|
|
1183
1202
|
full_text_map = rule_util.get_language_to_text_map(element.find("FullText"))
|
|
@@ -1202,11 +1221,13 @@ class FullTextOrBallotText(base.BaseRule):
|
|
|
1202
1221
|
raise loggers.ElectionWarning.from_message(msg, [element])
|
|
1203
1222
|
|
|
1204
1223
|
|
|
1205
|
-
class BallotTitle(base.
|
|
1224
|
+
class BallotTitle(base.SchemaRule):
|
|
1206
1225
|
"""BallotTitle must exist and should usually be shorter than BallotText."""
|
|
1207
1226
|
|
|
1208
|
-
def elements(self):
|
|
1209
|
-
return ["BallotMeasureContest"]
|
|
1227
|
+
def elements(self) -> list[str]:
|
|
1228
|
+
return ["BallotMeasureContest"] + list(
|
|
1229
|
+
self.get_all_subtypes("BallotMeasureContest")
|
|
1230
|
+
)
|
|
1210
1231
|
|
|
1211
1232
|
def check(self, element: etree._Element) -> None:
|
|
1212
1233
|
ballot_title_map = rule_util.get_language_to_text_map(
|
|
@@ -1607,15 +1628,15 @@ class ComposingContestIdsAreValidRelatedContests(base.BaseRule):
|
|
|
1607
1628
|
raise loggers.ElectionError(error_log)
|
|
1608
1629
|
|
|
1609
1630
|
|
|
1610
|
-
class ContestContainsValidStartDate(base.DateRule):
|
|
1631
|
+
class ContestContainsValidStartDate(base.DateRule, base.SchemaRule):
|
|
1611
1632
|
"""Contest elements should contain valid start dates.
|
|
1612
1633
|
|
|
1613
1634
|
A warning will be raised for start dates in the past. These dates are still
|
|
1614
1635
|
valid because the validator could be run during an ongoing election.
|
|
1615
1636
|
"""
|
|
1616
1637
|
|
|
1617
|
-
def elements(self):
|
|
1618
|
-
return ["Contest"]
|
|
1638
|
+
def elements(self) -> list[str]:
|
|
1639
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1619
1640
|
|
|
1620
1641
|
def check(self, element: etree._Element) -> None:
|
|
1621
1642
|
self.reset_instance_vars()
|
|
@@ -1628,15 +1649,15 @@ class ContestContainsValidStartDate(base.DateRule):
|
|
|
1628
1649
|
raise loggers.ElectionWarning(self.error_log)
|
|
1629
1650
|
|
|
1630
1651
|
|
|
1631
|
-
class ContestContainsValidEndDate(base.DateRule):
|
|
1652
|
+
class ContestContainsValidEndDate(base.DateRule, base.SchemaRule):
|
|
1632
1653
|
"""Contest elements should contain valid end dates.
|
|
1633
1654
|
|
|
1634
1655
|
A warning will be raised for end dates in the past. These dates are still
|
|
1635
1656
|
valid because the validator could be run during an ongoing election.
|
|
1636
1657
|
"""
|
|
1637
1658
|
|
|
1638
|
-
def elements(self):
|
|
1639
|
-
return ["Contest"]
|
|
1659
|
+
def elements(self) -> list[str]:
|
|
1660
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1640
1661
|
|
|
1641
1662
|
def check(self, element: etree._Element) -> None:
|
|
1642
1663
|
self.reset_instance_vars()
|
|
@@ -1649,11 +1670,11 @@ class ContestContainsValidEndDate(base.DateRule):
|
|
|
1649
1670
|
raise loggers.ElectionWarning(self.error_log)
|
|
1650
1671
|
|
|
1651
1672
|
|
|
1652
|
-
class ContestEndDateOccursAfterStartDate(base.DateRule):
|
|
1673
|
+
class ContestEndDateOccursAfterStartDate(base.DateRule, base.SchemaRule):
|
|
1653
1674
|
"""Contest elements should have end dates that occur after the start dates."""
|
|
1654
1675
|
|
|
1655
|
-
def elements(self):
|
|
1656
|
-
return ["Contest"]
|
|
1676
|
+
def elements(self) -> list[str]:
|
|
1677
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1657
1678
|
|
|
1658
1679
|
def check(self, element: etree._Element) -> None:
|
|
1659
1680
|
self.reset_instance_vars()
|
|
@@ -1717,15 +1738,17 @@ class ContestEndDateOccursBeforeSubsequentContestStartDate(base.DateRule):
|
|
|
1717
1738
|
raise loggers.ElectionError(self.error_log)
|
|
1718
1739
|
|
|
1719
1740
|
|
|
1720
|
-
class ContestStartDateContainsCorrespondingEndDate(
|
|
1741
|
+
class ContestStartDateContainsCorrespondingEndDate(
|
|
1742
|
+
base.DateRule, base.SchemaRule
|
|
1743
|
+
):
|
|
1721
1744
|
"""Contest start dates must always have corresponding end dates.
|
|
1722
1745
|
|
|
1723
1746
|
A Contest can either have both StartDate and EndDate populated or neither at
|
|
1724
1747
|
all.
|
|
1725
1748
|
"""
|
|
1726
1749
|
|
|
1727
|
-
def elements(self):
|
|
1728
|
-
return ["Contest"]
|
|
1750
|
+
def elements(self) -> list[str]:
|
|
1751
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1729
1752
|
|
|
1730
1753
|
def check(self, element: etree._Element) -> None:
|
|
1731
1754
|
self.reset_instance_vars()
|
|
@@ -1746,11 +1769,11 @@ class ContestStartDateContainsCorrespondingEndDate(base.DateRule):
|
|
|
1746
1769
|
)
|
|
1747
1770
|
|
|
1748
1771
|
|
|
1749
|
-
class ValidatePollsCloseDatetimes(base.
|
|
1772
|
+
class ValidatePollsCloseDatetimes(base.SchemaRule):
|
|
1750
1773
|
"""Checks that LatestPollsClose is not before EarliestPollsClose."""
|
|
1751
1774
|
|
|
1752
|
-
def elements(self):
|
|
1753
|
-
return ["Contest"]
|
|
1775
|
+
def elements(self) -> list[str]:
|
|
1776
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1754
1777
|
|
|
1755
1778
|
def check(self, element: etree._Element) -> None:
|
|
1756
1779
|
earliest_polls_close_element = element.find("EarliestPollsClose")
|
|
@@ -1787,15 +1810,15 @@ class ValidatePollsCloseDatetimes(base.BaseRule):
|
|
|
1787
1810
|
)
|
|
1788
1811
|
|
|
1789
1812
|
|
|
1790
|
-
class ValidateResultsExpected(base.
|
|
1813
|
+
class ValidateResultsExpected(base.SchemaRule):
|
|
1791
1814
|
"""Checks that ResultsExpected is not before the first ResultsReportingStage.
|
|
1792
1815
|
|
|
1793
1816
|
The ResultsExpected datetime must not be before the ExpectedStartDateTime
|
|
1794
1817
|
of the earliest ResultsReportingStage excluding the no-results stage.
|
|
1795
1818
|
"""
|
|
1796
1819
|
|
|
1797
|
-
def elements(self):
|
|
1798
|
-
return ["Contest"]
|
|
1820
|
+
def elements(self) -> list[str]:
|
|
1821
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1799
1822
|
|
|
1800
1823
|
def check(self, element: etree._Element) -> None:
|
|
1801
1824
|
results_expected_element = element.find("ResultsExpected")
|
|
@@ -1854,11 +1877,11 @@ class ValidateResultsExpected(base.BaseRule):
|
|
|
1854
1877
|
)
|
|
1855
1878
|
|
|
1856
1879
|
|
|
1857
|
-
class ValidateResultsEmbargoEnd(base.
|
|
1880
|
+
class ValidateResultsEmbargoEnd(base.SchemaRule):
|
|
1858
1881
|
"""Checks that ResultsEmbargoEnd is not after the official ResultsReportingStage start."""
|
|
1859
1882
|
|
|
1860
|
-
def elements(self):
|
|
1861
|
-
return ["Contest"]
|
|
1883
|
+
def elements(self) -> list[str]:
|
|
1884
|
+
return ["Contest"] + list(self.get_all_subtypes("Contest"))
|
|
1862
1885
|
|
|
1863
1886
|
def check(self, element: etree._Element) -> None:
|
|
1864
1887
|
results_embargo_end_element = element.find("ResultsEmbargoEnd")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/committee_rules.py
RENAMED
|
File without changes
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_dates_rules.py
RENAMED
|
File without changes
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/election_results_rules.py
RENAMED
|
File without changes
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/metadata_rules.py
RENAMED
|
File without changes
|
{civics_cdf_validator-1.69.dev5 → civics_cdf_validator-1.69.dev7}/rulesets/officeholder_rules.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|