Skip to content

Commit cb5a8a6

Browse files
committed
chore: Fix broken CI
1 parent 90606ec commit cb5a8a6

File tree

17 files changed

+48
-35
lines changed

17 files changed

+48
-35
lines changed

codebuild/python3.8.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ phases:
1414
python: latest
1515
build:
1616
commands:
17-
- pip install tox
17+
- pyenv install 3.8.6
18+
- pyenv local 3.8.6
19+
- pip install tox tox-pyenv
1820
- tox

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def get_version():
2929
return _release
3030

3131

32-
project = u"dynamodb-encryption-sdk-python"
32+
project = "dynamodb-encryption-sdk-python"
3333
version = get_version()
3434
release = get_release()
3535

@@ -53,7 +53,7 @@ def get_version():
5353
source_suffix = ".rst" # The suffix of source filenames.
5454
master_doc = "index" # The master toctree document.
5555

56-
copyright = u"%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin
56+
copyright = "%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin
5757

5858
# List of directories, relative to source directory, that shouldn't be searched
5959
# for source files.

examples/src/aws_kms_encrypted_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ def encrypt_batch_items(table_name, aws_cmk_id):
124124
def _select_index_from_item(item):
125125
"""Find the index keys that match this item."""
126126
for index in index_keys:
127-
if all([item[key] == value for key, value in index.items()]):
127+
if all(item[key] == value for key, value in index.items()):
128128
return index
129129

130130
raise Exception("Index key not found in item.")
131131

132132
def _select_item_from_index(index, all_items):
133133
"""Find the item that matches these index keys."""
134134
for item in all_items:
135-
if all([item[key] == value for key, value in index.items()]):
135+
if all(item[key] == value for key, value in index.items()):
136136
return item
137137

138138
raise Exception("Index key not found in item.")

examples/src/aws_kms_encrypted_resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ def encrypt_batch_items(table_name, aws_cmk_id):
7676
def _select_index_from_item(item):
7777
"""Find the index keys that match this item."""
7878
for index in index_keys:
79-
if all([item[key] == value for key, value in index.items()]):
79+
if all(item[key] == value for key, value in index.items()):
8080
return index
8181

8282
raise Exception("Index key not found in item.")
8383

8484
def _select_item_from_index(index, all_items):
8585
"""Find the item that matches these index keys."""
8686
for item in all_items:
87-
if all([item[key] == value for key, value in index.items()]):
87+
if all(item[key] == value for key, value in index.items()):
8888
return item
8989

9090
raise Exception("Index key not found in item.")

examples/src/pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
disable =
44
duplicate-code, # these examples often feature similar code
55
too-many-locals, # for these examples, we prioritize keeping everything together for simple readability
6+
consider-using-f-string, # Not supported in Python 3.5
67

78
[BASIC]
89
# Allow function names up to 50 characters

examples/test/pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ disable =
1010
# pylint does not recognize this
1111
duplicate-code, # tests for similar things tend to be similar
1212
redefined-outer-name, # raises false positives with fixtures
13+
consider-using-f-string, # Not supported in Python 3.5
1314

1415
[DESIGN]
1516
max-args = 10

src/dynamodb_encryption_sdk/delegated_keys/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class DelegatedKey(object):
4545
a :class:`NotImplementedError` detailing this.
4646
"""
4747

48-
@abc.abstractproperty
48+
@property
49+
@abc.abstractmethod
4950
def algorithm(self):
5051
# type: () -> Text
5152
"""Text description of algorithm used by this delegated key."""

src/dynamodb_encryption_sdk/material_providers/most_recent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _get_provider_with_grace_period(self, version, ttl_action):
272272
:raises AttributeError: if provider could not locate version
273273
"""
274274
blocking_wait = bool(ttl_action is TtlActions.EXPIRED)
275-
acquired = self._lock.acquire(blocking_wait)
275+
acquired = self._lock.acquire(blocking_wait) # pylint: disable=consider-using-with
276276
if not acquired:
277277
# We failed to acquire the lock.
278278
# If blocking, we will never reach this point.
@@ -310,7 +310,7 @@ def _get_most_recent_version(self, ttl_action):
310310
:rtype: CryptographicMaterialsProvider
311311
"""
312312
blocking_wait = bool(ttl_action is TtlActions.EXPIRED)
313-
acquired = self._lock.acquire(blocking_wait)
313+
acquired = self._lock.acquire(blocking_wait) # pylint: disable=consider-using-with
314314

315315
if not acquired:
316316
# We failed to acquire the lock.

src/dynamodb_encryption_sdk/materials/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
class CryptographicMaterials(object):
3434
"""Base class for all cryptographic materials."""
3535

36-
@abc.abstractproperty
36+
@property
37+
@abc.abstractmethod
3738
def material_description(self):
3839
# type: () -> Dict[Text, Text]
3940
"""Material description to use with these cryptographic materials.
@@ -42,7 +43,8 @@ def material_description(self):
4243
:rtype: dict
4344
"""
4445

45-
@abc.abstractproperty
46+
@property
47+
@abc.abstractmethod
4648
def encryption_key(self):
4749
# type: () -> DelegatedKey
4850
"""Delegated key used for encrypting attributes.
@@ -51,7 +53,8 @@ def encryption_key(self):
5153
:rtype: DelegatedKey
5254
"""
5355

54-
@abc.abstractproperty
56+
@property
57+
@abc.abstractmethod
5558
def decryption_key(self):
5659
# type: () -> DelegatedKey
5760
"""Delegated key used for decrypting attributes.
@@ -60,7 +63,8 @@ def decryption_key(self):
6063
:rtype: DelegatedKey
6164
"""
6265

63-
@abc.abstractproperty
66+
@property
67+
@abc.abstractmethod
6468
def signing_key(self):
6569
# type: () -> DelegatedKey
6670
"""Delegated key used for calculating digital signatures.
@@ -69,7 +73,8 @@ def signing_key(self):
6973
:rtype: DelegatedKey
7074
"""
7175

72-
@abc.abstractproperty
76+
@property
77+
@abc.abstractmethod
7378
def verification_key(self):
7479
# type: () -> DelegatedKey
7580
"""Delegated key used for verifying digital signatures.

