<commit_before>import os
import sys


def _initCoverage():
    if  'COVERAGE_PROCESS_START' in os.environ:
        try:
            import coverage
            coverage.process_startup()
        except ImportError:
            pass


def getDRCBaseDir():
    return os.environ['DRC_BASE']

def findFileInPaths(filename, searchPaths):
    for path in searchPaths:
        if os.path.isfile(os.path.join(path, filename)):
            return path


def _updateSysPath():

    libraries = [
                'vtkPCLFiltersPython.so',
                'vtkCommonPython.so',
                'vtk/__init__.py'
                ]

    baseDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../../../externals/pod-build/src'))

    searchPaths = []
    searchPaths.append(os.path.join(baseDir, 'PointCloudLibraryPlugin-build/lib'))
    searchPaths.append(os.path.join(baseDir, 'vtk-build/Wrapping/Python'))
    searchPaths.append(os.path.join(baseDir, 'vtk-build/bin'))

    for library in libraries:
        path = findFileInPaths(library, searchPaths)
        if path and path not in sys.path:
            sys.path.insert(0, path)
            continue


_updateSysPath()
_initCoverage()
<commit_msg>fix routine for updating python path so it works from the install dir<commit_after>import os
import sys


def _initCoverage():
    if  'COVERAGE_PROCESS_START' in os.environ:
        try:
            import coverage
            coverage.process_startup()
        except ImportError:
            pass


def getDRCBaseDir():
    return os.environ['DRC_BASE']


def findFileInPaths(filename, searchPaths):
    for path in searchPaths:
        if os.path.isfile(os.path.join(path, filename)):
            return path


def _locateExternals():
    baseDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../..'))
    for path in ['', '..']:
        externals = os.path.join(baseDir, path, 'externals/pod-build/src')
        if os.path.isdir(externals):
            return externals
    raise Exception('Failed to locate externals dir.')


def _updateSysPath():

    libraries = [
                'vtkPCLFiltersPython.so',
                'vtkCommonPython.so',
                'vtk/__init__.py'
                ]

    baseDir = _locateExternals()

    searchPaths = [
      os.path.join(baseDir, 'PointCloudLibraryPlugin-build/lib'),
      os.path.join(baseDir, 'vtk-build/Wrapping/Python'),
      os.path.join(baseDir, 'vtk-build/bin')]

    for library in libraries:
        path = findFileInPaths(library, searchPaths)
        if path and path not in sys.path:
            sys.path.insert(0, path)
            continue


_updateSysPath()
_initCoverage()

{'fraction_non_alphanumeric': 0.12010443864229765, 'fraction_numerical': 0.0007459903021260724, 'mean_word_length': 2.3070283600493218, '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': '6530125', 'n_tokens_mistral': 852, 'n_tokens_neox': 826, 'n_words': 168}