<commit_before># -*- coding: UTF8 -*-
# ***** BEGIN LICENSE BLOCK *****
# Sconspiracy - Copyright (C) IRCAD, 2004-2010.
# Distributed under the terms of the BSD Licence as
# published by the Open Source Initiative.  
# ****** END LICENSE BLOCK ******


import os
import traceback
import functools

import racy

from racy.rutils import Version, is_iterable

from libext import LibExt

UNSPECIFIED_COMPILER = 'unspecified_compiler'

class register(object):

    # dictionnary registering libext as libs[name][compiler][version]
    libs       = {}
    configured = {}

    def __call__(self, cls, src=None):
        self.register(cls, src)

    def register(reg, cls, src=None):
        self = reg
        if issubclass(cls, LibExt):
            src = traceback.extract_stack()[-2][0] # caller's file


        for name in cls.register_names:
            #name    = name.lower()
            version = Version(cls.version)
            comp    = Version(getattr(cls, 'compiler', ''))
            comp    = comp if comp else UNSPECIFIED_COMPILER
            nv      = version.normalized


            self.libs.setdefault(name,{}).setdefault(comp,{})

            if nv in self.libs[name][comp]:
                overrided = self.libs[name][comp][nv]
                msg = ('<{lib}-{comp}-{version}> libext will be overrided. '
                       'Previously defined in <"{fileorig}">. '
                       'New definition in <"{file}">.')
                msg = msg.format(
                        lib      = name,
                        comp     = comp,
                        version  = nv,
                        fileorig = overrided._src,
                        file     = src
                        )
                import racy<commit_msg>Fixed spelling mistake<commit_after># -*- coding: UTF8 -*-
# ***** BEGIN LICENSE BLOCK *****
# Sconspiracy - Copyright (C) IRCAD, 2004-2010.
# Distributed under the terms of the BSD Licence as
# published by the Open Source Initiative.  
# ****** END LICENSE BLOCK ******


import os
import traceback
import functools

import racy

from racy.rutils import Version, is_iterable

from libext import LibExt

UNSPECIFIED_COMPILER = 'unspecified_compiler'

class register(object):

    # dictionnary registering libext as libs[name][compiler][version]
    libs       = {}
    configured = {}

    def __call__(self, cls, src=None):
        self.register(cls, src)

    def register(reg, cls, src=None):
        self = reg
        if issubclass(cls, LibExt):
            src = traceback.extract_stack()[-2][0] # caller's file


        for name in cls.register_names:
            #name    = name.lower()
            version = Version(cls.version)
            comp    = Version(getattr(cls, 'compiler', ''))
            comp    = comp if comp else UNSPECIFIED_COMPILER
            nv      = version.normalized


            self.libs.setdefault(name,{}).setdefault(comp,{})

            if nv in self.libs[name][comp]:
                overrided = self.libs[name][comp][nv]
                msg = ('<{lib}-{comp}-{version}> libext will be overridden. '
                       'Previously defined in <"{fileorig}">. '
                       'New definition in <"{file}">.')
                msg = msg.format(
                        lib      = name,
                        comp     = comp,
                        version  = nv,
                        fileorig = overrided._src,
                        file     = src
                        )
                import racy
{'fraction_non_alphanumeric': 0.11269208878770631, 'fraction_numerical': 0.006260671599317018, 'mean_word_length': 1.705927636643572, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4987541', 'n_tokens_mistral': 1044, 'n_tokens_neox': 952, 'n_words': 261}