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

import datetime

import sqlalchemy

from mfit_service.repositories.irepository import IRepository


class BaseRepository(IRepository):

    def get(self, entity_id):

        """
        Returns Variable

        Get the existing entity from the database.

        Parameters
        ----------
        entity_id : Integer
            Entity unique identifier.
        """

        primary_key = sqlalchemy.inspect(self._model).primary_key[0]
        entity = self._db_context.query(self._model) \
                                 .filter_by(**{primary_key.name: entity_it}) \
                                 .one()
        return entity

    def get_all(self):

        """
        Returns List

        Get all existing entities from the database.
        """

        entities = self._db_context.query(self._model).all()
        return entities

    def add(self, entity, created_by=-1):

        """
        Returns None

        Add the new entity to the database.

        Parameters
        ----------
        entity : Variable
            Domain model instance.
        """

        entity.created_on = datetime.datetime.utcnow()
        entity.created_by = created_by

        self._db_context.add(entity)

    def remove(self, entity):

        """
        Returns None

        Remove the existing entity from the database.

        Parameters
        ----------
        entity : Variable
            Domain model instance.
        """

        self._db_context.remove(entity)

<commit_msg>Fixed typo<commit_after># -*- coding: utf-8 -*-

import datetime

import sqlalchemy

from mfit_service.repositories.irepository import IRepository


class BaseRepository(IRepository):

    def get(self, entity_id):

        """
        Returns Variable

        Get the existing entity from the database.

        Parameters
        ----------
        entity_id : Integer
            Entity unique identifier.
        """

        primary_key = sqlalchemy.inspect(self._model).primary_key[0]
        entity = self._db_context.query(self._model) \
                                 .filter_by(**{primary_key.name: entity_id}) \
                                 .one()
        return entity

    def get_all(self):

        """
        Returns List

        Get all existing entities from the database.
        """

        entities = self._db_context.query(self._model).all()
        return entities

    def add(self, entity, created_by=-1):

        """
        Returns None

        Add the new entity to the database.

        Parameters
        ----------
        entity : Variable
            Domain model instance.
        """

        entity.created_on = datetime.datetime.utcnow()
        entity.created_by = created_by

        self._db_context.add(entity)

    def remove(self, entity):

        """
        Returns None

        Remove the existing entity from the database.

        Parameters
        ----------
        entity : Variable
            Domain model instance.
        """

        self._db_context.remove(entity)


{'fraction_non_alphanumeric': 0.09866926322622525, 'fraction_numerical': 0.0019474196689386564, 'mean_word_length': 1.5429042904290429, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3621359', 'n_tokens_mistral': 811, 'n_tokens_neox': 753, 'n_words': 197}