civics-cdf-validator 1.61.dev6__tar.gz → 1.61.dev7__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.
- {civics_cdf_validator-1.61.dev6/civics_cdf_validator.egg-info → civics_cdf_validator-1.61.dev7}/PKG-INFO +1 -1
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/rules.py +27 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/version.py +1 -1
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/README.md +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/__init__.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/base.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/loggers.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/office_utils.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/setup.cfg +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/setup.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/stats.py +0 -0
- {civics_cdf_validator-1.61.dev6 → civics_cdf_validator-1.61.dev7}/validator.py +0 -0
|
@@ -25,6 +25,7 @@ from civics_cdf_validator import base
|
|
|
25
25
|
from civics_cdf_validator import gpunit_rules
|
|
26
26
|
from civics_cdf_validator import loggers
|
|
27
27
|
from civics_cdf_validator import office_utils
|
|
28
|
+
import dateutil
|
|
28
29
|
from frozendict import frozendict
|
|
29
30
|
import language_tags
|
|
30
31
|
from lxml import etree
|
|
@@ -4830,6 +4831,31 @@ class FeedHasValidCountryCode(base.BaseRule):
|
|
|
4830
4831
|
)
|
|
4831
4832
|
|
|
4832
4833
|
|
|
4834
|
+
class FeedInactiveDateNotOlderThanOneYear(base.BaseRule):
|
|
4835
|
+
"""Feeds should not have a FeedInactiveDate older than 1 year."""
|
|
4836
|
+
|
|
4837
|
+
def elements(self):
|
|
4838
|
+
return ["Feed"]
|
|
4839
|
+
|
|
4840
|
+
def check(self, element):
|
|
4841
|
+
feed_inactive_date_element = element.find("FeedInactiveDate")
|
|
4842
|
+
if not element_has_text(feed_inactive_date_element):
|
|
4843
|
+
return
|
|
4844
|
+
feed_inactive_date = datetime.date.fromisoformat(
|
|
4845
|
+
feed_inactive_date_element.text
|
|
4846
|
+
)
|
|
4847
|
+
one_year_ago = datetime.date.today() - dateutil.relativedelta.relativedelta(
|
|
4848
|
+
years=1
|
|
4849
|
+
)
|
|
4850
|
+
if feed_inactive_date < one_year_ago:
|
|
4851
|
+
feed_id_element = element.find("FeedId")
|
|
4852
|
+
raise loggers.ElectionError.from_message(
|
|
4853
|
+
f"FeedInactiveDate '{feed_inactive_date_element.text}' is older than"
|
|
4854
|
+
f" 1 year for feed '{feed_id_element.text}'.",
|
|
4855
|
+
[element],
|
|
4856
|
+
)
|
|
4857
|
+
|
|
4858
|
+
|
|
4833
4859
|
class FeedInactiveDateSetForNonEvergreenFeed(base.BaseRule):
|
|
4834
4860
|
"""All non-evergreen feeds should have a FeedInactiveDate set."""
|
|
4835
4861
|
|
|
@@ -5663,6 +5689,7 @@ METADATA_RULES = (
|
|
|
5663
5689
|
FeedHasValidCountryCode,
|
|
5664
5690
|
FeedIdsAreUnique,
|
|
5665
5691
|
FeedInactiveDateIsLatestDate,
|
|
5692
|
+
FeedInactiveDateNotOlderThanOneYear,
|
|
5666
5693
|
FeedInactiveDateSetForNonEvergreenFeed,
|
|
5667
5694
|
FeedTypeHasValidFeedLongevity,
|
|
5668
5695
|
OfficeholderSubFeedDatesAreSequential,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|