Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Modules
aws_encryption_sdk.caches.local
aws_encryption_sdk.caches.null
aws_encryption_sdk.keyrings.base
aws_encryption_sdk.keyrings.aws_kms
aws_encryption_sdk.keyrings.aws_kms.client_suppliers
aws_encryption_sdk.keyrings.aws_kms.client_cache
aws_encryption_sdk.keyrings.multi
aws_encryption_sdk.keyrings.raw
aws_encryption_sdk.key_providers.base
Expand All @@ -40,6 +43,7 @@ Modules
aws_encryption_sdk.internal.formatting.serialize
aws_encryption_sdk.internal.str_ops
aws_encryption_sdk.internal.structures
aws_encryption_sdk.internal.validators
aws_encryption_sdk.internal.utils

.. include:: ../CHANGELOG.rst
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ force_grid_wrap = 0
combine_as_imports = True
not_skip = __init__.py
known_first_party = aws_encryption_sdk
known_third_party = attr,awses_test_vectors,basic_encryption,basic_file_encryption_with_multiple_providers,basic_file_encryption_with_raw_key_provider,boto3,botocore,cryptography,data_key_caching_basic,integration_test_utils,mock,pytest,pytest_mock,setuptools,six,typing,wrapt
known_third_party = attr,awacs,aws_encryption_sdk_decrypt_oracle,awses_test_vectors,boto3,botocore,chalice,cryptography,integration_test_utils,mock,moto,pytest,pytest_mock,requests,setuptools,six,troposphere,wrapt
21 changes: 21 additions & 0 deletions src/aws_encryption_sdk/internal/validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Common ``attrs`` validators."""
import attr # only used by mypy, so pylint: disable=unused-import
import six

try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
from typing import Any # noqa pylint: disable=unused-import
except ImportError: # pragma: no cover
# We only actually need these imports when running the mypy checks
pass


def value_is_not_a_string(instance, attribute, value):
# type: (Any, attr.Attribute, Any) -> None
"""Technically a string is an iterable containing strings.

This validator lets you accept other iterators but not strings.
"""
if isinstance(value, six.string_types):
raise TypeError("'{}' must not a string".format(attribute.name))
Loading