<commit_before>"""Provider implementation based on boto library for AWS-compatible clouds."""
import logging as log

import boto3

try:
    # These are installed only for the case of a dev instance
    import responses
    from moto import mock_ec2
    from moto import mock_s3
except ImportError:
    log.debug('[aws provider] moto library not available!')

from cloudbridge.cloud.base import BaseCloudProvider
from cloudbridge.cloud.base.helpers import get_env
from cloudbridge.cloud.interfaces import TestMockHelperMixin

from .services import AWSComputeService
from .services import AWSNetworkingService
from .services import AWSSecurityService
from .services import AWSStorageService


class AWSCloudProvider(BaseCloudProvider):
    '''AWS cloud provider interface'''
    PROVIDER_ID = 'aws'
    AWS_INSTANCE_DATA_DEFAULT_URL = "http://cloudve.org/cb-aws-vmtypes.json"

    def __init__(self, config):
        super(AWSCloudProvider, self).__init__(config)

        # Initialize cloud connection fields
        # These are passed as-is to Boto
        self.region_name = self._get_config_value('aws_region_name',
                                                  'us-east-1')
        self.session_cfg = {
            'aws_access_key_id': self._get_config_value(
                'aws_access_key', get_env('AWS_ACCESS_KEY', None)),
            'aws_secret_access_key': self._get_config_value(
                'aws_secret_key', get_env('AWS_SECRET_KEY', None)),
            'aws_session_token': self._get_config_value(<commit_msg>Debug commit for AWS issues on Travis<commit_after>"""Provider implementation based on boto library for AWS-compatible clouds."""
import logging as log

import boto3

# These are installed only for the case of a dev instance
from moto import mock_ec2
from moto import mock_s3

import responses

from cloudbridge.cloud.base import BaseCloudProvider
from cloudbridge.cloud.base.helpers import get_env
from cloudbridge.cloud.interfaces import TestMockHelperMixin

from .services import AWSComputeService
from .services import AWSNetworkingService
from .services import AWSSecurityService
from .services import AWSStorageService


class AWSCloudProvider(BaseCloudProvider):
    '''AWS cloud provider interface'''
    PROVIDER_ID = 'aws'
    AWS_INSTANCE_DATA_DEFAULT_URL = "http://cloudve.org/cb-aws-vmtypes.json"

    def __init__(self, config):
        super(AWSCloudProvider, self).__init__(config)

        # Initialize cloud connection fields
        # These are passed as-is to Boto
        self.region_name = self._get_config_value('aws_region_name',
                                                  'us-east-1')
        self.session_cfg = {
            'aws_access_key_id': self._get_config_value(
                'aws_access_key', get_env('AWS_ACCESS_KEY', None)),
            'aws_secret_access_key': self._get_config_value(
                'aws_secret_key', get_env('AWS_SECRET_KEY', None)),
            'aws_session_token': self._get_config_value(
{'fraction_non_alphanumeric': 0.07630522088353414, 'fraction_numerical': 0.002677376171352075, 'mean_word_length': 3.357142857142857, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7139463', 'n_tokens_mistral': 830, 'n_tokens_neox': 825, 'n_words': 224}