<commit_before>import functools

from .. import errors


def check_resource(f):

    @functools.wraps(f)
    def wrapped(self, resource_id=None, *args, **kwargs):
        if resource_id is None:
            if kwargs.get('container'):
                resource_id = kwargs.pop('container')
            elif kwargs.get('image'):
                resource_id = kwargs.pop('image')
        if isinstance(resource_id, dict):
            resource_id = resource_id.get('Id')
        if not resource_id:
            raise errors.NullResource(
                'image or container param is undefined'
            )
        return f(self, resource_id, *args, **kwargs)
    return wrapped<commit_msg>Cleanup<commit_after>import functools

from .. import errors


def check_resource(f):
    @functools.wraps(f)
    def wrapped(self, resource_id=None, *args, **kwargs):
        if resource_id is None:
            if kwargs.get('container'):
                resource_id = kwargs.pop('container')
            elif kwargs.get('image'):
                resource_id = kwargs.pop('image')
        if not resource_id:
            raise errors.NullResource(
                'image or container param is undefined'
            )
        if isinstance(resource_id, dict):
            resource_id = resource_id.get('Id')
        return f(self, resource_id, *args, **kwargs)
    return wrapped
{'fraction_non_alphanumeric': 0.10387710314557425, 'fraction_numerical': 0.0, 'mean_word_length': 2.152073732718894, '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': '1175889', 'n_tokens_mistral': 379, 'n_tokens_neox': 379, 'n_words': 95}