<commit_before>try:
    from keystoneclient.v2_0 import client as keystone_client
    from glance import client as glance_client
    from novaclient.v1_1 import client as nova_client
    from quantumclient.v2_0 import client as quantum_client
    from nova.db.sqlalchemy import api as nova_db_api 
    from nova.context import get_admin_context
    from keystone.common.sql import core  
    core.CONF(args=[], project='keystone', default_config_files=['/etc/keystone/keystone.conf'])
    from keystone.identity.backends.sql import Metadata
    has_openstack = True
except:
    has_openstack = False

from planetstack.config import Config
from deployment_auth import deployment_auth

def require_enabled(callable):
    def wrapper(*args, **kwds):
        if has_openstack:
            return callable(*args, **kwds)
        else:
            return None
    return wrapper

def parse_novarc(filename):
    opts = {}
    f = open(filename, 'r')
    for line in f:
        try:
            line = line.replace('export', '').strip()
            parts = line.split('=')
            if len(parts) > 1:
                value = parts[1].replace("\'", "")
                value = value.replace('\"', '')
                opts[parts[0]] = value
        except:
            pass
    f.close()
    return opts

class Client:
    def __init__(self, username=None, password=<PASSWORD>, tenant=None, url=None, token=None, endpoint=None, deployment=None, *args, **kwds):
        
            
        if not deployment or deployment not in deployment_auth:
            auth = deployment_auth['default']
        else:
            auth = deployment_auth[deployment]
            
            
        self.has_openstack = has_openstack
        self.username = auth['user']
        self.password = auth['password']
        self.tenant = auth['tenant']
        self.url = auth['url']
        self.endpoint = auth['endpoint']
        self.token = auth['token']  

        if username:
            self.username = username
        if password:
            self.password = password
        if tenant:
            self.tenant = tenant
        if url:
            self.url = url
        if token:
            self.token = token    
        if endpoint:
            self.endpoint = endpoint

        #if '@' in self.username:
        #    self.username = self.username[:self.username.index('@')]
<commit_msg>admin 'admin' argument to constructor<commit_after>try:
    from keystoneclient.v2_0 import client as keystone_client
    from glance import client as glance_client
    from novaclient.v1_1 import client as nova_client
    from quantumclient.v2_0 import client as quantum_client
    from nova.db.sqlalchemy import api as nova_db_api 
    from nova.context import get_admin_context
    from keystone.common.sql import core  
    core.CONF(args=[], project='keystone', default_config_files=['/etc/keystone/keystone.conf'])
    from keystone.identity.backends.sql import Metadata
    has_openstack = True
except:
    has_openstack = False

from planetstack.config import Config
from deployment_auth import deployment_auth

def require_enabled(callable):
    def wrapper(*args, **kwds):
        if has_openstack:
            return callable(*args, **kwds)
        else:
            return None
    return wrapper

def parse_novarc(filename):
    opts = {}
    f = open(filename, 'r')
    for line in f:
        try:
            line = line.replace('export', '').strip()
            parts = line.split('=')
            if len(parts) > 1:
                value = parts[1].replace("\'", "")
                value = value.replace('\"', '')
                opts[parts[0]] = value
        except:
            pass
    f.close()
    return opts

class Client:
    def __init__(self, username=None, password=<PASSWORD>, tenant=None, url=None, token=None, endpoint=None, deployment=None, admin=True, *args, **kwds):
        
            
        if not deployment or deployment not in deployment_auth:
            auth = deployment_auth['default']
        else:
            auth = deployment_auth[deployment]
            
        self.has_openstack = has_openstack

        self.url = auth['url']
        if admin:
            self.username = auth['user']
            self.password = auth['password']
            self.tenant = auth['tenant']
            self.endpoint = auth['endpoint']
            self.token = auth['token']  
        else:
            self.username = None
            self.password = None
            self.tenant = None

        if username:
            self.username = username
        if password:
            self.password = password
        if tenant:
            self.tenant = tenant
        if url:
            self.url = url
        if token:
            self.token = token    
        if endpoint:
            self.endpoint = endpoint

        #if '@' in self.username:
        #    self.username = self.username[:self.username.index('@')]

{'fraction_non_alphanumeric': 0.0988855116514691, 'fraction_numerical': 0.00364741641337386, 'mean_word_length': 2.03380454824831, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1532797', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1349, 'n_words': 360}