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

from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.orm import relationship

from mfit import models


class AttemptsLogs(models.Base):

    __tablename__ = 'attempts_logs'

    id = Column(Integer, primary_key=True)
    attempts_id = Column(ForeignKey('attempts.id'))
    habits_id = Column(ForeignKey('habits.id'))
    sets_remaining = Column()

    attempt = relationship('Attempts', back_populates='habits')
    habit = relationship('Habits', back_populates='attempts')

    def __init__(self, attempt, habit, sets_remaining):

        """
        Attempts Logs model.

        Parameters
        ----------
        attempt : mfit.models.Attempts
            Attempts entity.
        habit : mfit.models.Habits
            Habits entity.
        sets_remaining : int
            Number of remaining sets for the corresponding habit for
            that day.
        """

        self.attempts_id = attempt.id
        self.habits_id = habit.id
        self.sets_remaining = sets_remaining

    def __repr__(self):
        repr_ = '{}(attempt={}, habit={}, sets_remaining={})'
        return repr_.format(self.__class__.__name__,
                            self.attempt,
                            self.habit,
                            self.sets_remaining)

<commit_msg>N/A: Fixed relationships<commit_after># -*- coding: utf-8 -*-

from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.orm import relationship

from mfit import models


class AttemptsLogs(models.Base):

    __tablename__ = 'attempts_logs'

    id = Column(Integer, primary_key=True)
    attempts_id = Column(ForeignKey('attempts.id'))
    habits_id = Column(ForeignKey('habits.id'))
    sets_remaining = Column()

    attempt = relationship('Attempts', back_populates='logs')
    habit = relationship('Habits', back_populates='attempts_logs')

    def __init__(self, attempt, habit, sets_remaining):

        """
        Attempts Logs model.

        Parameters
        ----------
        attempt : mfit.models.Attempts
            Attempts entity.
        habit : mfit.models.Habits
            Habits entity.
        sets_remaining : int
            Number of remaining sets for the corresponding habit for
            that day.
        """

        self.attempts_id = attempt.id
        self.habits_id = habit.id
        self.sets_remaining = sets_remaining

    def __repr__(self):
        repr_ = '{}(attempt={}, habit={}, sets_remaining={})'
        return repr_.format(self.__class__.__name__,
                            self.attempt,
                            self.habit,
                            self.sets_remaining)


{'fraction_non_alphanumeric': 0.1031390134529148, 'fraction_numerical': 0.0007473841554559044, 'mean_word_length': 2.1346604215456675, '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': '1978387', 'n_tokens_mistral': 784, 'n_tokens_neox': 745, 'n_words': 168}