<commit_before>import os

import cassandra.cqlengine
from cassandra import ConsistencyLevel
from cassandra.auth import PlainTextAuthProvider
from cassandra.cqlengine.management import create_keyspace_simple, drop_keyspace, sync_table

from eventsourcing.exceptions import DatasourceSettingsError
from eventsourcing.infrastructure.datastore.base import DatastoreSettings, Datastore

DEFAULT_HOSTS = 'localhost'
DEFAULT_PORT = 9042
DEFAULT_PROTOCOL_VERSION = 2
DEFAULT_DEFAULT_KEYSPACE = 'eventsourcing'
DEFAULT_CONSISTENCY_LEVEL = 'LOCAL_QUORUM'
DEFAULT_REPLICATION_FACTOR = 1


class CassandraSettings(DatastoreSettings):
    HOSTS = [h.strip() for h in os.getenv('CASSANDRA_HOSTS', DEFAULT_HOSTS).split(',')]
    PORT = int(os.getenv('CASSANDRA_PORT', DEFAULT_PORT))
    PROTOCOL_VERSION = int(os.getenv('CASSANDRA_PROTOCOL_VERSION', DEFAULT_PROTOCOL_VERSION))
    DEFAULT_KEYSPACE = os.getenv('CASSANDRA_KEYSPACE', DEFAULT_DEFAULT_KEYSPACE)
    CONSISTENCY_LEVEL = os.getenv('CASSANDRA_CONSISTENCY_LEVEL', DEFAULT_CONSISTENCY_LEVEL)
    REPLICATION_FACTOR = os.getenv('CASSANDRA_REPLICATION_FACTOR', DEFAULT_REPLICATION_FACTOR)

    def __init__(self, hosts=None, port=None, protocol_version=None, default_keyspace=None,<commit_msg>Optimised imports.<commit_after>import os

import cassandra.cqlengine
from cassandra import ConsistencyLevel
from cassandra.auth import PlainTextAuthProvider
from cassandra.cqlengine.management import create_keyspace_simple, drop_keyspace, sync_table

from eventsourcing.exceptions import DatasourceSettingsError
from eventsourcing.infrastructure.datastore.base import Datastore, DatastoreSettings

DEFAULT_HOSTS = 'localhost'
DEFAULT_PORT = 9042
DEFAULT_PROTOCOL_VERSION = 2
DEFAULT_DEFAULT_KEYSPACE = 'eventsourcing'
DEFAULT_CONSISTENCY_LEVEL = 'LOCAL_QUORUM'
DEFAULT_REPLICATION_FACTOR = 1


class CassandraSettings(DatastoreSettings):
    HOSTS = [h.strip() for h in os.getenv('CASSANDRA_HOSTS', DEFAULT_HOSTS).split(',')]
    PORT = int(os.getenv('CASSANDRA_PORT', DEFAULT_PORT))
    PROTOCOL_VERSION = int(os.getenv('CASSANDRA_PROTOCOL_VERSION', DEFAULT_PROTOCOL_VERSION))
    DEFAULT_KEYSPACE = os.getenv('CASSANDRA_KEYSPACE', DEFAULT_DEFAULT_KEYSPACE)
    CONSISTENCY_LEVEL = os.getenv('CASSANDRA_CONSISTENCY_LEVEL', DEFAULT_CONSISTENCY_LEVEL)
    REPLICATION_FACTOR = os.getenv('CASSANDRA_REPLICATION_FACTOR', DEFAULT_REPLICATION_FACTOR)

    def __init__(self, hosts=None, port=None, protocol_version=None, default_keyspace=None,
{'fraction_non_alphanumeric': 0.07804286291953093, 'fraction_numerical': 0.004852405984634048, 'mean_word_length': 8.406844106463879, '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': '5448483', 'n_tokens_mistral': 846, 'n_tokens_neox': 819, 'n_words': 138}