<commit_before>from helpers import get_allowed

import json
import os
import subprocess
import web

class VersionR:
    """
    This endpoint is for returning the current running version of vcontrol
    """
    allow_origin, rest_url = get_allowed.get_allowed()
    def GET(self):
        """ GET HTTP Request """
        web.header("Content-Type","text/plain")
        web.header('Access-Control-Allow-Origin', self.allow_origin)
        version = {}

        # get version number
        try:
            import pkg_resources
            file_path = pkg_resources.resource_filename('vcontrol', 'VERSION')
            with open(file_path) as f: version = f.read().strip()
        except:
            try:
                with open('VERSION', 'r') as f: version['version'] = f.read().strip()
            except:
                with open('../VERSION', 'r') as f: version['version'] = f.read().strip()

        # get commit id
        try:
            cmd = 'git -C ../vcontrol rev-parse HEAD'
            commit_id = subprocess.check_output(cmd, shell=True)
            cmd = 'git -C ../vcontrol diff-index --quiet HEAD --'
            dirty = subprocess.call(cmd, shell=True)
            if dirty != 0:
                version['commit'] = commit_id.strip() + '-dirty'
            else:
                version['commit'] = commit_id.strip()
        except:
            pass

        # get runtime id (docker container ID)
        try:
            if 'HOSTNAME' in os.environ:
                version['runtime'] = os.environ['HOSTNAME']
        except:
            pass
<commit_msg>turned off git commit check if we are using the python path.<commit_after>from helpers import get_allowed

import json
import os
import subprocess
import web

class VersionR:
    """
    This endpoint is for returning the current running version of vcontrol
    """
    allow_origin, rest_url = get_allowed.get_allowed()
    def GET(self):
        """ GET HTTP Request """
        web.header("Content-Type","text/plain")
        web.header('Access-Control-Allow-Origin', self.allow_origin)
        version = {}
        file_path = None

        # get version number
        try:
            import pkg_resources
            file_path = pkg_resources.resource_filename('vcontrol', 'VERSION')
            with open(file_path) as f: version = f.read().strip()
        except:
            try:
                with open('VERSION', 'r') as f: version['version'] = f.read().strip()
            except:
                with open('../VERSION', 'r') as f: version['version'] = f.read().strip()

        # only allowed if in the git directory
        if not file_path:
            # get commit id
            try:
                cmd = 'git -C ../vcontrol rev-parse HEAD'
                commit_id = subprocess.check_output(cmd, shell=True)
                cmd = 'git -C ../vcontrol diff-index --quiet HEAD --'
                dirty = subprocess.call(cmd, shell=True)
                if dirty != 0:
                    version['commit'] = commit_id.strip() + '-dirty'
                else:
                    version['commit'] = commit_id.strip()
            except:
                pass

        # get runtime id (docker container ID)
        try:
            if 'HOSTNAME' in os.environ:
                version['runtime'] = os.environ['HOSTNAME']
        except:
            pass

{'fraction_non_alphanumeric': 0.11445603576751118, 'fraction_numerical': 0.0005961251862891207, 'mean_word_length': 1.7576006573541496, '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': '2454337', 'n_tokens_mistral': 917, 'n_tokens_neox': 878, 'n_words': 259}