diff --git a/.github/workflows/ci_decrypt-oracle.yaml b/.github/workflows/ci_decrypt-oracle.yaml index 7bced5ebf..e773bd98a 100644 --- a/.github/workflows/ci_decrypt-oracle.yaml +++ b/.github/workflows/ci_decrypt-oracle.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 with: # The oracle runs in a Python 3.6 Lamba python-version: 3.6 diff --git a/.github/workflows/ci_static-analysis.yaml b/.github/workflows/ci_static-analysis.yaml index 1b659fa5a..31705a5d3 100644 --- a/.github/workflows/ci_static-analysis.yaml +++ b/.github/workflows/ci_static-analysis.yaml @@ -28,7 +28,7 @@ jobs: - isort-check steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 with: python-version: 3.8 - run: | diff --git a/.github/workflows/ci_test-vector-handler.yaml b/.github/workflows/ci_test-vector-handler.yaml index 1b24390e4..75556dc13 100644 --- a/.github/workflows/ci_test-vector-handler.yaml +++ b/.github/workflows/ci_test-vector-handler.yaml @@ -47,7 +47,7 @@ jobs: aws-secret-access-key: ${{ secrets.INTEG_AWS_SECRET_ACCESS_KEY }} aws-region: us-west-2 - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} architecture: ${{ matrix.architecture }} diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index a58bdb332..d83b381f2 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -53,7 +53,7 @@ jobs: architecture: x86 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} architecture: ${{ matrix.architecture }} diff --git a/codebuild/py35/awses_local.yml b/codebuild/py35/awses_local.yml index 71583417a..77668996d 100644 --- a/codebuild/py35/awses_local.yml +++ b/codebuild/py35/awses_local.yml @@ -20,8 +20,8 @@ phases: python: latest build: commands: - - pyenv install 3.5.9 - - pyenv local 3.5.9 + - pyenv install 3.5.10 + - pyenv local 3.5.10 - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py35/examples.yml b/codebuild/py35/examples.yml index 109f2764c..08939ca07 100644 --- a/codebuild/py35/examples.yml +++ b/codebuild/py35/examples.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.5.9 - - pyenv local 3.5.9 + - pyenv install 3.5.10 + - pyenv local 3.5.10 - pip install tox tox-pyenv - tox diff --git a/codebuild/py35/integ.yml b/codebuild/py35/integ.yml index 0014378ba..bcec41b6c 100644 --- a/codebuild/py35/integ.yml +++ b/codebuild/py35/integ.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.5.9 - - pyenv local 3.5.9 + - pyenv install 3.5.10 + - pyenv local 3.5.10 - pip install tox tox-pyenv - tox diff --git a/codebuild/py36/awses_local.yml b/codebuild/py36/awses_local.yml index dba6a28ba..b68a7e434 100644 --- a/codebuild/py36/awses_local.yml +++ b/codebuild/py36/awses_local.yml @@ -20,6 +20,8 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.6.15 + - pyenv local 3.6.15 + - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py36/examples.yml b/codebuild/py36/examples.yml index 1bd091d11..46af14902 100644 --- a/codebuild/py36/examples.yml +++ b/codebuild/py36/examples.yml @@ -18,5 +18,7 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.6.15 + - pyenv local 3.6.15 + - pip install tox tox-pyenv - tox diff --git a/codebuild/py36/integ.yml b/codebuild/py36/integ.yml index 35124c835..d55581c43 100644 --- a/codebuild/py36/integ.yml +++ b/codebuild/py36/integ.yml @@ -18,5 +18,7 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.6.15 + - pyenv local 3.6.15 + - pip install tox tox-pyenv - tox diff --git a/codebuild/py37/awses_local.yml b/codebuild/py37/awses_local.yml index 958823841..9e77d43f7 100644 --- a/codebuild/py37/awses_local.yml +++ b/codebuild/py37/awses_local.yml @@ -20,8 +20,8 @@ phases: python: latest build: commands: - - pyenv install 3.7.9 - - pyenv local 3.7.9 + - pyenv install 3.7.12 + - pyenv local 3.7.12 - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py37/examples.yml b/codebuild/py37/examples.yml index cbe251cf0..57d1626df 100644 --- a/codebuild/py37/examples.yml +++ b/codebuild/py37/examples.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.7.9 - - pyenv local 3.7.9 + - pyenv install 3.7.12 + - pyenv local 3.7.12 - pip install tox tox-pyenv - tox diff --git a/codebuild/py37/integ.yml b/codebuild/py37/integ.yml index 27ce515d0..04d24c26d 100644 --- a/codebuild/py37/integ.yml +++ b/codebuild/py37/integ.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.7.9 - - pyenv local 3.7.9 + - pyenv install 3.7.12 + - pyenv local 3.7.12 - pip install tox tox-pyenv - tox diff --git a/codebuild/py38/awses_local.yml b/codebuild/py38/awses_local.yml index fe84d714d..4e20973d4 100644 --- a/codebuild/py38/awses_local.yml +++ b/codebuild/py38/awses_local.yml @@ -20,6 +20,8 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.8.12 + - pyenv local 3.8.12 + - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py38/examples.yml b/codebuild/py38/examples.yml index 180c606f4..1a8f4f826 100644 --- a/codebuild/py38/examples.yml +++ b/codebuild/py38/examples.yml @@ -18,5 +18,7 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.8.12 + - pyenv local 3.8.12 + - pip install tox tox-pyenv - tox diff --git a/codebuild/py38/integ.yml b/codebuild/py38/integ.yml index 6af55e839..28eae25fc 100644 --- a/codebuild/py38/integ.yml +++ b/codebuild/py38/integ.yml @@ -18,5 +18,7 @@ phases: python: latest build: commands: - - pip install tox + - pyenv install 3.8.12 + - pyenv local 3.8.12 + - pip install tox tox-pyenv - tox diff --git a/codebuild/py39/awses_1.7.1.yml b/codebuild/py39/awses_1.7.1.yml index 4da84dfa5..e261b5e4d 100644 --- a/codebuild/py39/awses_1.7.1.yml +++ b/codebuild/py39/awses_1.7.1.yml @@ -20,8 +20,8 @@ phases: python: latest build: commands: - - pyenv install 3.9.0 - - pyenv local 3.9.0 + - pyenv install 3.9.7 + - pyenv local 3.9.7 - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py39/awses_2.0.0.yml b/codebuild/py39/awses_2.0.0.yml index cf8f90b36..b4a6654d5 100644 --- a/codebuild/py39/awses_2.0.0.yml +++ b/codebuild/py39/awses_2.0.0.yml @@ -20,8 +20,8 @@ phases: python: latest build: commands: - - pyenv install 3.9.0 - - pyenv local 3.9.0 + - pyenv install 3.9.7 + - pyenv local 3.9.7 - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py39/awses_latest.yml b/codebuild/py39/awses_latest.yml index 9a2b12190..ac70cede8 100644 --- a/codebuild/py39/awses_latest.yml +++ b/codebuild/py39/awses_latest.yml @@ -20,8 +20,8 @@ phases: python: latest build: commands: - - pyenv install 3.9.0 - - pyenv local 3.9.0 + - pyenv install 3.9.7 + - pyenv local 3.9.7 - pip install tox tox-pyenv - cd test_vector_handlers - tox diff --git a/codebuild/py39/examples.yml b/codebuild/py39/examples.yml index 38b1f01c7..9b1911024 100644 --- a/codebuild/py39/examples.yml +++ b/codebuild/py39/examples.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.9.0 - - pyenv local 3.9.0 + - pyenv install 3.9.7 + - pyenv local 3.9.7 - pip install tox tox-pyenv - tox diff --git a/codebuild/py39/integ.yml b/codebuild/py39/integ.yml index 49e8f6d1c..c7452e37e 100644 --- a/codebuild/py39/integ.yml +++ b/codebuild/py39/integ.yml @@ -18,7 +18,7 @@ phases: python: latest build: commands: - - pyenv install 3.9.0 - - pyenv local 3.9.0 + - pyenv install 3.9.7 + - pyenv local 3.9.7 - pip install tox tox-pyenv - tox diff --git a/decrypt_oracle/setup.py b/decrypt_oracle/setup.py index 3a5579ad3..3dd5357f7 100644 --- a/decrypt_oracle/setup.py +++ b/decrypt_oracle/setup.py @@ -10,7 +10,7 @@ def read(*args): """Read complete file contents.""" - return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with + return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with, unspecified-encoding def get_version(): diff --git a/decrypt_oracle/src/pylintrc b/decrypt_oracle/src/pylintrc index 8dcba5d63..4f60189ff 100644 --- a/decrypt_oracle/src/pylintrc +++ b/decrypt_oracle/src/pylintrc @@ -3,6 +3,7 @@ disable = bad-continuation, # we let black handle this ungrouped-imports, # we let isort handle this + consider-using-f-string [FORMAT] max-line-length = 120 diff --git a/decrypt_oracle/test/integration/integration_test_utils.py b/decrypt_oracle/test/integration/integration_test_utils.py index eeb6219ac..aa5a54b78 100644 --- a/decrypt_oracle/test/integration/integration_test_utils.py +++ b/decrypt_oracle/test/integration/integration_test_utils.py @@ -100,7 +100,7 @@ def test_vectors_filename() -> Text: def all_test_vectors() -> Iterable[Any]: """Collect and iterate through all test vectors.""" - with open(test_vectors_filename(), "r") as vectors_file: + with open(test_vectors_filename(), "r") as vectors_file: # pylint: disable=unspecified-encoding raw_vectors = json.load(vectors_file) for vector in raw_vectors: diff --git a/decrypt_oracle/test/pylintrc b/decrypt_oracle/test/pylintrc index bb64faf87..29858dad1 100644 --- a/decrypt_oracle/test/pylintrc +++ b/decrypt_oracle/test/pylintrc @@ -5,6 +5,7 @@ disable = missing-docstring, # we don't write docstrings for tests bad-continuation, # we let black handle this ungrouped-imports, # we let isort handle this + consider-using-f-string [FORMAT] max-line-length = 120 diff --git a/examples/src/one_kms_cmk_streaming_data.py b/examples/src/one_kms_cmk_streaming_data.py index 88eb4eb5c..f4e5ce476 100644 --- a/examples/src/one_kms_cmk_streaming_data.py +++ b/examples/src/one_kms_cmk_streaming_data.py @@ -25,7 +25,7 @@ def encrypt_decrypt_stream(key_arn, source_plaintext_filename, botocore_session= :param botocore_session: existing botocore session instance :type botocore_session: botocore.session.Session """ - kwargs = dict() + kwargs = {} kwargs["key_ids"] = [key_arn] diff --git a/examples/src/pylintrc b/examples/src/pylintrc index dcb72e849..284de7452 100644 --- a/examples/src/pylintrc +++ b/examples/src/pylintrc @@ -14,6 +14,7 @@ disable = attribute-defined-outside-init, # breaks with attrs_post_init abstract-method, # throws false positives on io.BaseIO grandchildren redefined-outer-name, # we do this on purpose in multiple places + consider-using-f-string [BASIC] # Allow function names up to 50 characters diff --git a/examples/test/pylintrc b/examples/test/pylintrc index b30a3e202..cf1f73737 100644 --- a/examples/test/pylintrc +++ b/examples/test/pylintrc @@ -7,6 +7,7 @@ disable = # unknown modules as non-standard-library. flake8 tests for this as well # and does treat them properly duplicate-code, # tests for similar things tend to be similar + consider-using-f-string [VARIABLES] additional-builtins = raw_input diff --git a/setup.py b/setup.py index dc82750d5..7d003f280 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ def read(*args): """Reads complete file contents.""" - return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with + return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with, unspecified-encoding def get_version(): diff --git a/src/aws_encryption_sdk/internal/formatting/deserialize.py b/src/aws_encryption_sdk/internal/formatting/deserialize.py index d2cfb1095..b06b5ba11 100644 --- a/src/aws_encryption_sdk/internal/formatting/deserialize.py +++ b/src/aws_encryption_sdk/internal/formatting/deserialize.py @@ -344,7 +344,7 @@ def deserialize_header(stream, max_encrypted_data_keys=None): tee_stream = TeeStream(stream, tee) (version_id,) = unpack_values(">B", tee_stream) version = _verified_version_from_id(version_id) - header = dict() + header = {} header["version"] = version if version == SerializationVersion.V1: diff --git a/src/pylintrc b/src/pylintrc index 1919d76e5..83ead88e4 100644 --- a/src/pylintrc +++ b/src/pylintrc @@ -14,6 +14,7 @@ disable = useless-object-inheritance, raise-missing-from, super-with-arguments, + consider-using-f-string [BASIC] # Allow function names up to 50 characters diff --git a/test/pylintrc b/test/pylintrc index 599a9e182..a06dcfda3 100644 --- a/test/pylintrc +++ b/test/pylintrc @@ -18,10 +18,13 @@ disable = abstract-method, # we do this on purpose to test that they are enforced redefined-outer-name, # raised when using decorators unused-argument, # raised when patches are needed but not called + unspecified-encoding, # we use open() in binary mode which doesn't support encoding # All below are disabled because we need to support Python 2 useless-object-inheritance, raise-missing-from, super-with-arguments, + consider-using-f-string, + redundant-u-string-prefix, [VARIABLES] additional-builtins = raw_input diff --git a/test/unit/test_encryption_client.py b/test/unit/test_encryption_client.py index f463b04f1..db2ca1c4c 100644 --- a/test/unit/test_encryption_client.py +++ b/test/unit/test_encryption_client.py @@ -59,7 +59,7 @@ def test_client_encrypt(mocker): commitment_policy=CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT, max_encrypted_data_keys=3 ) - kwargs = dict() + kwargs = {} kwargs["source"] = b"plaintext" kwargs["materials_manager"] = cmm client.encrypt(**kwargs) @@ -77,7 +77,7 @@ def test_client_decrypt(mocker): commitment_policy=CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT, max_encrypted_data_keys=3 ) - kwargs = dict() + kwargs = {} kwargs["source"] = b"ciphertext" kwargs["materials_manager"] = cmm client.decrypt(**kwargs) @@ -94,7 +94,7 @@ def test_client_stream_encrypt(mocker, mode_string): cmm = MagicMock(__class__=CryptoMaterialsManager) client = aws_encryption_sdk.EncryptionSDKClient(commitment_policy=CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT) - kwargs = dict() + kwargs = {} kwargs["mode"] = mode_string kwargs["source"] = b"plaintext" kwargs["materials_manager"] = cmm @@ -113,7 +113,7 @@ def test_client_stream_decrypt(mocker, mode_string): cmm = MagicMock(__class__=CryptoMaterialsManager) client = aws_encryption_sdk.EncryptionSDKClient(commitment_policy=CommitmentPolicy.FORBID_ENCRYPT_ALLOW_DECRYPT) - kwargs = dict() + kwargs = {} kwargs["mode"] = mode_string kwargs["source"] = b"ciphertext" kwargs["materials_manager"] = cmm @@ -132,7 +132,7 @@ def test_client_bad_kwargs(mocker, method, key): mocker.patch.object(aws_encryption_sdk, "StreamEncryptor") cmm = MagicMock(__class__=CryptoMaterialsManager) - kwargs = dict() + kwargs = {} kwargs[key] = "foobar" kwargs["source"] = b"ciphertext" kwargs["materials_manager"] = cmm diff --git a/test_vector_handlers/setup.py b/test_vector_handlers/setup.py index 3fbb5907e..fa9735652 100644 --- a/test_vector_handlers/setup.py +++ b/test_vector_handlers/setup.py @@ -10,7 +10,7 @@ def read(*args): """Read complete file contents.""" - return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with + return open(os.path.join(HERE, *args)).read() # pylint: disable=consider-using-with, unspecified-encoding def get_version(): diff --git a/test_vector_handlers/src/pylintrc b/test_vector_handlers/src/pylintrc index ebd2eb02e..1b9f2bd59 100644 --- a/test_vector_handlers/src/pylintrc +++ b/test_vector_handlers/src/pylintrc @@ -8,6 +8,7 @@ disable = useless-object-inheritance, raise-missing-from, super-with-arguments, + consider-using-f-string [FORMAT] max-line-length = 120 diff --git a/test_vector_handlers/test/pylintrc b/test_vector_handlers/test/pylintrc index 5aa03d3ae..cd64ae561 100644 --- a/test_vector_handlers/test/pylintrc +++ b/test_vector_handlers/test/pylintrc @@ -11,6 +11,7 @@ disable = useless-object-inheritance, raise-missing-from, super-with-arguments, + consider-using-f-string [FORMAT] max-line-length = 120