<commit_before>"""
This module contains everything necessary to describe your latest 
shopping trip.

The main purpose of this module is to give you everything you need to 
create and maintain a Receipt object. You can create item objects that 
can be attached to your receipt
"""
from sqlalchemy import Column, Integer, String, Sequence, Float
from database import Base
from globalmethods import ask_yes_no_question

import datetime
import copy
        
class Receipt(object):
    """
    Collection of Items describing a trip to a store
    
    Records the tax rate at the time of entry so that it does not change
    if the provincial tax rate changes.
    """
    
    def __init__(self, store, purchase_date=datetime.date.today()):
        self.store = store
        self.purchase_date = purchase_date
        self.items = []
        self.tax = store.province.taxes
    
    def __str__(self):
        """Creates a string that resembles a receipt form a store"""
        str_out = 'Receipt: \n'
        str_out += ' '.join([self.store.name, '    ', 
                             str(self.purchase_date), '\n' ])
        
        for item in self.items:
            str_out += ' '.join(['\n', str(item), '    ', 
                            str(round(item.total_cost(self.tax),2))])
            
        str_out += ' '.join(['\n\nTaxes:', str(self.tax), 
                             '    Total =', str(round(self.total(),2))])
        return str_out
        
    
    def total(self):
        """
        Takes the total_cost for each item and adds them to get a total
        """
        total = 0
        for item in self.items:<commit_msg>Created a receipt table and added all the necessary column variables.<commit_after>"""
This module contains everything necessary to describe your latest 
shopping trip.

The main purpose of this module is to give you everything you need to 
create and maintain a Receipt object. You can create item objects that 
can be attached to your receipt
"""
from sqlalchemy import Column, Integer, String, Sequence, Float, Date
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref

from database import Base
from globalmethods import ask_yes_no_question

import datetime
import copy
        
class Receipt(Base):
    """
    Collection of Items describing a trip to a store
    
    Records the tax rate at the time of entry so that it does not change
    if the provincial tax rate changes.
    """
    __tablename__ = 'Receipts'
    
    id = Column(Integer, Sequence('receipt_id_seq'), primary_key=True)
    user_id = Column(Integer, ForeignKey('users.id'))
    store_id = Column(Integer, ForeignKey('stores.id'))
    purchase_date = Column(Date)
    tax = Column(Float())
    
    
    def __init__(self, store, purchase_date=datetime.date.today()):
        self.store = store
        self.purchase_date = purchase_date
        self.tax = store.province.taxes
    
    def __str__(self):
        """Creates a string that resembles a receipt form a store"""
        str_out = 'Receipt: \n'
        str_out += ' '.join([self.store.name, '    ', 
                             str(self.purchase_date), '\n' ])
        
        for item in self.items:
            str_out += ' '.join(['\n', str(item), '    ', 
                            str(round(item.total_cost(self.tax),2))])
            
        str_out += ' '.join(['\n\nTaxes:', str(self.tax), 
                             '    Total =', str(round(self.total(),2))])
        return str_out
        
    
    def total(self):
        """
        Takes the total_cost for each item and adds them to get a total
        """
        total = 0
        for item in self.items:
{'fraction_non_alphanumeric': 0.09494184473897754, 'fraction_numerical': 0.0016229375169055991, 'mean_word_length': 2.2100694444444446, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4007016', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1016, 'n_words': 358}