civics-cdf-validator 1.47.dev4__tar.gz → 1.47.dev6__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.47.dev4/civics_cdf_validator.egg-info → civics_cdf_validator-1.47.dev6}/PKG-INFO +1 -1
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/gpunit_rules.py +2 -2
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/rules.py +26 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/version.py +1 -1
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/README.md +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/__init__.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/base.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/loggers.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/office_utils.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/setup.cfg +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/setup.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/stats.py +0 -0
- {civics_cdf_validator-1.47.dev4 → civics_cdf_validator-1.47.dev6}/validator.py +0 -0
|
@@ -155,9 +155,9 @@ class OcdIdsExtractor(object):
|
|
|
155
155
|
else:
|
|
156
156
|
if self.check_github:
|
|
157
157
|
last_mod_date = datetime.datetime.fromtimestamp(
|
|
158
|
-
os.path.getmtime(countries_filename))
|
|
158
|
+
os.path.getmtime(countries_filename), datetime.timezone.utc)
|
|
159
159
|
|
|
160
|
-
seconds_since_mod = (datetime.datetime.now() -
|
|
160
|
+
seconds_since_mod = (datetime.datetime.now(datetime.timezone.utc) -
|
|
161
161
|
last_mod_date).total_seconds()
|
|
162
162
|
|
|
163
163
|
# If 1 hour has elapsed, check GitHub for the last file update.
|
|
@@ -2168,6 +2168,31 @@ class ValidJurisdictionID(base.ValidReferenceRule):
|
|
|
2168
2168
|
return {elem.get("objectId") for elem in gp_unit_elements}
|
|
2169
2169
|
|
|
2170
2170
|
|
|
2171
|
+
class OfficeHasjurisdictionSameAsElectoralDistrict(base.BaseRule):
|
|
2172
|
+
"""In election feeds, office has the electoral district same as jurisdiction."""
|
|
2173
|
+
|
|
2174
|
+
def elements(self):
|
|
2175
|
+
return ["Office"]
|
|
2176
|
+
|
|
2177
|
+
def check(self, element):
|
|
2178
|
+
jurisdiction_values = get_entity_info_for_value_type(
|
|
2179
|
+
element, "jurisdiction-id")
|
|
2180
|
+
jurisdiction_values = [
|
|
2181
|
+
j_id.strip() for j_id in jurisdiction_values if j_id.strip()
|
|
2182
|
+
]
|
|
2183
|
+
if not jurisdiction_values or len(jurisdiction_values) > 1:
|
|
2184
|
+
return
|
|
2185
|
+
|
|
2186
|
+
electoral_district = element.find(".//ElectoralDistrictId")
|
|
2187
|
+
if electoral_district is None:
|
|
2188
|
+
return
|
|
2189
|
+
if electoral_district.text.strip() != jurisdiction_values[0]:
|
|
2190
|
+
raise loggers.ElectionInfo.from_message(
|
|
2191
|
+
"Office has electoral district different from jurisdiction.",
|
|
2192
|
+
[element],
|
|
2193
|
+
)
|
|
2194
|
+
|
|
2195
|
+
|
|
2171
2196
|
class OfficesHaveValidOfficeLevel(base.BaseRule):
|
|
2172
2197
|
"""Each office must have a valid office-level."""
|
|
2173
2198
|
|
|
@@ -4085,6 +4110,7 @@ ELECTION_RULES = COMMON_RULES + (
|
|
|
4085
4110
|
ContestEndDateOccursBeforeSubsequentContestStartDate,
|
|
4086
4111
|
ContestStartDateContainsCorrespondingEndDate,
|
|
4087
4112
|
CandidateContestTypesAreCompatible,
|
|
4113
|
+
OfficeHasjurisdictionSameAsElectoralDistrict,
|
|
4088
4114
|
)
|
|
4089
4115
|
|
|
4090
4116
|
ELECTION_RESULTS_RULES = ELECTION_RULES + (
|
|
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
|