civics-cdf-validator 1.49.dev1__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.dev1/civics_cdf_validator.egg-info → civics_cdf_validator-1.49.dev3}/PKG-INFO +3 -2
  2. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3/civics_cdf_validator.egg-info}/PKG-INFO +3 -2
  3. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/rules.py +50 -6
  4. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/version.py +1 -1
  5. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/CONTRIBUTING.md +0 -0
  6. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/LICENSE-2.0.txt +0 -0
  7. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/MANIFEST.in +0 -0
  8. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/README.md +0 -0
  9. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/__init__.py +0 -0
  10. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/base.py +0 -0
  11. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
  12. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
  13. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
  14. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/requires.txt +0 -0
  15. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/civics_cdf_validator.egg-info/top_level.txt +0 -0
  16. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/gpunit_rules.py +0 -0
  17. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/loggers.py +0 -0
  18. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/office_utils.py +0 -0
  19. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/setup.cfg +0 -0
  20. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/setup.py +0 -0
  21. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/stats.py +0 -0
  22. {civics_cdf_validator-1.49.dev1 → civics_cdf_validator-1.49.dev3}/validator.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.49.dev1
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
@@ -22,6 +22,7 @@ Dynamic: author-email
22
22
  Dynamic: description
23
23
  Dynamic: home-page
24
24
  Dynamic: license
25
+ Dynamic: license-file
25
26
  Dynamic: maintainer
26
27
  Dynamic: maintainer-email
27
28
  Dynamic: requires-dist
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: civics_cdf_validator
3
- Version: 1.49.dev1
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
@@ -22,6 +22,7 @@ Dynamic: author-email
22
22
  Dynamic: description
23
23
  Dynamic: home-page
24
24
  Dynamic: license
25
+ Dynamic: license-file
25
26
  Dynamic: maintainer
26
27
  Dynamic: maintainer-email
27
28
  Dynamic: requires-dist
@@ -4323,11 +4323,7 @@ class UnreferencedEntitiesOfficeholders(UnreferencedEntitiesBase):
4323
4323
 
4324
4324
 
4325
4325
  class DeprecatedPartyLeadershipSchema(base.BaseRule):
4326
- """Warns if the deprecated party leadership schema is used.
4327
-
4328
- This rule will eventually become an error once feeds are migrated to the new
4329
- schema.
4330
- """
4326
+ """Errors if the deprecated party leadership schema is used."""
4331
4327
 
4332
4328
  def elements(self):
4333
4329
  return ["Party"]
@@ -4336,7 +4332,7 @@ class DeprecatedPartyLeadershipSchema(base.BaseRule):
4336
4332
  if len(get_external_id_values(element, "party-leader-id")) or len(
4337
4333
  get_external_id_values(element, "party-chair-id")
4338
4334
  ):
4339
- raise loggers.ElectionWarning.from_message(
4335
+ raise loggers.ElectionError.from_message(
4340
4336
  "Specifying party leadership via external identifiers is deprecated."
4341
4337
  " Please use the PartyLeadership element instead."
4342
4338
  )
@@ -4362,6 +4358,52 @@ class GovernmentBodyExternalId(base.BaseRule):
4362
4358
  )
4363
4359
 
4364
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
+
4365
4407
  class RuleSet(enum.Enum):
4366
4408
  """Names for sets of rules used to validate a particular feed type."""
4367
4409
 
@@ -4416,6 +4458,8 @@ COMMON_RULES = (
4416
4458
  UniqueLabel,
4417
4459
  UniqueStableID,
4418
4460
  UniqueURIPerAnnotationCategory,
4461
+ UnsupportedOfficeHolderTenureSchema,
4462
+ UnsupportedOfficeSchema,
4419
4463
  ValidEnumerations,
4420
4464
  ValidIDREF,
4421
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.dev1'
8
+ __version__ = '1.49.dev3'