civics-cdf-validator 1.49.dev2__tar.gz → 1.49.dev3__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.49.dev2/civics_cdf_validator.egg-info → civics_cdf_validator-1.49.dev3}/PKG-INFO +1 -1
  2. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
  3. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/rules.py +48 -0
  4. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/version.py +1 -1
  5. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/CONTRIBUTING.md +0 -0
  6. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/LICENSE-2.0.txt +0 -0
  7. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/MANIFEST.in +0 -0
  8. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/README.md +0 -0
  9. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/__init__.py +0 -0
  10. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/base.py +0 -0
  11. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  12. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  13. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  14. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/requires.txt +0 -0
  15. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  16. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/gpunit_rules.py +0 -0
  17. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/loggers.py +0 -0
  18. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/office_utils.py +0 -0
  19. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/setup.cfg +0 -0
  20. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/setup.py +0 -0
  21. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/stats.py +0 -0
  22. {civics_cdf_validator-1.49.dev2 → civics_cdf_validator-1.49.dev3}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.49.dev2
3
+ Version: 1.49.dev3
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.49.dev2
3
+ Version: 1.49.dev3
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
@@ -4358,6 +4358,52 @@ class GovernmentBodyExternalId(base.BaseRule):
4358
4358
  )
4359
4359
 
4360
4360
 
4361
+ class UnsupportedOfficeSchema(base.BaseRule):
4362
+ """Fails if new unsupported office schema is used in the feed.
4363
+
4364
+ This rule will eventually be removed once the new schema is supported.
4365
+ """
4366
+
4367
+ def elements(self):
4368
+ return ["Office"]
4369
+
4370
+ def check(self, element):
4371
+ if element.find("JurisdictionId") is not None:
4372
+ raise loggers.ElectionError.from_message(
4373
+ "Specifying JurisdictionId on Office is not yet supported."
4374
+ )
4375
+ if element.find("Level") is not None:
4376
+ raise loggers.ElectionError.from_message(
4377
+ "Specifying Level on Office is not yet supported."
4378
+ )
4379
+ if element.find("Role") is not None:
4380
+ raise loggers.ElectionError.from_message(
4381
+ "Specifying Role on Office is not yet supported."
4382
+ )
4383
+ if len(element.findall("SelectionMethod")) > 1:
4384
+ raise loggers.ElectionError.from_message(
4385
+ "Specifying multiple SelectionMethod elements on Office is not yet "
4386
+ "supported."
4387
+ )
4388
+
4389
+
4390
+ class UnsupportedOfficeHolderTenureSchema(base.BaseRule):
4391
+ """Fails if new unsupported officeholder tenure schema is used in the feed.
4392
+
4393
+ This rule will eventually be removed once the new schema is supported.
4394
+ """
4395
+
4396
+ def elements(self):
4397
+ return ["ElectionReport"]
4398
+
4399
+ def check(self, element):
4400
+ if element.find("OfficeHolderTenureCollection") is not None:
4401
+ raise loggers.ElectionError.from_message(
4402
+ "Specifying OfficeHolderTenureCollection on ElectionReport is not "
4403
+ "yet supported."
4404
+ )
4405
+
4406
+
4361
4407
  class RuleSet(enum.Enum):
4362
4408
  """Names for sets of rules used to validate a particular feed type."""
4363
4409
 
@@ -4412,6 +4458,8 @@ COMMON_RULES = (
4412
4458
  UniqueLabel,
4413
4459
  UniqueStableID,
4414
4460
  UniqueURIPerAnnotationCategory,
4461
+ UnsupportedOfficeHolderTenureSchema,
4462
+ UnsupportedOfficeSchema,
4415
4463
  ValidEnumerations,
4416
4464
  ValidIDREF,
4417
4465
  ValidJurisdictionID,
@@ -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.49.dev2'
8
+ __version__ = '1.49.dev3'