<commit_before>#
# This file runs a whole bunch of commands (on the shell), parses their outputs
# and constructs a dictionary of extracted information.
#
import pprint
import re
import argparse
import os
import sys

from common import settings, debug, error, status_update, dump_json, load_json
from common import execute_cmd
from analyzer import analyze

# TODO Generate this automatically from admin-openrc.sh
myenv = dict(os.environ.copy(), OS_PASSWORD="<PASSWORD>",
                              OS_USER_NAME="admin",
                              OS_TENANT_NAME="admin",
                              OS_PROJECT_NAME="admin",
                              OS_TENANT_ID="9018c3a08bc0436ab3491701701fd81a",
                              OS_AUTH_URL="http://10.0.2.15:5000/v2.0",
                              OS_REGION_NAME="RegionOne")

# Contains all info gathered by parsing the output of commands
info = {
        'vms'           : {},
        'brctl'         : {},
        'bridges'       : {
            'br-ex'     : {'ports': {}},
            'br-int'    : {'ports': {}},
            'br-tun'    : {'ports': {}}<commit_msg>Removing hardcoded openstack env variables<commit_after>#
# This file runs a whole bunch of commands (on the shell), parses their outputs
# and constructs a dictionary of extracted information.
#
import pprint
import re
import argparse
import os
import sys

from common import settings, debug, error, status_update, dump_json, load_json
from common import execute_cmd
from analyzer import analyze

def get_env(filename):
    lines=open(os.getcwd()+os.sep+filename,'r').read().splitlines()
    env = {}
    for line in lines:
        if line.startswith('export'):
            m = re.search(r'export (.+)=(.+)', line)
            if m:
                key = m.group(1).replace('"','')
                val = m.group(2).replace('"','')
                env.update({key:val})
    return env

myenv = os.environ.copy()
myenv.update(get_env('admin-openrc.sh'))

# Contains all info gathered by parsing the output of commands
info = {
        'vms'           : {},
        'brctl'         : {},
        'bridges'       : {
            'br-ex'     : {'ports': {}},
            'br-int'    : {'ports': {}},
            'br-tun'    : {'ports': {}}
{'fraction_non_alphanumeric': 0.12466960352422908, 'fraction_numerical': 0.01629955947136564, 'mean_word_length': 2.0940054495912808, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '458614', 'n_tokens_mistral': 687, 'n_tokens_neox': 660, 'n_words': 182}