<commit_before>import vim, urllib2, urllib, urlparse, logging, json, os.path

logger = logging.getLogger('omnisharp')
hdlr = logging.FileHandler('python.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr) 
logger.setLevel(logging.WARNING)

def getResponse(endPoint, additionalParameters=None):
    parameters = {}
    parameters['line'] = vim.eval('line(".")')
    parameters['column'] = vim.eval('col(".")')
    parameters['buffer'] = '\r\n'.join(vim.eval("getline(1,'$')")[:])
    parameters['filename'] = vim.current.buffer.name

    if(additionalParameters != None):
        parameters.update(additionalParameters)

    target = urlparse.urljoin(vim.eval('g:OmniSharp_host'), endPoint)
    parameters = urllib.urlencode(parameters)
    try:
        response = urllib2.urlopen(target, parameters)
        return response.read()
    except:
        vim.command("call confirm('Could not connect to " + target + "')")
        return ''

<commit_msg>Moved python log file to vimscript directory<commit_after>import vim, urllib2, urllib, urlparse, logging, json, os, os.path


logger = logging.getLogger('omnisharp')
logger.setLevel(logging.WARNING)

log_dir = os.path.join(vim.eval('expand("<sfile>:p:h")'), '..', 'log')
if not os.path.exists(log_dir):
    os.makedirs(log_dir)
hdlr = logging.FileHandler(os.path.join(log_dir, 'python.log'))
logger.addHandler(hdlr) 

formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)

def getResponse(endPoint, additionalParameters=None):
    parameters = {}
    parameters['line'] = vim.eval('line(".")')
    parameters['column'] = vim.eval('col(".")')
    parameters['buffer'] = '\r\n'.join(vim.eval("getline(1,'$')")[:])
    parameters['filename'] = vim.current.buffer.name

    if(additionalParameters != None):
        parameters.update(additionalParameters)

    target = urlparse.urljoin(vim.eval('g:OmniSharp_host'), endPoint)
    parameters = urllib.urlencode(parameters)
    try:
        response = urllib2.urlopen(target, parameters)
        return response.read()
    except:
        vim.command("call confirm('Could not connect to " + target + "')")
        return ''


{'fraction_non_alphanumeric': 0.1676326348640214, 'fraction_numerical': 0.0026749888542131075, 'mean_word_length': 4.568238213399503, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '898938', 'n_tokens_mistral': 743, 'n_tokens_neox': 722, 'n_words': 121}