civics-cdf-validator 1.67.dev15__tar.gz → 1.67.dev17__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.
Files changed (31) hide show
  1. {civics_cdf_validator-1.67.dev15/civics_cdf_validator.egg-info → civics_cdf_validator-1.67.dev17}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/common_rules.py +43 -0
  4. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/election_rules.py +0 -42
  5. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/version.py +1 -1
  6. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/CONTRIBUTING.md +0 -0
  7. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/LICENSE-2.0.txt +0 -0
  8. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/MANIFEST.in +0 -0
  9. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/README.md +0 -0
  10. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/__init__.py +0 -0
  11. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/base.py +0 -0
  12. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  13. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  14. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  15. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/civics_cdf_validator.egg-info/requires.txt +0 -0
  16. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  17. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/gpunit_rules.py +0 -0
  18. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/loggers.py +0 -0
  19. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/office_utils.py +0 -0
  20. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rules.py +0 -0
  21. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/__init__.py +0 -0
  22. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/committee_rules.py +0 -0
  23. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/election_dates_rules.py +0 -0
  24. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/metadata_rules.py +0 -0
  25. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/officeholder_rules.py +0 -0
  26. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/rule_util.py +0 -0
  27. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/rulesets/voter_information_rules.py +0 -0
  28. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/setup.cfg +0 -0
  29. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/setup.py +0 -0
  30. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/stats.py +0 -0
  31. {civics_cdf_validator-1.67.dev15 → civics_cdf_validator-1.67.dev17}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.67.dev15
3
+ Version: 1.67.dev17
4
4
  Summary: Checks if an election feed follows best practices
5
5
  Home-page: https://github.com/google/civics_cdf_validator
6
6
  Author: Google Civics
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.67.dev15
3
+ Version: 1.67.dev17
4
4
  Summary: Checks if an election feed follows best practices
5
5
  Home-page: https://github.com/google/civics_cdf_validator
6
6
  Author: Google Civics
