예제 #1
0
    def __init__(self):
        BaseModel.__init__(self)
        self._name = ''  # nombre de producto
        self._sku = ''  # id de producto
        self._description = ''  # descripcion de producto
        self._brand = ''  # marca de producto
        self._manufacturer = ''  # proveedor
        self._size = []  # tallas
        self._color = []  # color
        self._material = ''  # material
        self._bullet_1 = ''  # viñeta 1
        self._bullet_2 = ''  # viñeta 2
        self._bullet_3 = ''  # viñeta 3
        self._currency = ''  # divisa
        self._image = ''  # imagen 1
        self._image_2 = ''  # imagen 2
        self._image_3 = ''  # imagen 3
        self._image_4 = ''  # imagen 4
        self._image_5 = ''  # imagen 5
        self._image_6 = ''  # imagen 6
        self._category = ''  # categoria
        self._upc = ''  # articulo
        self._price = ''  # precio compra
        self._sell_price = 0  # precio venta
        self._delivery = ""  # texto delivery detalle de producto
        self._which_size = ""  # texto cual es tu talla detalle de producto
        self._tags = ''
        self._promotion_price = 0  # precio promocion
        self._size_id = ""
        self._bulk_price = 0

        # self.collection = db.product

        self.table = 'Product'
예제 #2
0
파일: order.py 프로젝트: chachun88/gdf
 def __init__(self):
     BaseModel.__init__(self)
     self._id = ""
     self._date = ""
     self._type = 1  # por defecto 1 para personas
     self._salesman = ""
     self._user_id = ""
     self._subtotal = ""
     self._shipping = ""
     self._tax = ""
     self._total = ""
     self._address = ""
     self._town = ""
     self._city = ""
     self._source = ""
     self._country = ""
     self._items_quantity = ""
     self._products_quantity = ""
     self._state = self.ESTADO_PENDIENTE
     self._billing_id = -1
     self._shipping_id = -1
     self._address_id = -1
     self._payment_type = 1
     self._voucher = ""
     self._shipping_info = ""
     self._billing_info = ""
예제 #3
0
    def __init__(self):
        BaseModel.__init__(self)
        self._name = ''
        self._parent = None

        # self.collection = db.category
        self.table = 'Category'
예제 #4
0
 def __init__(self, opt):
     BaseModel.__init__(self, opt)
     if self.isTrain:
         self.model_names = ['G', 'D']
     else:
         self.model_names = ['G']
     self.visual_names = ['realA', 'fakeB', 'realB']
     self.loss_names = ['G_GAN', 'G_L1', 'D_real', 'D_fake']
     self.netG = sequenceModels.define_G(opt.input_nc,
                                         opt.output_nc,
                                         opt.ngf,
                                         opt.netG,
                                         gpu_ids=opt.gpu_ids)
     if self.isTrain:
         self.netD = sequenceModels.define_D(opt.input_nc + opt.output_nc,
                                             opt.ndf,
                                             opt.netD,
                                             gpu_ids=opt.gpu_ids)
     if self.isTrain:
         self.criterionGAN = sequenceModels.GANLoss(opt.gan_mode).to(
             self.device)
         self.criterionL1 = torch.nn.L1Loss()
         self.optimizer_G = torch.optim.Adam(self.netG.parameters(),
                                             lr=opt.lr,
                                             betas=(opt.beta1, 0.999))
         self.optimizer_D = torch.optim.Adam(self.netD.parameters(),
                                             lr=opt.lr,
                                             betas=(opt.beta1, 0.999))
         self.optimizers.append(self.optimizer_G)
         self.optimizers.append(self.optimizer_D)
     from IPython import embed
     embed()
예제 #5
0
파일: order.py 프로젝트: chachun88/bodegas
 def __init__(self):
     BaseModel.__init__(self)
     self.table = "Order"
     self._id = ""
     self._date = ""
     self._type = ""
     self._salesman = ""
     self._customer = ""
     self._subtotal = ""
     self._shipping = ""
     self._tax = ""
     self._total = ""
     self._address = ""
     self._town = ""
     self._city = ""
     self._source = ""
     self._country = ""
     self._items_quantity = ""
     self._product_quantity = ""
     self._state = self.ESTADO_PENDIENTE
     self._payment_type = ""
     self._billing_id = ""
     self._shipping_id = ""
     self._user_id = ""
     self._shipping_info = ''
     self._billing_info = ''
