<commit_before>'''
Created on Jun 19, 2013

@author: mpastern
'''
from src.resource.resourcemanager import ResourceManager
from src.errors.resourcemanagernotfounderror import ResourceManagerNotFoundError

class resources(object):
    def __init__(self, params):
        self.params = params
    def __call__(self, original_func):
        decorator_self = self
        def wrappee(*args, **kwargs):
            for resource in decorator_self.params:
                rm = (resource.__name__ + 'ResourceManager')
                rm_class = ResourceManager.getResourceManager(rm)
                if rm_class:
                    rm_instance = rm_class()
                    if rm_instance.get():
                        rm_instance.remove()
                        # TODO: use **kwargs for private init
                else:
                    raise ResourceManagerNotFoundError(rm)
            return original_func(*args, **kwargs)
        return wrappee
<commit_msg>sdk: do not create on get() in conflicts annotation<commit_after>'''
Created on Jun 19, 2013

@author: mpastern
'''
from src.resource.resourcemanager import ResourceManager
from src.errors.resourcemanagernotfounderror import ResourceManagerNotFoundError

class resources(object):
    def __init__(self, params):
        self.params = params
    def __call__(self, original_func):
        decorator_self = self
        def wrappee(*args, **kwargs):
            for resource in decorator_self.params:
                rm = (resource.__name__ + 'ResourceManager')
                rm_class = ResourceManager.getResourceManager(rm)
                if rm_class:
                    rm_instance = rm_class()
                    if rm_instance.get(get_only=True):
                        rm_instance.remove()
                        # TODO: use **kwargs for private init
                else:
                    raise ResourceManagerNotFoundError(rm)
            return original_func(*args, **kwargs)
        return wrappee

{'fraction_non_alphanumeric': 0.0767289247854619, 'fraction_numerical': 0.006057546693589096, 'mean_word_length': 2.0824261275272162, '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': '2640102', 'n_tokens_mistral': 506, 'n_tokens_neox': 466, 'n_words': 130}