<commit_before>from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

from netCDF4 import Dataset
try:
    from functools import lru_cache
# Fallback for Python < 3.2
except ImportError:
    from functools32 import lru_cache

class MemoizedDataset(Dataset):
    @lru_cache(128)
    def get_variables_by_attributes(self, **kwargs):
        return super(MemoizedDataset,
                     self).get_variables_by_attributes(**kwargs)<commit_msg>Add docstring to MemoizedDataset<commit_after>from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

from netCDF4 import Dataset
try:
    from functools import lru_cache
# Fallback for Python < 3.2
except ImportError:
    from functools32 import lru_cache

class MemoizedDataset(Dataset):
    """
    A NetCDF dataset which has its get_variables_by_attributes call memoized in
    order to speed up repeated calls to the function.  This should only really
    be used against netCDF Datasets opened in 'r' mode, as the attributes should
    not change upon reading the files.
    """
    @lru_cache(128)
    def get_variables_by_attributes(self, **kwargs):
        return super(MemoizedDataset,
                     self).get_variables_by_attributes(**kwargs)
{'fraction_non_alphanumeric': 0.06484375, 'fraction_numerical': 0.0125, 'mean_word_length': 4.103585657370518, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4307484', 'n_tokens_mistral': 382, 'n_tokens_neox': 376, 'n_words': 116}