<commit_before># -*- coding: utf-8 -*-

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

""" Resource storage
"""

import collections
import memcache


class ResourceStorage(object):

    def __init__(self):
        raise Exception("Not implemented")

    def get(self, key, auth=None):
        raise Exception("Not implemented")

    def set(self, key, value, owner=None, mode=None, ts=None):
        raise Exception("Not implemented")


class MemoryStorage(dict):

    def __init__(self):
        super(MemoryStorage, self).__init__(self)

    def set(self, key, value, owner=None, mode=None, ts=None):
        self[key] = (value, ts, owner, mode)

    def get(self, key, auth=None):
        result = self.get(key)
        if result is not None and auth == result[2]:
            return result[0]
        else:
            return None


class LimitedMemoryStorage(ResourceStorage):
    """ Storage class for blobs
    """

    def __init__(self, max_size=10):
        self.max_size = max_size
        self.inner = collections.OrderedDict()
<commit_msg>Fix recursive call on in memory storage<commit_after># -*- coding: utf-8 -*-

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

""" Resource storage
"""

import collections
import memcache

__updated__ = "2016-04-19"
__author__ = "<NAME>"
__copyright__ = "Copyright 2015-2016, Angus.ai"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "Apache v2.0"
__maintainer__ = "<NAME>"
__status__ = "Production"


class ResourceStorage(object):

    def __init__(self):
        raise Exception("Not implemented")

    def get(self, key, auth=None):
        raise Exception("Not implemented")

    def set(self, key, value, owner=None, mode=None, ts=None):
        raise Exception("Not implemented")


class MemoryStorage(dict):

    def __init__(self):
        super(MemoryStorage, self).__init__(self)

    def set(self, key, value, owner=None, mode=None, ts=None):
        self[key] = (value, ts, owner, mode)

    def get(self, key, auth=None):
        result = super(MemoryStorage, self).get(key)
        if result is not None and auth == result[2]:
            return result[0]
        else:
            return None


class LimitedMemoryStorage(ResourceStorage):
    """ Storage class for blobs
    """

    def __init__(self, max_size=10):
        self.max_size = max_size
        self.inner = collections.OrderedDict()

{'fraction_non_alphanumeric': 0.09810044236273745, 'fraction_numerical': 0.00936768149882904, 'mean_word_length': 3.495906432748538, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7081931', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1034, 'n_words': 415}