<commit_before>#!/usr/bin/env python
# coding=utf-8

from __future__ import print_function
from __future__ import division

import os
import re
import sys


class BoostPyLib(object):
    matcher = re.compile(r'libboost_python(?:-py)?(\d{0,2})((?:-\w+[^-])*)\.(?:so|dylib|lib)')

    def __init__(self, path, major, minor, ismt):
        self.filename = path
        self.major = major
        self.minor = minor
        self.threadsafe = ismt

    def match(self, major, minor, threadsafe, ignore_threading=False):
        return self.major == major and self.minor == minor and (ignore_threading or self.threadsafe == threadsafe)

    @property
    def link_directive(self):
        name, ext = os.path.splitext(self.filename)
        if ext == 'lib':
            return "/DEFAULTLIB:" + self.filename
        else:
            return '-l' + name[3:]

    def __str__(self):
        major = str(self.major or '?')
        minor = str(self.minor or '?')
        mt = 'threadsafe' if self.threadsafe else ''
        return "%s [%s.%s] (%s) " % (self.filename, major, minor, mt)

    @classmethod
    def list_in_dir(cls, path):
        return list(filter(lambda x: x is not None, [cls.make_from_path(f) for f in os.listdir(path)]))

    @classmethod
    def make_from_path(cls, path):
        filename = os.path.basename(path)
        m = cls.matcher.match(filename)
        if m is None:
            return m
        ismt = '-mt' in m.group(2)
        major, minor = cls.parse_version(m.group(1))
        return cls(filename, major, minor, ismt)

    @classmethod
    def find_lib_for_current_python(cls, libs):
        v_major, v_minor = sys.version_info[:2]
        match = cls.find_lib_with_version(libs, (v_major, v_minor), unknown_is_match=v_major == 2)
        return match

    @staticmethod
    def find_lib_with_version(available, version, unknown_is_match=False):
        major, minor = version[0], version[1]<commit_msg>findboost: remember path where we found the lib<commit_after>#!/usr/bin/env python
# coding=utf-8

from __future__ import print_function
from __future__ import division

import os
import re
import sys


class BoostPyLib(object):
    matcher = re.compile(r'libboost_python(?:-py)?(\d{0,2})((?:-\w+[^-])*)\.(?:so|dylib|lib)')

    def __init__(self, path, name, major, minor, ismt):
        self.path = path
        self.filename = name
        self.major = major
        self.minor = minor
        self.threadsafe = ismt

    def match(self, major, minor, threadsafe, ignore_threading=False):
        return self.major == major and self.minor == minor and (ignore_threading or self.threadsafe == threadsafe)

    @property
    def link_directive(self):
        name, ext = os.path.splitext(self.filename)
        if ext == 'lib':
            return "/DEFAULTLIB:" + self.filename
        else:
            return '-l' + name[3:]

    def __str__(self):
        major = str(self.major or '?')
        minor = str(self.minor or '?')
        mt = 'threadsafe' if self.threadsafe else ''
        return "%s [%s.%s] (%s) " % (self.filename, major, minor, mt)

    @classmethod
    def list_in_dir(cls, path):
        return list(filter(lambda x: x is not None, [cls.make_from_path(f) for f in os.listdir(path)]))

    @classmethod
    def make_from_path(cls, path):
        filename = os.path.basename(path)
        dirname = os.path.dirname(path)
        m = cls.matcher.match(filename)
        if m is None:
            return m
        ismt = '-mt' in m.group(2)
        major, minor = cls.parse_version(m.group(1))
        return cls(dirname, filename, major, minor, ismt)

    @classmethod
    def find_lib_for_current_python(cls, libs):
        v_major, v_minor = sys.version_info[:2]
        match = cls.find_lib_with_version(libs, (v_major, v_minor), unknown_is_match=v_major == 2)
        return match

    @staticmethod
    def find_lib_with_version(available, version, unknown_is_match=False):
        major, minor = version[0], version[1]
{'fraction_non_alphanumeric': 0.12883744338198289, 'fraction_numerical': 0.0050327126321087065, 'mean_word_length': 2.7464655984919886, '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': '561091', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1291, 'n_words': 322}