<commit_before>#!/usr/bin/python2.4
#
# Copyright (c) 2005-2007 rPath, Inc.
#

import testsuite
testsuite.setup()

import os
import sys
import time
import tempfile

import boto
from boto.exception import EC2ResponseError

from mint import ec2
from mint.database import ItemNotFound
from mint_rephelp import MintRepositoryHelper

from mint.helperfuncs import toDatabaseTimestamp, fromDatabaseTimestamp
from conary.lib import util

import fixtures

FAKE_PUBLIC_KEY  = '<KEY>'
FAKE_PRIVATE_KEY = '<KEY>'

class FakeEC2Connection(object):

    def __init__(self, awsPublicKey, awsPrivateKey):
        self.awsPublicKey = awsPublicKey
        self.awsPrivateKey = awsPrivateKey

    def _checkKeys(self):
        if self.awsPublicKey != FAKE_PUBLIC_KEY or \
                self.awsPrivateKey != FAKE_PRIVATE_KEY:
            raise EC2ResponseError()

    def run_instances(self, amiId, user_data=None):
        self._checkKeys()
        return FakeEC2Reservation(amiId)
<commit_msg>update mocked boto code for addressing type<commit_after>#!/usr/bin/python2.4
#
# Copyright (c) 2005-2007 rPath, Inc.
#

import testsuite
testsuite.setup()

import os
import sys
import time
import tempfile

import boto
from boto.exception import EC2ResponseError

from mint import ec2
from mint.database import ItemNotFound
from mint_rephelp import MintRepositoryHelper

from mint.helperfuncs import toDatabaseTimestamp, fromDatabaseTimestamp
from conary.lib import util

import fixtures

FAKE_PUBLIC_KEY  = '<KEY>'
FAKE_PRIVATE_KEY = '<KEY>'

class FakeEC2Connection(object):

    def __init__(self, awsPublicKey, awsPrivateKey):
        self.awsPublicKey = awsPublicKey
        self.awsPrivateKey = awsPrivateKey

    def _checkKeys(self):
        if self.awsPublicKey != FAKE_PUBLIC_KEY or \
                self.awsPrivateKey != FAKE_PRIVATE_KEY:
            raise EC2ResponseError()

    def run_instances(self, amiId, user_data=None, addressing_type = 'public'):
        self._checkKeys()
        return FakeEC2Reservation(amiId)

{'fraction_non_alphanumeric': 0.07249255213505462, 'fraction_numerical': 0.014895729890764648, 'mean_word_length': 4.012437810945274, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '865901', 'n_tokens_mistral': 642, 'n_tokens_neox': 617, 'n_words': 162}