Exemplo n.º 1
0
def add_from_file():
    with open('snipe_data\\snipes.csv', newline='') as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
            launch = eval("datetime.datetime({},{},{},{},{})".format(
                row['year'], row['month'], row['day'], row['hour'],
                row['min']))
            merch = Product(row['size'], launch, row['link'], row['name'])
            with open('snipe_data\\snipes.txt', 'a') as file:
                file.write(merch.__repr__())
                file.write('\n')
    return
Exemplo n.º 2
0
def add_snipe():
    name = input('Name: ')
    link = input('Link: ')
    size = get_inputs(
        'Size',
        valid_sizes,
    )
    month = get_inputs('Month', valid_month)
    day = get_inputs('Day', valid_day)
    year = get_inputs('Year', valid_year, '2020')
    hour = get_inputs('Hour', valid_hour, '10')
    minute = get_inputs('Minute', valid_month, '0')
    launch = datetime.datetime(int(year), int(month), int(day), int(hour),
                               int(minute))
    merch = Product(size, launch, link, name)
    with open('snipe_data\\snipes.txt', 'a') as file:
        file.write(merch.__repr__())
        return
Exemplo n.º 3
0
from bike import Bike
from car import Car
from product import Product
from store import Store
import animal
from math_dojo import MathDojo
import call_center
import hospital
from underscore import Underscore

bmx = Bike(100, "30 mph")
print bmx.__repr__()
toyota = Car(20000, "120 mph", "Full", 50000)
print toyota.__repr__()
mouse = Product(10, "Computer Mouse", "5 ounces", "Logitech", 5)
print mouse.__repr__()
electronics = Store("San Jose, CA", "Me Me")
print electronics.__repr__()
hamster = animal.Animal("Hammy", 50)
print hamster.__repr__()
spot = animal.Dog()
print spot.__repr__()
maggie = animal.Dragon()
print maggie.__repr__()
al = MathDojo()
print al.__repr__()
call1 = call_center.Call("Aaron", "268-347-1484", 911, "Complaint")
print call1.__repr__()
center1 = call_center.CallCenter()
print center1.__repr__()
patient1 = hospital.Patient(135, "Deborah", "sulfonamides")