예제 #6
0
    def GetAllCellars():

        conn = BaseModel().connection
        cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)

        query = '''select * from "Cellar"'''

        try:
            cur.execute(query)
            cellar = cur.fetchall()

            data_rtn = []

            for c in cellar:
                cellar = Cellar()
                cellar.id = c['id']
                cellar.name = c['name']
                cellar.description = c['description']
                cellar.city = c["city_id"]
                cellar.for_sale = c["for_sale"]

                data_rtn.append(cellar.Print())

            return data_rtn

        except Exception, e:
            print "Get all cellars {}".format(str(e))
예제 #7
0
    def __init__(self):
        BaseModel.__init__(self)
        self._name = ''
        self._idd = ''

        self.collection = db.color
        db.system_js.counter = 'function(name){ var ret = db.counters.findAndModify({query:{_id:name}, update:{$inc:{next:1}}, "new":true, upsert:true}); return ret.next; }'
예제 #8
0
파일: product.py 프로젝트: chachun88/gdf
 def __init__(self):
     BaseModel.__init__(self)
     self._name = ''  # nombre de producto
     self._sku = ''  # id de producto
     self._description = ''  # descripcion de producto
     self._brand = ''  # marca de producto
     self._manufacturer = ''  # proveedor
     self._size = []  # tallas
     self._color = []  # color
     self._material = ''  # material
     self._bullet_1 = ''  # viñeta 1
     self._bullet_2 = ''  # viñeta 2
     self._bullet_3 = ''  # viñeta 3
     self._currency = ''  # divisa
     self._image = ''  # imagen 1
     self._image_2 = ''  # imagen 2
     self._image_3 = ''  # imagen 3
     self._image_4 = ''  # imagen 3
     self._image_5 = ''  # imagen 3
     self._image_6 = ''  # imagen 3
     self._category = ''  # categoria
     self._upc = ''  # articulo
     self._price = ''  # precio compra
     self._sell_price = 0  # precio venta
     self._delivery = ""  # delivery
     self._which_size = ""  # cual es tu talla
     self._promotion_price = 0
     self._size_id = ""
     self._bulk_price = 0
     self._position = 0
     self._added = 0
     self._sold = 0
예제 #9
0
파일: log.py 프로젝트: gelendir/tiktok
    def __init__( self, *args, **kwargs ):

        BaseModel.__init__( self, *args, **kwargs )
        self['duration'] = secs_to_timedelta( self['duration'] )
        self['start'] = parse_isoutc( self.pop('started_at') )
        self['end'] = self['start'] + self['duration']
        del self['paused_duration']
        del self['scm_changeset_id']
예제 #10
0
 def __init__(self):
     BaseModel.__init__(self)
     self._id = ""
     self._order_id = ""
     self._quantity = ""
     self._product_id = ""
     self._total = ""
     self._size = ""
예제 #11
0
 def __init__(self):
     BaseModel.__init__(self)
     self.table = 'Shipping'
     self._identifier = 0
     self._to_city_id = 0
     self._from_city_id = 0
     self._edited = 0
     self._price = 0
     self._correos_price = 0
     self._chilexpress_price = 0
예제 #12
0
 def __init__(self):
     BaseModel.__init__(self)
     self.table = 'Shipping'
     self._identifier = ''
     self._to_city_id = 0
     self._from_city_id = 0
     self._edited = False
     self._price = 0
     self._correos_price = 0
     self._chilexpress_price = 0
     self._charge_type = 1
     self._post_office_id = None
예제 #13
0
 def __init__(self):
     BaseModel.__init__(self)
     # self.collection = db.salesman
     self.table = 'User'
     self._salesman_id = ''
     self._name = ''
     self._password = ''
     self._email = ''
     self._permissions = []
     self._cellars = []
     self._permissions_name = []
     self._cellars_name = []
     self._lastname = ""
     self._type_id = ''
예제 #14
0
 def __init__(self):
     BaseModel.__init__(self)
     self._id = ""
     self._name = ""
     self._type = 3
     self._telephone = ""
     self._email = ""
     self._address = ""
     self._user_id = ""
     self._lastname = ""
     self._city = ""
     self._zip_code = ""
     self._additional_info = ""
     self._town = ""
     self._rut = ""
