civics-cdf-validator 1.67.dev19__tar.gz → 1.67.dev20__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.dev19/civics_cdf_validator.egg-info → civics_cdf_validator-1.67.dev20}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/common_rules.py +40 -0
  4. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/election_rules.py +0 -36
  5. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/version.py +1 -1
  6. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/CONTRIBUTING.md +0 -0
  7. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/LICENSE-2.0.txt +0 -0
  8. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/MANIFEST.in +0 -0
  9. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/README.md +0 -0
  10. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/__init__.py +0 -0
  11. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/base.py +0 -0
  12. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  13. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  14. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  15. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/civics_cdf_validator.egg-info/requires.txt +0 -0
  16. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  17. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/gpunit_rules.py +0 -0
  18. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/loggers.py +0 -0
  19. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/office_utils.py +0 -0
  20. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rules.py +0 -0
  21. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/__init__.py +0 -0
  22. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/committee_rules.py +0 -0
  23. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/election_dates_rules.py +0 -0
  24. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/metadata_rules.py +0 -0
  25. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/officeholder_rules.py +0 -0
  26. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/rule_util.py +0 -0
  27. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/rulesets/voter_information_rules.py +0 -0
  28. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/setup.cfg +0 -0
  29. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/setup.py +0 -0
  30. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/stats.py +0 -0
  31. {civics_cdf_validator-1.67.dev19 → civics_cdf_validator-1.67.dev20}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.67.dev19
3
+ Version: 1.67.dev20
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.dev19
3
+ Version: 1.67.dev20
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
@@ -1938,6 +1938,45 @@ class DuplicatedPartyAbbreviation(ValidatePartyCollection):
1938
1938
  return info_log
1939
1939
 
1940
1940
 
1941
+ class DuplicatedPartyName(ValidatePartyCollection):
1942
+ """Party name should be used once in a given language.
1943
+
1944
+ If a party name is duplicated, the corresponding party should be picked up
1945
+ within this class and returned to the user as an Info message.
1946
+ """
1947
+
1948
+ def check_specific(self, parties):
1949
+ info_log = []
1950
+ party_names_by_language = {}
1951
+ for party in parties:
1952
+ name_element = party.find("Name")
1953
+ if name_element is None:
1954
+ info_log.append(
1955
+ loggers.LogEntry("<Party> does not have <Name> objects", [party])
1956
+ )
1957
+ continue
1958
+ party_names = name_element.findall("Text")
1959
+ for party_name in party_names:
1960
+ language = party_name.get("language")
1961
+ name = party_name.text
1962
+ if language not in party_names_by_language:
1963
+ party_names_by_language[language] = {}
1964
+ if name in party_names_by_language[language]:
1965
+ party_names_by_language[language][name].append(party)
1966
+ else:
1967
+ party_names_by_language[language][name] = [party]
1968
+
1969
+ for language, names in party_names_by_language.items():
1970
+ for name, parties in names.items():
1971
+ if len(parties) > 1:
1972
+ info_log.append(
1973
+ loggers.LogEntry(
1974
+ f"Parties have the same name in {language}.", parties
1975
+ )
1976
+ )
1977
+ return info_log
1978
+
1979
+
1941
1980
  COMMON_RULES = (
1942
1981
  # go/keep-sorted start
1943
1982
  AllCaps,
@@ -1952,6 +1991,7 @@ COMMON_RULES = (
1952
1991
  DuplicateID,
1953
1992
  DuplicatedGpUnitOcdId,
1954
1993
  DuplicatedPartyAbbreviation,
1994
+ DuplicatedPartyName,
1955
1995
  EmptyString,
1956
1996
  EmptyText,
1957
1997
  Encoding,
@@ -541,41 +541,6 @@ class ValidateDuplicateColors(base.TreeRule):
541
541
  raise loggers.ElectionWarning(warning_log)
542
542
 
543
543
 
544
- class DuplicatedPartyName(common_rules.ValidatePartyCollection):
545
- """Party name should be used once in a given language.
546
-
547
- If a party name is duplicated, the corresponding party should be picked up
548
- within this class and returned to the user as an Info message.
549
- """
550
-
551
- def check_specific(self, parties):
552
- info_log = []
553
- party_names_by_language = {}
554
- for party in parties:
555
- name_element = party.find("Name")
556
- if name_element is None:
557
- info_message = "<Party> does not have <Name> objects"
558
- info_log.append(loggers.LogEntry(info_message, [party]))
559
- continue
560
- party_names = name_element.findall("Text")
561
- for party_name in party_names:
562
- language = party_name.get("language")
563
- name = party_name.text
564
- if language not in party_names_by_language:
565
- party_names_by_language[language] = {}
566
- if name in party_names_by_language[language]:
567
- party_names_by_language[language][name].append(party)
568
- else:
569
- party_names_by_language[language][name] = [party]
570
-
571
- for language, names in party_names_by_language.items():
572
- for name, parties in names.items():
573
- if len(parties) > 1:
574
- info_message = "Parties have the same name in %s." % language
575
- info_log.append(loggers.LogEntry(info_message, parties))
576
- return info_log
577
-
578
-
579
544
  class MissingPartyNameTranslation(common_rules.ValidatePartyCollection):
580
545
  """All Parties should have their name translated to the same languages.
581
546
 
@@ -2575,7 +2540,6 @@ ELECTION_RULES = common_rules.COMMON_RULES + (
2575
2540
  DateStatusMatches,
2576
2541
  DuplicateBallotTitleSeatPair,
2577
2542
  DuplicateContestNames,
2578
- DuplicatedPartyName,
2579
2543
  ElectionContainsStartAndEndDates,
2580
2544
  ElectionDatesSpanContestDates,
2581
2545
  ElectionEndDatesInThePast,
@@ -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.dev19'
8
+ __version__ = '1.67.dev20'