@@ -83,6 +83,31 @@ _UNTYPED_URI_PLATFORMS = frozenset([
83
83
 
84
84
  _ALL_URI_PLATFORMS = _TYPED_URI_PLATFORMS | _UNTYPED_URI_PLATFORMS
85
85
 
86
+ _INTERNATIONALIZED_TEXT_ELEMENTS_WITH_ONLY_ONE_TEXT_PER_LANGUAGE = [
87
+ # go/keep-sorted start
88
+ "BallotName",
89
+ "BallotSubTitle",
90
+ "BallotText",
91
+ "BallotTitle",
92
+ "ConStatement",
93
+ "Directions",
94
+ "DisplayName",
95
+ "EffectOfAbstain",
96
+ "FullName",
97
+ "FullText",
98
+ "InternationalizedAbbreviation",
99
+ "InternationalizedName",
100
+ "Name",
101
+ "PartyLabel",
102
+ "PassageThreshold",
103
+ "ProStatement",
104
+ "Profession",
105
+ "Selection",
106
+ "SummaryText",
107
+ "Title",
108
+ # go/keep-sorted end
109
+ ]
110
+
86
111
 
87
112
  def _get_office_roles(element, is_post_office_split_feed=False):
88
113
  if is_post_office_split_feed:
@@ -1707,6 +1732,23 @@ class AllInternationalizedTextHaveEnVersion(base.BaseRule):
1707
1732
  )
1708
1733
 
1709
1734
 
1735
+ class MultipleInternationalizedTextWithSameLanguageCode(base.BaseRule):
1736
+ """Checks for multiple InternationalizedText with the same language code."""
1737
+
1738
+ def elements(self):
1739
+ return _INTERNATIONALIZED_TEXT_ELEMENTS_WITH_ONLY_ONE_TEXT_PER_LANGUAGE
1740
+
1741
+ def check(self, element):
1742
+ language_map = rule_util.get_language_to_text_map(element)
1743
+
1744
+ for language, texts in language_map.items():
1745
+ if len(texts) > 1:
1746
+ raise loggers.ElectionError.from_message(
1747
+ f'Multiple "{language}" texts found for "{texts[0].strip()}"',
1748
+ [element],
1749
+ )
1750
+
1751
+
1710
1752
  class DeprecatedPartyLeadershipSchema(base.BaseRule):
1711
1753
  """Errors if the deprecated party leadership schema is used."""
1712
1754
 
@@ -1842,6 +1884,7 @@ COMMON_RULES = (
1842
1884
  MissingFieldsWarning,
1843
1885
  MissingOfficeSelectionMethod,
1844
1886
  MissingStableIds,
1887
+ MultipleInternationalizedTextWithSameLanguageCode,
1845
1888
  NonExecutiveOfficeShouldHaveGovernmentBody,
1846
1889
  OfficesHaveJurisdictionID,
1847
1890
  OfficesHaveValidOfficeLevel,
@@ -35,31 +35,6 @@ _CONTEST_STAGE_TYPES = frozenset([
35
35
  "unnamed",
36
36
  ])
37
37
 
38
- _INTERNATIONALIZED_TEXT_ELEMENTS_WITH_ONLY_ONE_TEXT_PER_LANGUAGE = [
39
- # go/keep-sorted start
40
- "BallotName",
41
- "BallotSubTitle",
42
- "BallotText",
43
- "BallotTitle",
44
- "ConStatement",
45
- "Directions",
46
- "DisplayName",
47
- "EffectOfAbstain",
48
- "FullName",
49
- "FullText",
50
- "InternationalizedAbbreviation",
51
- "InternationalizedName",
52
- "Name",
53
- "PartyLabel",
54
- "PassageThreshold",
55
- "ProStatement",
56
- "Profession",
57
- "Selection",
58
- "SummaryText",
59
- "Title",
60
- # go/keep-sorted end
61
- ]
62
-
63
38
 
64
39
  _WINNER_POST_ELECTION_STATUSES = frozenset([
65
40
  "winner",
@@ -1847,22 +1822,6 @@ class ComposingContestIdsAreValidRelatedContests(base.BaseRule):
1847
1822
  raise loggers.ElectionError(error_log)
1848
1823
 
1849
1824
 
1850
- class MultipleInternationalizedTextWithSameLanguageCode(base.BaseRule):
1851
- """Checks for multiple InternationalizedText with the same language code."""
1852
-
1853
- def elements(self):
1854
- return _INTERNATIONALIZED_TEXT_ELEMENTS_WITH_ONLY_ONE_TEXT_PER_LANGUAGE
1855
-
1856
- def check(self, element):
1857
- language_map = rule_util.get_language_to_text_map(element)
1858
-
1859
- for language, texts in language_map.items():
1860
- if len(texts) > 1:
1861
- raise loggers.ElectionError.from_message(
1862
- 'Multiple "%s" texts found for "%s"' % (language, texts[0].strip())
1863
- )
1864
-
1865
-
1866
1825
  class ContestContainsValidStartDate(base.DateRule):
1867
1826
  """Contest elements should contain valid start dates.
1868
1827
 
@@ -2709,7 +2668,6 @@ ELECTION_RULES = common_rules.COMMON_RULES + (
2709
2668
  MissingPartyAbbreviationTranslation,
2710
2669
  MissingPartyNameTranslation,
2711
2670
  MultipleCandidatesPointToTheSamePersonInTheSameContest,
2712
- MultipleInternationalizedTextWithSameLanguageCode,
2713
2671
  NotEmptyUniqueDataSourceUris,
2714
2672
  OfficeHasjurisdictionSameAsElectoralDistrict,
2715
2673
  PartisanPrimary,
@@ -5,4 +5,4 @@ No dependencies should be added to this module.
5
5
  See https://packaging.python.org/guides/single-sourcing-package-version/
6
6
  """
7
7
 
8
- __version__ = '1.67.dev15'
8
+ __version__ = '1.67.dev17'