src/pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[MESSAGES CONTROL]
22
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
33
disable =
4-
bad-continuation, # we let black handle this
54
ungrouped-imports, # we let isort handle this
65
duplicate-code, # causes lots of problems with implementations of common interfaces
76
# All below are disabled because we need to support Python 2
87
useless-object-inheritance,
98
raise-missing-from,
109
super-with-arguments,
10+
consider-using-f-string,
1111

1212
[BASIC]
1313
# Allow function names up to 50 characters

test/acceptance/acceptance_test_generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def load_scenarios(online):
4343
into a shared method.
4444
"""
4545
# pylint: disable=too-many-locals
46-
with open(_SCENARIO_FILE) as f:
46+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
4747
scenarios = json.load(f)
4848
keys_file = _filename_from_uri(scenarios["keys"])
4949
keys = _load_keys(keys_file)
@@ -128,7 +128,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
128128
if table:
129129
table.delete()
130130

131-
with open(ciphertext_file, "w") as outfile:
131+
with open(ciphertext_file, "w", encoding="utf-8") as outfile:
132132
json.dump(data_table_output, outfile, indent=4)
133133

134134
if metatable:
@@ -137,7 +137,7 @@ def _generate(materials_provider, table_data, ciphertext_file, metastore_info):
137137
metastore_output[metastore_info["table_name"]].append(ddb_to_json(wrapping_key))
138138

139139
metastore_ciphertext_file = _filename_from_uri(metastore_info["ciphertext"])
140-
with open(metastore_ciphertext_file, "w") as outfile:
140+
with open(metastore_ciphertext_file, "w", encoding="utf-8") as outfile:
141141
json.dump(metastore_output, outfile, indent=4)
142142

143143
metatable.delete()

test/acceptance/acceptance_test_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _decode_item(item):
6161

6262
def _build_plaintext_items(plaintext_file, version):
6363
# pylint: disable=too-many-locals
64-
with open(plaintext_file) as f:
64+
with open(plaintext_file, encoding="utf-8") as f:
6565
plaintext_data = json.load(f)
6666

6767
actions = {}
@@ -92,7 +92,7 @@ def _build_plaintext_items(plaintext_file, version):
9292

9393

9494
def _load_ciphertext_items(ciphertext_file):
95-
with open(ciphertext_file) as f:
95+
with open(ciphertext_file, encoding="utf-8") as f:
9696
ciphertexts = json.load(f)
9797

9898
for _table, items in ciphertexts.items():
@@ -103,7 +103,7 @@ def _load_ciphertext_items(ciphertext_file):
103103

104104

105105
def _load_keys(keys_file):
106-
with open(keys_file) as f:
106+
with open(keys_file, encoding="utf-8") as f:
107107
return json.load(f)
108108

109109

@@ -165,7 +165,7 @@ def _meta_table_prep(table_name, items_filename):
165165
table = boto3.resource("dynamodb", region_name="us-west-2").Table(table_name)
166166
table.wait_until_exists()
167167
try:
168-
with open(_filename_from_uri(items_filename)) as f:
168+
with open(_filename_from_uri(items_filename), encoding="utf-8") as f:
169169
table_data = json.load(f)
170170
request_items = {}
171171

@@ -255,7 +255,7 @@ def _expand_items(ciphertext_items, plaintext_items):
255255

256256
def load_scenarios(online):
257257
# pylint: disable=too-many-locals
258-
with open(_SCENARIO_FILE) as f:
258+
with open(_SCENARIO_FILE, encoding="utf-8") as f:
259259
scenarios = json.load(f)
260260
keys_file = _filename_from_uri(scenarios["keys"])
261261
keys = _load_keys(keys_file)

test/functional/functional_test_vector_generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def _decode_complex_value(_value):
104104

105105
def attribute_test_vectors(mode):
106106
filepath = _ATTRIBUTE_TEST_VECTOR_FILE_TEMPLATE.format(mode=mode)
107-
with open(filepath) as f:
107+
with open(filepath, encoding="utf-8") as f:
108108
vectors = json.load(f)
109109
for vector in vectors:
110110
yield (decode_value(vector["attribute"]), base64.b64decode(codecs.encode(vector["serialized"], "utf-8")))
111111

112112

113113
def material_description_test_vectors():
114-
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE) as f:
114+
with open(_MATERIAL_DESCRIPTION_TEST_VECTORS_FILE, encoding="utf-8") as f:
115115
vectors = json.load(f)
116116
for vector in vectors:
117117
yield (vector["material_description"], decode_value({"B": codecs.encode(vector["serialized"], "utf-8")}))
@@ -125,7 +125,7 @@ def material_description_test_vectors():
125125

126126

127127
def string_to_sign_test_vectors():
128-
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE) as f:
128+
with open(_STRING_TO_SIGN_TEST_VECTORS_FILE, encoding="utf-8") as f:
129129
vectors = json.load(f)
130130
for vector in vectors:
131131
item = {key: decode_value(value["value"]) for key, value in vector["item"].items()}

test/functional/internal/test_str_ops.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
(
2727
("asdf", "asdf"),
2828
(b"asdf", "asdf"),
29-
(codecs.encode(u"Предисловие", "utf-8"), u"Предисловие"),
30-
(u"Предисловие", u"Предисловие"),
29+
(codecs.encode("Предисловие", "utf-8"), "Предисловие"),
30+
("Предисловие", "Предисловие"),
3131
),
3232
)
3333
def test_to_str(data, expected_output):
@@ -41,8 +41,8 @@ def test_to_str(data, expected_output):
4141
("asdf", b"asdf"),
4242
(b"asdf", b"asdf"),
4343
(b"\x3a\x00\x99", b"\x3a\x00\x99"),
44-
(u"Предисловие", codecs.encode(u"Предисловие", "utf-8")),
45-
(codecs.encode(u"Предисловие", "utf-8"), codecs.encode(u"Предисловие", "utf-8")),
44+
("Предисловие", codecs.encode("Предисловие", "utf-8")),
45+
(codecs.encode("Предисловие", "utf-8"), codecs.encode("Предисловие", "utf-8")),
4646
),
4747
)
4848
def test_to_bytes(data, expected_output):

test/pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ disable =
1010
protected-access, # raised when calling _ methods
1111
redefined-outer-name, # raised when using pytest-mock
1212
unused-argument, # raised when patches and fixtures are needed but not called
13+
no-self-use, # raised on Classes in tests used for logically grouping tests
1314
# All below are disabled because we need to support Python 2
1415
useless-object-inheritance,
1516
raise-missing-from,
1617
super-with-arguments,
18+
consider-using-f-string,
1719

1820
[DESIGN]
1921
max-args = 10

test/unit/material_providers/test_aws_kms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def test_loaded_key_infos():
225225
[
226226
pytest.param(val, id=str(val))
227227
for val in all_possible_combinations_kwargs(
228-
dict(),
228+
{},
229229
dict(botocore_session=botocore.session.Session()),
230230
dict(grant_tokens=("sdvoaweih", "auwshefiouawh")),
231231
dict(material_description={"asoiufeoia": "soajfijewi"}),

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ commands =
250250
basepython = python3
251251
deps =
252252
{[testenv]deps}
253-
pyflakes
254-
pylint
253+
pyflakes==2.4.0
254+
pylint==2.12.2
255255
commands =
256256
pylint \
257257
--rcfile=src/pylintrc \
@@ -262,6 +262,7 @@ commands =
262262
[testenv:pylint-tests]
263263
basepython = {[testenv:pylint]basepython}
264264
deps = {[testenv:pylint]deps}
265+
moto==3.0.2
265266
commands =
266267
pylint \
267268
--rcfile=test/pylintrc \
@@ -362,7 +363,7 @@ commands =
362363

363364
[testenv:readme]
364365
basepython = python3
365-
deps = readme_renderer
366+
deps = readme_renderer==34.0
366367
commands = python setup.py check -r -s
367368

368369
[testenv:bandit]

0 commit comments

Comments
 (0)