civics-cdf-validator 1.66.dev13__tar.gz → 1.67.dev0__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 (22) hide show
  1. {civics_cdf_validator-1.66.dev13/civics_cdf_validator.egg-info → civics_cdf_validator-1.67.dev0}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/rules.py +19 -3
  4. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/version.py +1 -1
  5. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/CONTRIBUTING.md +0 -0
  6. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/LICENSE-2.0.txt +0 -0
  7. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/MANIFEST.in +0 -0
  8. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/README.md +0 -0
  9. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/__init__.py +0 -0
  10. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/base.py +0 -0
  11. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  12. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  13. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  14. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/civics_cdf_validator.egg-info/requires.txt +0 -0
  15. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  16. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/gpunit_rules.py +0 -0
  17. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/loggers.py +0 -0
  18. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/office_utils.py +0 -0
  19. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/setup.cfg +0 -0
  20. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/setup.py +0 -0
  21. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/stats.py +0 -0
  22. {civics_cdf_validator-1.66.dev13 → civics_cdf_validator-1.67.dev0}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.66.dev13
3
+ Version: 1.67.dev0
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.66.dev13
3
+ Version: 1.67.dev0
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
@@ -945,9 +945,10 @@ class CandidatesReferencedInRelatedContests(base.BaseRule):
945
945
  """Candidate should not be referred to by multiple unrelated contests.
946
946
 
947
947
  A Candidate object should only be referenced from one contest, unless the
948
- contests are related (connected by ComposingContestIds). If a Person is
949
- running in multiple unrelated Contests, then that Person is a Candidate
950
- several times over, but a Candida(te|cy) can't span unrelated contests.
948
+ contests are related (connected by ComposingContestIds or
949
+ SubsequentContestId). If a Person is running in multiple unrelated Contests,
950
+ then that Person is a Candidate several times over, but a Candida(te|cy)
951
+ can't span unrelated contests.
951
952
  """
952
953
 
953
954
  def __init__(self, election_tree, schema_tree, **kwargs):
@@ -1005,6 +1006,21 @@ class CandidatesReferencedInRelatedContests(base.BaseRule):
1005
1006
  self.contest_graph.add_node(contest.get("objectId"))
1006
1007
 
1007
1008
  for contest in contests:
1009
+ subsequent_contest = contest.find("SubsequentContestId")
1010
+ if element_has_text(subsequent_contest):
1011
+ subsequent_contest_id = subsequent_contest.text
1012
+ # subsequent contest id is not valid if it isn't in the graph
1013
+ if not self.contest_graph.has_node(subsequent_contest_id):
1014
+ raise loggers.ElectionError.from_message(
1015
+ (
1016
+ "Contest {} contains a subsequent Contest Id ({}) that does "
1017
+ "not exist."
1018
+ ).format(contest.get("objectId"), subsequent_contest_id),
1019
+ [subsequent_contest],
1020
+ )
1021
+ self.contest_graph.add_edge(
1022
+ contest.get("objectId"), subsequent_contest_id
1023
+ )
1008
1024
  # Add the composing contest if it exists
1009
1025
  composing_contests = contest.find("ComposingContestIds")
1010
1026
  if element_has_text(composing_contests):
@@ -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.66.dev13'
8
+ __version__ = '1.67.dev0'