<commit_before>################################################################################
# Copyright (c) 2021 ContinualAI.                                              #
# Copyrights licensed under the MIT License.                                   #
# See the accompanying LICENSE file for terms.                                 #
#                                                                              #
# Date: 28-06-2021                                                             #
# Author: <NAME>                                                            #
# E-mail: <EMAIL>                                         #
# Website: continualai.org                                                     #
################################################################################

""" Endless-CL-Sim Dataset """

from pathlib import Path
import glob
import os
from typing import Union
from warnings import warn
import sys
import json

import numpy as np
from PIL import Image

from torch.utils.data import Dataset

from avalanche.benchmarks.datasets import default_dataset_location
from avalanche.benchmarks.datasets.endless_cl_sim import \
    endless_cl_sim_data
from avalanche.benchmarks.datasets.downloadable_dataset import \
    DownloadableDataset


class ClassificationSubSequence(Dataset):
    """Image-Patch Classification Subsequence Dataset"""

    def __init__(self, file_paths, targets, patch_size=64,
                 labelmap_path=None, transform=None, target_transform=None):
        """
        Dataset that contains image-patches and targets for one subsequence of
        an endless continual learning simulator's sequence, that has been
        converted for image-patch classification.

        :param file_paths: List that contains the paths to all images files
            that are part of this subsequence.
        :param targets: List that contains the targets (`object category 
            names` (str)) for each respective image.
        :param patch_size: Int defining the quadratic patch-size the 
            image-patches are resized to.
        :param labelmap_path: Path to a `labelmap.json` file that specifies
            a mapping from `object category names` to labels. 
        :param transform: Eventual transformations to be applied to the image 
            data.
        :param target_transform: Eventual transformations to be applied to the 
            target data.
        """
        self.file_paths = file_paths
        self.targets = targets
        self.patch_size = patch_size
        self.transform = transform
        self.target_transform = target_transform

        self.labelmap = self._load_labelmap(labelmap_path)

        return

    def _pil_loader(self, file_path):
        with open(file_path, "rb") as f:<commit_msg>Fake commit to trigger tests<commit_after>################################################################################
# Copyright (c) 2021 ContinualAI.                                              #
# Copyrights licensed under the MIT License.                                   #
# See the accompanying LICENSE file for terms.                                 #
#                                                                              #
# Date: 28-06-2021                                                             #
# Author: <NAME>                                                            #
# E-mail: <EMAIL>                                         #
# Website: continualai.org                                                     #
################################################################################

""" Endless-CL-Sim Dataset """

from pathlib import Path
import glob
import os
from typing import Union
from warnings import warn
import sys
import json

import numpy as np
from PIL import Image

from torch.utils.data import Dataset

from avalanche.benchmarks.datasets import default_dataset_location
from avalanche.benchmarks.datasets.endless_cl_sim import \
    endless_cl_sim_data
from avalanche.benchmarks.datasets.downloadable_dataset import \
    DownloadableDataset


class ClassificationSubSequence(Dataset):
    """Image-Patch Classification Subsequence Dataset"""

    def __init__(self, file_paths, targets, patch_size=64,
                 labelmap_path=None, transform=None, target_transform=None):
        """
        Dataset containing image-patches and targets for one subsequence of
        an endless continual learning simulator's sequence, that has been
        converted for image-patch classification.

        :param file_paths: List that contains the paths to all images files
            that are part of this subsequence.
        :param targets: List that contains the targets (`object category 
            names` (str)) for each respective image.
        :param patch_size: Int defining the quadratic patch-size the 
            image-patches are resized to.
        :param labelmap_path: Path to a `labelmap.json` file that specifies
            a mapping from `object category names` to labels. 
        :param transform: Eventual transformations to be applied to the image 
            data.
        :param target_transform: Eventual transformations to be applied to the 
            target data.
        """
        self.file_paths = file_paths
        self.targets = targets
        self.patch_size = patch_size
        self.transform = transform
        self.target_transform = target_transform

        self.labelmap = self._load_labelmap(labelmap_path)

        return

    def _pil_loader(self, file_path):
        with open(file_path, "rb") as f:
{'fraction_non_alphanumeric': 0.1090520313613685, 'fraction_numerical': 0.004989308624376337, 'mean_word_length': 1.9203954214360042, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2013487', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1179, 'n_words': 428}