def __init__(self, hash_name, name, real_name=None, team=None): # super(self.__class__, self).__init__() BaseModel.__init__(self) self.hash_id = hash_name self.name = name self.real_name = real_name self.team = team
def __init__(self, vcalendar): BaseModel.__init__(self) self.__models = [] # List of Model derived class instances which bridge between Kiwi and iCalendar components self.__vcalendar = vcalendar self.modified = True for vcomponent in self.__vcalendar.subcomponents: self.__models.append(self.factory.model_from_vcomponent(vcomponent))
def __init__(self, vtodo): BaseModel.__init__(self) self.__vtodo = vtodo self.__alarms = [] self.modified = False for valarm in self.__vtodo.walk('VALARM'): self.__alarms.append(self.factory.alarm_from_vcomponent(valarm, self))
def __init__(self, dataset, dataset_path, sample=False, sample_num=None, split_method='6-2-2', use_category=True): BaseModel.__init__(self, dataset, dataset_path, sample, sample_num, split_method, use_category) self.model_name = 'lgb'
def test_diff_names(): base_model = BaseModel() X, y = base_model.load_csv( dataset_path=os.path.join(data_dir, "off_names.csv"), input_cols=["x_position", "x_velocity", "angle_position", "angle_velocity",], output_cols=["angle_position", "angle_velocity"], augm_cols=["command", "length", "masspole"], max_rows=1000, ) assert X.shape[0] == 980 == y.shape[0]
def test_base_reader(): base_model = BaseModel() X, y = base_model.load_csv( dataset_path=os.path.join(data_dir, "cartpole_st1_at.csv"), max_rows=1000, augm_cols=["action_command", "config_length", "config_masspole"], ) assert X.shape[0] == 980 == y.shape[0] assert X.shape[1] == 7 assert y.shape[1] == 4
def __init__(self, _dict): if not _dict.__contains__("id"): _dict["status"] = "" elif _dict["type"] == SCRAP.TYPE: _dict["approval_uid"] = session[USER_SESSION]["uid"] _dict["approval_time"] = datetime.now().strftime("%Y-%m-%d") _dict["update_time"] = datetime.now().strftime("%Y-%m-%d") else: _dict["update_time"] = datetime.now().strftime("%Y-%m-%d") if not _dict.__contains__("stock_id"): raise ExceptionEx("库存不能为空") elif not Stock.query.filter(Stock.id == _dict["stock_id"]).count(): raise ExceptionEx("库存不存在") BaseModel.__init__(self, _dict)
def __init__(self, _dict): BaseModel.__init__(self) for k, v in _dict.items(): if k == "category_id": query = Category.query.filter(Category.id == v) if not query.count(): raise ExceptionEx("不存在的商品id") self.category = query.one() if k == "spec_id": query = Category.query.filter(Category.id == v) if not query.count(): raise ExceptionEx("不存在的规格id") self.spec = query.one() if "time" in k: setattr(self, k, datetime.strptime(v, "%Y-%m-%d")) elif k == "id": pass else: setattr(self, k, v)
def __init__(self, room_id, text, user_id=None, ts=None): # super(self.__class__, self).__init__() BaseModel.__init__(self) # Check if room exists room = RoomManager.find(room_id) if room is None: raise RoomNotFound(room_id) else: self.room = room # Check if user exists if user_id is not None: user = UserManager.find(user_id) if user is None: raise UserNotFoundError(user_id) else: self.user = user self.text = text self.ts = ts
def __init__(self, *, data=None, filename=None): ''' 使用numpy数组或者csv文件创建对象,只能选择一项进行初始化。 数据格式:最后一列代表类别,其他列代表特征项 :param data: numpy数组,必须二维 :param filename: csv文件名 ''' BaseModel.__init__(self) if data and filename or not data and not filename: raise Exception('Input mode error') if filename: data = np.loadtxt(filename, delimiter=',') if not isinstance( data, np.ndarray) or len(data.shape) != 2 or data.shape[1] < 2: raise Exception('Data format error') self.features = [] for col in data.T[:-1]: self.features.append( {'count': dict(zip(*np.unique(col, return_counts=True)))}) self.target = { 'count': dict(zip(*np.unique(data[:, -1], return_counts=True))) }
def __init__(self, valarm, parent_model): BaseModel.__init__(self) self.__valarm = valarm self.__parent_model = parent_model self.modified = False
def __init__(self, model_id=None, **kwargs): BaseModel.__init__(self, model_id, **kwargs)
def __init__(self, **kargs): BaseModel.__init__(self, **kargs)
def dal(): #数据源 return BaseModel()
def __init__(self): BaseModel.__init__(self) self.enc = _small_encoder() self.dec = _small_decoder()
import telebot from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from telebot import types import psycopg2 import settings from base import BaseModel from user import User bot = telebot.TeleBot(settings.__TELEGRAM_TOKEN__, parse_mode=None) ######################################################### engine = create_engine('sqlite:///test.db', echo=True) BaseModel.create_base(engine) session = sessionmaker(bind=engine)() ######################################################## conn = psycopg2.connect(dbname='rtneo', user='******', password='******', host='localhost') cursor = conn.cursor() ############################################################### @bot.message_handler(commands=['start']) def send_welcome(message): bot.send_message(message.from_user.id, 'Для начала введите команду /auth') @bot.message_handler(commands=['auth'])
def dal(): return BaseModel()
def __init__(self, vjournal): BaseModel.__init__(self) self.__vjournal = vjournal self.modified = False
def __init__(self, room_type, hash_name, name): # super(self.__class__, self).__init__() BaseModel.__init__(self) self.room_type = room_type self.hash_id = hash_name self.name = name