civics-cdf-validator 1.66.dev0__tar.gz → 1.66.dev2__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.dev0/civics_cdf_validator.egg-info → civics_cdf_validator-1.66.dev2}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/rules.py +25 -2
  4. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/version.py +1 -1
  5. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/CONTRIBUTING.md +0 -0
  6. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/LICENSE-2.0.txt +0 -0
  7. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/MANIFEST.in +0 -0
  8. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/README.md +0 -0
  9. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/__init__.py +0 -0
  10. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/base.py +0 -0
  11. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  12. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  13. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  14. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/civics_cdf_validator.egg-info/requires.txt +0 -0
  15. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  16. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/gpunit_rules.py +0 -0
  17. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/loggers.py +0 -0
  18. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/office_utils.py +0 -0
  19. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/setup.cfg +0 -0
  20. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/setup.py +0 -0
  21. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/stats.py +0 -0
  22. {civics_cdf_validator-1.66.dev0 → civics_cdf_validator-1.66.dev2}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.66.dev0
3
+ Version: 1.66.dev2
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.dev0
3
+ Version: 1.66.dev2
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
@@ -1710,6 +1710,27 @@ class PersonsMissingPartyData(base.BaseRule):
1710
1710
  )
1711
1711
 
1712
1712
 
1713
+ class CandidateImageInContactInformation(base.BaseRule):
1714
+ """Warn if candidate-image is set in ContactInformation.Uri."""
1715
+
1716
+ def elements(self):
1717
+ return ["ContactInformation"]
1718
+
1719
+ def check(self, element):
1720
+ candidate_image_uris = []
1721
+ for uri in element.findall("Uri"):
1722
+ annotation = uri.get("Annotation", "").strip()
1723
+ if annotation == "candidate-image":
1724
+ candidate_image_uris.append(uri)
1725
+
1726
+ if candidate_image_uris:
1727
+ raise loggers.ElectionWarning.from_message(
1728
+ "Annotation 'candidate-image' in ContactInformation.Uri is"
1729
+ " deprecated. Please use Person.ImageUri instead.",
1730
+ candidate_image_uris,
1731
+ )
1732
+
1733
+
1713
1734
  class OnlyOneCandidateImagePerPerson(base.BaseRule):
1714
1735
  """Ensure only one candidate-image is provided per Person."""
1715
1736
 
@@ -2386,8 +2407,9 @@ class ValidURIAnnotation(base.BaseRule):
2386
2407
  "URI {} is missing annotation.".format(ascii_url), [uri]
2387
2408
  )
2388
2409
 
2389
- # Skip platform checks for office contact form annotations.
2390
- if annotation == "office-contact_form":
2410
+ # Skip platform checks for office contact form and candidate-image
2411
+ # annotations.
2412
+ if annotation in ("office-contact_form", "candidate-image"):
2391
2413
  continue
2392
2414
 
2393
2415
  ann_elements = annotation.split("-")
@@ -5500,6 +5522,7 @@ COMMON_RULES = (
5500
5522
  AllInternationalizedTextHaveEnVersion,
5501
5523
  AllLanguages,
5502
5524
  BadCharactersInPersonFullName,
5525
+ CandidateImageInContactInformation,
5503
5526
  DeprecatedPartyLeadershipSchema,
5504
5527
  DuplicateGpUnits,
5505
5528
  DuplicateID,
@@ -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.dev0'
8
+ __version__ = '1.66.dev2'