<commit_before>"""
Backend implementation using Amazon S3 for storage.
"""
from zope.interface import implements

from axiom.item import Item
from axiom.attributes import text

from txaws.service import AWSServiceRegion
from txaws.credentials import AWSCredentials

from entropy.ientropy import IContentStore
from entropy.util import MemoryObject


class S3Store(Item):
    """
    Content store using Amazon S3.
    """
    implements(IContentStore)

    accessKey = text(allowNone=False)
    secretKey = text(allowNone=False)
    bucket = text(allowNone=False)

    def _getClient(self):
        creds = AWSCredentials(
            access_key=self.accessKey.encode('utf-8'),
            secret_key=self.secretKey.encode('utf-8'))
        region = AWSServiceRegion(creds=creds)
        return region.get_s3_client()<commit_msg>Docstrings.<commit_after>"""
Backend implementation using Amazon S3 for storage.
"""
from zope.interface import implements

from axiom.item import Item
from axiom.attributes import text

from txaws.service import AWSServiceRegion
from txaws.credentials import AWSCredentials

from entropy.ientropy import IContentStore
from entropy.util import MemoryObject


class S3Store(Item):
    """
    Content store using Amazon S3.
    """
    implements(IContentStore)

    accessKey = text(allowNone=False, doc="AWS access key.")
    secretKey = text(allowNone=False, doc="AWS secret key.)
    bucket = text(allowNone=False, doc="Name of S3 bucket used for storage.")

    def _getClient(self):
        creds = AWSCredentials(
            access_key=self.accessKey.encode('utf-8'),
            secret_key=self.secretKey.encode('utf-8'))
        region = AWSServiceRegion(creds=creds)
        return region.get_s3_client()
{'fraction_non_alphanumeric': 0.09012629161882893, 'fraction_numerical': 0.007462686567164179, 'mean_word_length': 3.868715083798883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2826246', 'n_tokens_mistral': 517, 'n_tokens_neox': 504, 'n_words': 132}