<commit_before>from datetime import datetime
import json

import boto.sqs
import boto.sqs.message

from .base import Connector

import logging
logger = logging.getLogger('sqjobs.sqs')


class SQS(Connector):
    """
    Manages a single connection to SQS
    """

    def __init__(self, access_key, secret_key, region='us-east-1', is_secure=True):
        """
        Creates a new SQS object

        :param access_key: access key with access to SQS
        :param secret_key: secret key with access to SQS
        :param region: a valid region of AWS, like 'us-east-1'
        """
        self.access_key = access_key
        self.secret_key = secret_key
        self.region = region
        self.is_secure = is_secure

        self._cached_connection = None

    def __repr__(self):
        return 'SQS("{ak}", "{sk}", region="{region}")'.format(
            ak=self.access_key,
            sk=self.secret_key,
            region=self.region
        )

    @property
    def connection(self):
        """
        Creates (and saves in a cache) a SQS connection
        """
        if self._cached_connection is None:
            self._cached_connection = boto.sqs.connect_to_region(<commit_msg>Hide AWS secret key on SQS connector repr<commit_after>from datetime import datetime
import json

import boto.sqs
import boto.sqs.message

from .base import Connector

import logging
logger = logging.getLogger('sqjobs.sqs')


class SQS(Connector):
    """
    Manages a single connection to SQS
    """

    def __init__(self, access_key, secret_key, region='us-east-1', is_secure=True):
        """
        Creates a new SQS object

        :param access_key: access key with access to SQS
        :param secret_key: secret key with access to SQS
        :param region: a valid region of AWS, like 'us-east-1'
        """
        self.access_key = access_key
        self.secret_key = secret_key
        self.region = region
        self.is_secure = is_secure

        self._cached_connection = None

    def __repr__(self):
        return 'SQS("{ak}", "{sk}", region="{region}")'.format(
            ak=self.access_key,
            sk="%s******%s" % (self.secret_key[0:6], self.secret_key[-4:]),
            region=self.region
        )

    @property
    def connection(self):
        """
        Creates (and saves in a cache) a SQS connection
        """
        if self._cached_connection is None:
            self._cached_connection = boto.sqs.connect_to_region(
{'fraction_non_alphanumeric': 0.10218978102189781, 'fraction_numerical': 0.00283860502838605, 'mean_word_length': 2.393397524071527, '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': '4592353', 'n_tokens_mistral': 755, 'n_tokens_neox': 728, 'n_words': 206}