<commit_before>import os
import yaml
import json
import glob
import copy

from typing import List
from bugzoo.bug import Bug
from bugzoo.build import BuildInstructions
from bugzoo.source import Source, SourceManager


class Dataset(Source):
    @staticmethod
    def from_dict(manager: 'SourceManager',
                  url: str,
                  d: dict) -> 'Dataset':
        assert 'name' in d
        name = d['name']
        return Dataset(manager, url, name)


    def __init__(self, manager: 'DatasetManager', url: str, name: str) -> None:
        super().__init__(manager, url, name)
        self.__bugs = {}
        self.__dependencies = {}
        self.scan()


    def scan(self) -> None:
        # find all dependencies
        fns = '{}/**/*.dependency.yaml'.format(self.abs_path)
        for fn in glob.iglob(fns, recursive=True):
            dep = BuildInstructions.from_file(self, fn)
            self.__dependencies[dep.tag] = dep


        # find all bugs
        fns = '{}/**/*.bug.yaml'.format(self.abs_path)
        for fn in glob.iglob(fns, recursive=True):
            bug = Bug.from_file(self, fn)<commit_msg>Modified bug.yaml to bug.yml (#82)<commit_after>import os
import yaml
import json
import glob
import copy

from typing import List
from bugzoo.bug import Bug
from bugzoo.build import BuildInstructions
from bugzoo.source import Source, SourceManager


class Dataset(Source):
    @staticmethod
    def from_dict(manager: 'SourceManager',
                  url: str,
                  d: dict) -> 'Dataset':
        assert 'name' in d
        name = d['name']
        return Dataset(manager, url, name)


    def __init__(self, manager: 'DatasetManager', url: str, name: str) -> None:
        super().__init__(manager, url, name)
        self.__bugs = {}
        self.__dependencies = {}
        self.scan()


    def scan(self) -> None:
        # find all dependencies
        fns = '{}/**/*.dependency.yaml'.format(self.abs_path)
        for fn in glob.iglob(fns, recursive=True):
            dep = BuildInstructions.from_file(self, fn)
            self.__dependencies[dep.tag] = dep


        # find all bugs
        fns = '{}/**/*.bug.yml'.format(self.abs_path)
        for fn in glob.iglob(fns, recursive=True):
            bug = Bug.from_file(self, fn)
{'fraction_non_alphanumeric': 0.1183406113537118, 'fraction_numerical': 0.0008733624454148472, 'mean_word_length': 2.36417033773862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5585053', 'n_tokens_mistral': 711, 'n_tokens_neox': 672, 'n_words': 191}