예제 #15
0
 def __init__(self):
     BaseModel.__init__(self)
     self._id = ""
     self._monto = 0
     self._codigo_autorizacion = ""
     self._final_numero_tarjeta = ""
     self._fecha_contable = ""
     self._fecha_transaccion = ""
     self._hora_transaccion = ""
     self._id_transaccion = ""
     self._tipo_pago = ""
     self._numero_cuotas = 0
     self._id_sesion = ""
     self._orden_compra = ""
     self._order_id = ""
예제 #16
0
파일: user.py 프로젝트: chachun88/gdf
 def __init__(self):
     BaseModel.__init__(self)
     # self.collection = db.salesman
     self.table = 'User'
     self._salesman_id = ''
     self._name = ''
     self._password = ''
     self._email = ''
     self._permissions = []
     self._cellars = []
     self._permissions_name = []
     self._cellars_name = []
     self._user_type = UserType.VISITA  # se debe pasar el nombre del tipo de usuario, no el id
     self._bussiness = ''
     self._rut = ''
     self._status = User.PENDIENTE
예제 #17
0
 def __init__(self):
     BaseModel.__init__(self)
     self.table = 'Temp_Cart'
     self._product_id = -1
     self._date = datetime.now(
         pytz.timezone('Chile/Continental')).isoformat()
     self._quantity = 0
     self._subtotal = 0
     self._user_id = -1
     self._size = ''
     self._shipping_id = 0
     self._billing_id = 0
     self._payment_type = 1
     self._shipping_type = 1
     self._price = 0
     self._shipping_info = ""
     self._billing_info = ""
예제 #18
0
파일: kardex.py 프로젝트: chachun88/bodegas
 def __init__(self):
     BaseModel.__init__(self)
     self._product_sku = ''
     self._cellar_identifier = ''
     self._operation_type = Kardex.OPERATION_BUY
     self._units = 0
     self._price = 0.0
     self._sell_price = 0.0
     self._size_id = ''
     self._color = ''
     self._total = 0.0
     self._balance_units = 0
     self._balance_price = 0.0
     self._balance_total = 0.0
     self._date = 0000000
     self._user = ""
     self._product_id = ""
예제 #19
0
 def __init__(self):
     BaseModel.__init__(self)
     self._id = ""
     self._name = ""
     self._lastname = ""
     self._type = ""
     self._rut = ""
     self._contact = Contact()
     self._bussiness = ""
     self._approval_date = ""
     self._registration_date = ""
     self._status = ""
     self._first_view = ""
     self._last_view = ""
     self._username = ""
     self._password = ""
     self._email = ""
예제 #20
0
 def __init__(self):
     BaseModel.__init__(self)
     self._product_sku = ''
     self._cellar_identifier = ''
     self._operation_type = Kardex.OPERATION_BUY
     self._units = 0
     self._price = 0.0
     self._sell_price = 0.0
     self._size_id= ''
     self._color=''
     self._total = 0.0
     self._balance_units = 0
     self._balance_price = 0.0
     self._balance_total = 0.0
     self._date = str(datetime.datetime.now(pytz.timezone('Chile/Continental')).isoformat())
     self._user = ""
     self._product_id = ""
     self._order_id = None
def load_model(hps, model_path):
    session = tf.Session()
    model = BaseModel(hps)

    saver = tf.train.Saver()
    saver.restore(session, save_path=model_path)
    # x ** 2 < 50

    return model, session
예제 #22
0
    def initialize(self, datos):
        """
        Funcion que carga los datos a la clase contact que llama a esta funcion
        @param {objeto} datos En este objeto debe contener todos los datos de
                              un contacto
        @return No retorna nada
        @author : Chien-Hung
        """

        BaseModel.__init__(self)
        self._id = datos["id"]
        self._name = datos["name"]
        self._type = 3
        self._telephone = datos["telephone"]
        self._email = datos["email"]
        self._address = datos["address"]
        self._user_id = datos["user_id"]
        self._lastname = datos["lastname"]
        self._city = datos["city_id"]
        self._zip_code = datos["zip_code"]
        self._additional_info = datos["additional_info"]
        self._town = datos["town"]
        self._rut = datos["rut"]
예제 #23
0
    def CellarExists(cellar_name):

        bm = BaseModel()

        cur = bm.connection.cursor(cursor_factory=psycopg2.extras.DictCursor)

        query = '''select * from "Cellar" where name = %(name)s limit 1'''
        parametros = {"name": cellar_name}

        cur.execute(query, parametros)

        if cur.rowcount > 0:
            return True
        else:
            return False
