def from_description()

in src/dynamodb_encryption_sdk/material_providers/aws_kms.py [0:0]


    def from_description(cls, description, default_key_length=None):
        # type: (Text, Optional[int]) -> KeyInfo
        """Load key info from key info description.

        :param str description: Key info description
        :param int default_key_length: Key length to use if not found in description
        """
        description_parts = description.split("/", 1)
        algorithm = description_parts[0]
        try:
            key_length = int(description_parts[1])
        except IndexError:
            if default_key_length is None:
                raise ValueError(
                    'Description "{}" does not contain key length and no default key length is provided'.format(
                        description
                    )
                )

            key_length = default_key_length
        return cls(description, algorithm, key_length)