civics-cdf-validator 1.64.dev2__tar.gz → 1.64.dev4__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.64.dev2/civics_cdf_validator.egg-info → civics_cdf_validator-1.64.dev4}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/rules.py +16 -49
  4. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/version.py +1 -1
  5. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/CONTRIBUTING.md +0 -0
  6. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/LICENSE-2.0.txt +0 -0
  7. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/MANIFEST.in +0 -0
  8. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/README.md +0 -0
  9. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/__init__.py +0 -0
  10. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/base.py +0 -0
  11. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  12. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  13. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  14. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/civics_cdf_validator.egg-info/requires.txt +0 -0
  15. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  16. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/gpunit_rules.py +0 -0
  17. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/loggers.py +0 -0
  18. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/office_utils.py +0 -0
  19. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/setup.cfg +0 -0
  20. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/setup.py +0 -0
  21. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/stats.py +0 -0
  22. {civics_cdf_validator-1.64.dev2 → civics_cdf_validator-1.64.dev4}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.64.dev2
3
+ Version: 1.64.dev4
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.64.dev2
3
+ Version: 1.64.dev4
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
@@ -2191,57 +2191,24 @@ class VoteCountValidSeatsDeltaTypes(base.BaseRule):
2191
2191
  """Ensure VoteCount seats delta types are valid."""
2192
2192
 
2193
2193
  def elements(self):
2194
- return ["Contest"]
2194
+ return ["BallotSelection"] + list(
2195
+ self.get_element_names_for_type("SpecialBallotSelection")
2196
+ )
2195
2197
 
2196
2198
  def check(self, element):
2197
- if element.get("type", "") == "PartyContest":
2198
- for ballot_selection in element.findall("BallotSelection"):
2199
- ballot_selection_vote_types = []
2200
- ballot_selection_obj_id = ballot_selection.get("objectId")
2201
- for vote_counts in ballot_selection.find(
2202
- "VoteCountsCollection"
2203
- ).findall("VoteCounts"):
2204
- vote_count_type = vote_counts.find("OtherType").text
2205
- ballot_selection_vote_types.append(vote_count_type)
2206
- if (
2207
- "seats-delta" in ballot_selection_vote_types
2208
- and "seats-delta-mandate" in ballot_selection_vote_types
2209
- ):
2210
- msg = (
2211
- "The VoteCount types seats-delta and seats-delta-mandate should"
2212
- " not coexist within the same BallotSelection (objectId={})."
2213
- " They represent the same data, and seats-delta is scheduled"
2214
- " for deprecation."
2215
- ).format(ballot_selection_obj_id)
2216
- raise loggers.ElectionWarning.from_message(msg, [element])
2217
- if (
2218
- "seats-delta-institutional" in ballot_selection_vote_types
2219
- and "seats-delta-mandate" not in ballot_selection_vote_types
2220
- ):
2221
- msg = (
2222
- "Missing required field VoteCount type seats-delta-mandate must"
2223
- " be included whenever VoteCount type seats-delta-institutional"
2224
- " is present. (BallotSelection objectId={})"
2225
- ).format(ballot_selection_obj_id)
2226
- raise loggers.ElectionError.from_message(msg, [element])
2227
- if "seats-delta" in ballot_selection_vote_types:
2228
- current_date = datetime.datetime.now()
2229
- deletion_date = datetime.datetime(2026, 7, 1)
2230
- # If current date is before July 1st, 2026
2231
- if current_date < deletion_date:
2232
- msg = (
2233
- "VoteCount type seats-delta is deprecated and will be removed"
2234
- " on July 1, 2026. Please update your implementation to use"
2235
- " seats-delta-mandate. (BallotSelection objectId={})"
2236
- ).format(ballot_selection_obj_id)
2237
- raise loggers.ElectionWarning.from_message(msg, [element])
2238
- else:
2239
- msg = (
2240
- "VoteCount type seats-delta is deprecated and was removed on"
2241
- " July 1, 2026. Please update your implementation to use"
2242
- " seats-delta-mandate. (BallotSelection objectId={})"
2243
- ).format(ballot_selection_obj_id)
2244
- raise loggers.ElectionError.from_message(msg, [element])
2199
+ vote_count_types = set()
2200
+ vote_counts_collection = element.find("VoteCountsCollection")
2201
+ if vote_counts_collection is None:
2202
+ return
2203
+ for vote_counts in vote_counts_collection.findall("VoteCounts"):
2204
+ vote_count_types.add(_get_type_or_other_type(vote_counts))
2205
+ if "seats-delta" in vote_count_types:
2206
+ raise loggers.ElectionError.from_message(
2207
+ "Legacy VoteCounts type seats-delta is no longer supported as of"
2208
+ " July 1, 2026. Please update your implementation to use"
2209
+ " seats-delta-mandate and/or seats-delta-institutional.",
2210
+ [element],
2211
+ )
2245
2212
 
2246
2213
 
2247
2214
  class URIValidator(base.BaseRule):
@@ -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.64.dev2'
8
+ __version__ = '1.64.dev4'