예제 #24
0
    def Remove(self):

        is_empty = True

        cur = self.connection.cursor(cursor_factory=psycopg2.extras.DictCursor)

        query = '''select * from "Kardex" where cellar_id = %(cellar_id)s'''

        parametros = {"cellar_id": self.id}

        cur.execute(query, parametros)

        kardex = cur.fetchall()

        for k in kardex:

            query = '''select * from "Kardex" where product_sku = %(product_sku)s and cellar_id = %(cellar_id)s and size_id = %(size_id)s order by date desc, id desc limit 1'''

            parametros = {
                "product_sku": k["product_sku"],
                "cellar_id": self.id,
                "size_id": k["size_id"]
            }

            cur.execute(query, parametros)

            _kardex = cur.fetchone()

            if _kardex:
                if int(_kardex["balance_units"]) >= 1:
                    is_empty = False

        if is_empty:

            query = '''update "User" set cellar_permissions = cellar_permissions - array[%(cellar_id)s]'''
            parametros = {"cellar_id": self.id}

            cur.execute(query, parametros)
            self.connection.commit()

            return BaseModel.Remove(self)

        else:
            return self.ShowError(
                "No se puede eliminar, aún contiene productos.")
예제 #25
0
    def get_single_post(self, post_id):
        con = init_db()
        cur = con.cursor()
        if BaseModel().check_exist('posts', 'post_id', post_id) == False:
            return 404

        query = "SELECT title, description, created_by, created_on FROM posts WHERE post_id={}".format(
            post_id)
        cur.execute(query)
        data = cur.fetchall()[0]
        res = []

        posts = dict(title=data[0],
                     description=data[1],
                     created_by=int(data[2]),
                     created_on=str(data[3]))
        res.append(posts)
        return res
예제 #26
0
    def save(self):
        post = {
            "title": self.title,
            "description": self.description,
            "created_by": self.created_by
        }

        con = init_db()
        cur = con.cursor()

        if BaseModel().check_exist('posts', 'title', self.title) == True:
            return "post already exists"

        query = """ INSERT INTO posts (title, description, created_by) VALUES \
					( %(title)s, %(description)s, %(created_by)s) RETURNING post_id """
        cur.execute(query, post)
        post_id = cur.fetchone()[0]
        con.commit()
        cur.close()
        return post_id
예제 #27
0
    def save(self):
        user = {
            "name": self.name,
            "username": self.username,
            "email": self.email,
            "password": self.password
        }

        con = init_db()
        cur = con.cursor()

        if BaseModel().check_exist('users', 'email', self.email) == True:
            return "user already exists"

        query = """ INSERT INTO users (name, username, email, password) VALUES \
                    ( %(name)s, %(username)s, %(email)s, %(password)s) RETURNING user_id """
        cur.execute(query, user)
        user_id = cur.fetchone()[0]
        con.commit()
        con.close()
        return user_id
예제 #28
0
    def CellarExists(cellar_name):

        # data = db.cellar.find({"name" : cellar_name })

        # if data.count() >= 1:
        #   return True
        # return False

        bm = BaseModel()

        cur = bm.connection.cursor(cursor_factory=psycopg2.extras.DictCursor)

        query = '''select * from "Cellar" where name = %(name)s limit 1'''
        parametros = {"name": cellar_name}
        cur.execute(query, parametros)
        cellar = cur.fetchone()

        if cellar:
            return True
        else:
            return False
예제 #29
0
 def test_prepare(self):
     from basemodel import BaseModel
     a = BaseModel('../data4testing/train.csv', verbose=False)
     a.prepare_data('../data4testing/bids.csv', verbose=False)
     self.assertSequenceEqual(a.df_train.shape, (2, 176))
예제 #30
0
 def __init__(self):
     BaseModel.__init__(self)
     self.name = ''
     self.description = ''
     self.table = 'Cellar'
     self.city = 0
예제 #31
0
 def __init__(self):
     BaseModel.__init__(self)
     self._name = ''
     self.table = 'Post_Office'
예제 #32
0
파일: recode.py 프로젝트: moonxue/tasklist
 def __init__(self):
     BaseModel.__init__(self)
     self.recode = self.db.recode
예제 #33
0
 def __init__(self):
     BaseModel.__init__(self)
     self._name = ''
예제 #34
0
파일: user.py 프로젝트: moonxue/tasklist
 def __init__(self):
     BaseModel.__init__(self)
     self.user = self.db.user