<commit_before>import collections

from dataclasses import dataclass
from typing import Optional, Dict
from flask import g


from utility.logger import getLogger
logger = getLogger(__name__)


@dataclass
class TheSpecies:
    """Data related to species."""
    dataset: Optional[Dict] = None
    species_name: Optional[str] = None

    def __post_init__(self):
        if self.species_name is not None:
            self.name = self.species_name
            self.chromosomes = Chromosomes(species=self.name)
        else:
            self.dataset = self.dataset
            self.chromosomes = Chromosomes(dataset=self.dataset)


class IndChromosome:
    def __init__(self, name, length):
        self.name = name
        self.length = length

    @property
    def mb_length(self):
        """Chromosome length in megabases"""
        return self.length / 1000000


class Chromosomes:
    def __init__(self, dataset=None, species=None):
        self.chromosomes = collections.OrderedDict()
        if species != None:
            query = (
                "SELECT Chr_Length.Name, Chr_Length.OrderId, Length "
                "FROM Chr_Length, Species WHERE "
                "Chr_Length.SpeciesId = Species.SpeciesId AND "
                "Species.Name = "
                "'%s' ORDER BY OrderId" % species.capitalize()
                )
        else:
            self.dataset = dataset
            query = (
                "SELECT Chr_Length.Name, Chr_Length.OrderId, "
                "Length FROM Chr_Length, InbredSet WHERE "
                "Chr_Length.SpeciesId = InbredSet.SpeciesId AND "
                "InbredSet.Name = "
                "'%s' ORDER BY OrderId" % self.dataset.group.name)
        logger.sql(query)
        results = g.db.execute(query).fetchall()
        for item in results:
            self.chromosomes[item.OrderId] = IndChromosome(
                item.Name, item.Length)
<commit_msg>base: trait: Remove logging information<commit_after>import collections

from dataclasses import dataclass
from typing import Optional, Dict
from flask import g


@dataclass
class TheSpecies:
    """Data related to species."""
    dataset: Optional[Dict] = None
    species_name: Optional[str] = None

    def __post_init__(self):
        if self.species_name is not None:
            self.name = self.species_name
            self.chromosomes = Chromosomes(species=self.name)
        else:
            self.dataset = self.dataset
            self.chromosomes = Chromosomes(dataset=self.dataset)


class IndChromosome:
    def __init__(self, name, length):
        self.name = name
        self.length = length

    @property
    def mb_length(self):
        """Chromosome length in megabases"""
        return self.length / 1000000


class Chromosomes:
    def __init__(self, dataset=None, species=None):
        self.chromosomes = collections.OrderedDict()
        if species != None:
            query = (
                "SELECT Chr_Length.Name, Chr_Length.OrderId, Length "
                "FROM Chr_Length, Species WHERE "
                "Chr_Length.SpeciesId = Species.SpeciesId AND "
                "Species.Name = "
                "'%s' ORDER BY OrderId" % species.capitalize()
                )
        else:
            self.dataset = dataset
            query = (
                "SELECT Chr_Length.Name, Chr_Length.OrderId, "
                "Length FROM Chr_Length, InbredSet WHERE "
                "Chr_Length.SpeciesId = InbredSet.SpeciesId AND "
                "InbredSet.Name = "
                "'%s' ORDER BY OrderId" % self.dataset.group.name)
        results = g.db.execute(query).fetchall()
        for item in results:
            self.chromosomes[item.OrderId] = IndChromosome(
                item.Name, item.Length)

{'fraction_non_alphanumeric': 0.09006376195536663, 'fraction_numerical': 0.0037194473963868225, 'mean_word_length': 2.014411529223379, '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': '83478', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1019, 'n_words': 259}