civics-cdf-validator 1.65.dev0__tar.gz → 1.65.dev1__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.65.dev0/civics_cdf_validator.egg-info → civics_cdf_validator-1.65.dev1}/PKG-INFO +2 -1
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1/civics_cdf_validator.egg-info}/PKG-INFO +2 -1
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/civics_cdf_validator.egg-info/requires.txt +1 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/rules.py +57 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/setup.py +1 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/version.py +1 -1
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/README.md +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/__init__.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/base.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/loggers.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/office_utils.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/setup.cfg +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/stats.py +0 -0
- {civics_cdf_validator-1.65.dev0 → civics_cdf_validator-1.65.dev1}/validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: civics_cdf_validator
|
|
3
|
-
Version: 1.65.
|
|
3
|
+
Version: 1.65.dev1
|
|
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
|
|
@@ -18,6 +18,7 @@ Requires-Dist: frozendict>=2.4.4
|
|
|
18
18
|
Requires-Dist: attrs>=25.1.0
|
|
19
19
|
Requires-Dist: python-dateutil>=2.8.1
|
|
20
20
|
Requires-Dist: six
|
|
21
|
+
Requires-Dist: botocore
|
|
21
22
|
Provides-Extra: test
|
|
22
23
|
Requires-Dist: pytest; extra == "test"
|
|
23
24
|
Requires-Dist: absl-py; extra == "test"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: civics_cdf_validator
|
|
3
|
-
Version: 1.65.
|
|
3
|
+
Version: 1.65.dev1
|
|
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
|
|
@@ -18,6 +18,7 @@ Requires-Dist: frozendict>=2.4.4
|
|
|
18
18
|
Requires-Dist: attrs>=25.1.0
|
|
19
19
|
Requires-Dist: python-dateutil>=2.8.1
|
|
20
20
|
Requires-Dist: six
|
|
21
|
+
Requires-Dist: botocore
|
|
21
22
|
Provides-Extra: test
|
|
22
23
|
Requires-Dist: pytest; extra == "test"
|
|
23
24
|
Requires-Dist: absl-py; extra == "test"
|
|
@@ -21,6 +21,7 @@ import enum
|
|
|
21
21
|
import hashlib
|
|
22
22
|
import re
|
|
23
23
|
|
|
24
|
+
from botocore import utils as botocore_utils
|
|
24
25
|
from civics_cdf_validator import base
|
|
25
26
|
from civics_cdf_validator import gpunit_rules
|
|
26
27
|
from civics_cdf_validator import loggers
|
|
@@ -4565,6 +4566,61 @@ class SourceDirPathsAreUnique(base.BaseRule):
|
|
|
4565
4566
|
raise loggers.ElectionError(error_log)
|
|
4566
4567
|
|
|
4567
4568
|
|
|
4569
|
+
_ARN_PARSER = botocore_utils.ArnParser()
|
|
4570
|
+
|
|
4571
|
+
|
|
4572
|
+
class SqsQueueNameIsFullyQualifiedArn(base.BaseRule):
|
|
4573
|
+
"""SqsQueueName must be a valid fully qualified ARN.
|
|
4574
|
+
|
|
4575
|
+
Only AWS region ARNs are supported.
|
|
4576
|
+
"""
|
|
4577
|
+
|
|
4578
|
+
def elements(self):
|
|
4579
|
+
return ["Feed"]
|
|
4580
|
+
|
|
4581
|
+
def check(self, element):
|
|
4582
|
+
sqs_queue_name = element.find("SqsQueueName")
|
|
4583
|
+
if not element_has_text(sqs_queue_name):
|
|
4584
|
+
return
|
|
4585
|
+
queue_name = sqs_queue_name.text.strip()
|
|
4586
|
+
feed_id_element = element.find("FeedId")
|
|
4587
|
+
feed_id = (
|
|
4588
|
+
feed_id_element.text.strip()
|
|
4589
|
+
if element_has_text(feed_id_element)
|
|
4590
|
+
else ""
|
|
4591
|
+
)
|
|
4592
|
+
|
|
4593
|
+
is_valid = False
|
|
4594
|
+
if queue_name.startswith("arn:"):
|
|
4595
|
+
try:
|
|
4596
|
+
arn_dict = _ARN_PARSER.parse_arn(queue_name)
|
|
4597
|
+
is_valid = bool(
|
|
4598
|
+
arn_dict.get("partition") == "aws"
|
|
4599
|
+
and arn_dict.get("service", "").lower() == "sqs"
|
|
4600
|
+
and arn_dict.get("region")
|
|
4601
|
+
and arn_dict.get("account")
|
|
4602
|
+
and arn_dict.get("resource")
|
|
4603
|
+
)
|
|
4604
|
+
except botocore_utils.InvalidArnException:
|
|
4605
|
+
is_valid = False
|
|
4606
|
+
|
|
4607
|
+
if not is_valid:
|
|
4608
|
+
if feed_id:
|
|
4609
|
+
error_message = (
|
|
4610
|
+
f"SqsQueueName '{queue_name}' is not a valid fully qualified ARN"
|
|
4611
|
+
f" for feed {feed_id}."
|
|
4612
|
+
)
|
|
4613
|
+
else:
|
|
4614
|
+
error_message = (
|
|
4615
|
+
f"SqsQueueName '{queue_name}' is not a valid fully qualified ARN."
|
|
4616
|
+
)
|
|
4617
|
+
raise loggers.ElectionError.from_message(
|
|
4618
|
+
error_message,
|
|
4619
|
+
[element],
|
|
4620
|
+
[sqs_queue_name.sourceline],
|
|
4621
|
+
)
|
|
4622
|
+
|
|
4623
|
+
|
|
4568
4624
|
class SqsQueueNameRequiresS3SourceDirPath(base.BaseRule):
|
|
4569
4625
|
"""If SqsQueueName is set, SourceDirPath must also be set and must be an s3 path."""
|
|
4570
4626
|
|
|
@@ -5616,6 +5672,7 @@ METADATA_RULES = (
|
|
|
5616
5672
|
Schema,
|
|
5617
5673
|
SourceDirPathMustBeSetAfterInitialDeliveryDate,
|
|
5618
5674
|
SourceDirPathsAreUnique,
|
|
5675
|
+
SqsQueueNameIsFullyQualifiedArn,
|
|
5619
5676
|
SqsQueueNameRequiresS3SourceDirPath,
|
|
5620
5677
|
UniqueLabel,
|
|
5621
5678
|
# go/keep-sorted end
|
|
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
|