def fetch_insta_post_data(insta_post_model): insta_media_description_xpath = "//div[@class='row title']" searching_result = "//div[@id='sf_result']/div[contains(@class, 'result')]" results_for_download = f"{searching_result}//a[@download]" with WebDriverFactory(FIREFOX).get_webdriver_instance() as driver: try: driver.get( instagram_save_content_service + insta_post_model.post_url) wait_visibility(True, driver, searching_result) wait_for_ajax(driver) insta_post_items = driver.find_elements_by_xpath( results_for_download) post_media_urls = [media.get_attribute( "href") for media in insta_post_items] insta_post_model.media_urls = post_media_urls insta_post_description = driver.find_element_by_xpath( insta_media_description_xpath).text insta_post_model.post_description = insta_post_description except NoSuchElementException as ex: take_screenshot( driver, os.path.join( "screenshot", f"{datetime.datetime.now().microsecond}.jpg")) raise ex logger().info(("--Instagram instance-- '{}'".format(insta_post_model.__dict__)).encode("utf-8"))
def insert_user(self, user_chat): user_data = { 'id': user_chat.id, 'username': user_chat.username, 'first_name': user_chat.first_name, 'last_name': user_chat.last_name} self.users_table.insert(user_data) logger().info("Insert user {}".format(user_data))
def wait_for_ajax(driver): wait = WebDriverWait(driver, 30) try: wait.until( lambda driver: driver.execute_script('return jQuery.active') == 0) wait.until(lambda driver: driver.execute_script( 'return document.readyState') == 'complete') except Exception as e: logger().error(e)
def get_message_keyboard(*args): message_keyboard = types.InlineKeyboardMarkup() for button in args: buttons = [ types.InlineKeyboardButton( text=value, callback_data=key) for key, value in button.items()] message_keyboard.row(*buttons) logger().info(f"Get message keyboard: {args}") return message_keyboard
def __init__(self, latitude, longitude, search_item): self.latitude = latitude self.longitude = longitude self.search_item = search_item self.geo_map_url = location_url.format( item=search_item, longitude=longitude, latitude=latitude) self.screen_path = os.path.join( location_folder, "({})({})".format( latitude, longitude).replace( '.', "_") + ".png") logger().info("latitude: %s; longitude: %s" % (latitude, longitude))
def insert_currency_alarm(self, user, alarm_rate): logger().info( "Insert analytics currency rate alarm '{}' of user {}".format( alarm_rate, user.__dict__)) user_db_analytics = self.currency_alarm_table.search( self.query.id == user.user_id) if user_db_analytics: user_db_analytics[0]['alarm_rate'] = alarm_rate self.currency_alarm_table.write_back(user_db_analytics) else: self.currency_alarm_table.insert( {'id': user.user_id, 'alarm_rate': alarm_rate})
def fetch_currency_graph(currency_data): logger().info("Fetch currency data graph") x_axis_date = [currency_day.Date for currency_day in currency_data] y_axis_rate = [ currency_day.Cur_OfficialRate for currency_day in currency_data] fetch_plot_graph_image( x_axis_date, [y_axis_rate], currency_graph_path, ['{} today ({})'.format(y_axis_rate[-1], x_axis_date[-1].strftime(DATE_FORMAT_D_M_Y))])
def football_country_leagues(call): logger().info("Button '{}'".format(call.data)) user = User.get_user(user_id=call.from_user.id) actual_buttons_football = { **bot_config.buttons_football_country_leagues } # new dict instance sent_football_message( user, MSG_FOOTBALL_BASE_CMD, get_message_keyboard(*[{ k: v } for (k, v) in actual_buttons_football.items()])) DBConnector().insert_analytics(user, call.data)
def sent_virus_data(user): country = 'Belarus' logger().info("Get virus data for country '{}'".format(country)) country_all_data_virus = get_location_all_virus_covid_data_dir(country) country_actual_data_virus = get_last_virus_covid_data_dir( country, country_all_data_virus) world_actual_data_virus = get_last_virus_covid_data_dir() fetch_covid_graph(country_all_data_virus, country_actual_data_virus) bot.send_photo(chat_id=user.user_id, photo=open(covid_graph_path, 'rb')) bot.send_message( user.user_id, get_covid_virus_msg_content(country_actual_data_virus, world_actual_data_virus))
def insert_analytics(self, user, cmd): logger().info("Insert analytics command '{}' of user {}".format(cmd, user.__dict__)) user_db_analytics = self.cmd_table.search( self.query.id == user.user_id) if user_db_analytics: user_db_cmd_analytics = self.cmd_table.search( (self.query.id == user.user_id) & (self.query[cmd])) if user_db_cmd_analytics: user_db_cmd_analytics[0][cmd] += 1 self.cmd_table.write_back(user_db_cmd_analytics) else: user_db_analytics[0][cmd] = 1 self.cmd_table.write_back(user_db_analytics) else: self.cmd_table.insert({'id': user.user_id, cmd: 1})
def __init__(self, timeout=6000, parent=None): super(messageWidgetImpl, self).__init__(parent) self.setupUi(self) log = logger() self.message = log.getlogger('gui') self._timeout = timeout self._init()
def get_currency_message(currency_id): logger().info("Get currency data") currency_list = fetch_currency_list( get_currency_response_json(currency_id)) currency_response_past_days = get_currency_data_message( currency_list[-10:-1]) currency_response_current_day = get_currency_data_message( [currency_list[-1]]) current_currency = bot_config.buttons_currency_selection[currency_id] return MSG_CURRENCY_BOT.format( currency=current_currency, currency_past_days=currency_response_past_days, currency_current_day=currency_response_current_day)
def __init__(self): self.conf = config() log = logger() self.path = os.path.dirname(os.path.realpath(sys.argv[0])) self.confwebdav = log.getlogger('webdav') self.options = {} self.client = None
def __init__(self, filePath): self.file = filePath self.path = os.path.dirname(os.path.realpath(sys.argv[0])) log = logger() self.conf = config() self.confsql = log.getlogger('conf') self.webDav = webDavService() self.connect()
def __init__(self, key=')_9-+klo@c4t$k$w'): log = logger() self.path = os.path.dirname(os.path.realpath(sys.argv[0])) self.conflog = log.getlogger('conf') self.key = key.encode('utf-8') self.mode = AES.MODE_CBC self.dirs = self.path + "/config/" self.fileName = "config.ini"
def __init__(self, parent=None): super(firstWidgetImpl, self).__init__(parent) self.setupUi(self) self.setMouseTracking(True) log = logger() self.taskRan = False self.messageView = messageWidgetImpl() self.conffirst = log.getlogger('gui') self.sqlite = sqlite('/config/tomato.db')
def __init__(self, parent=None): super(statisWidgetImpl, self).__init__(parent) self.setupUi(self) self.setMouseTracking(True) log = logger() self.confstatis = log.getlogger('gui') self.sqlite = sqlite('/config/tomato.db') self.searchButton.clicked.connect(self.search) self.weekRefreshButton.clicked.connect(self.reloadWeek) self.monthRefreshButton.clicked.connect( lambda: self.loadMonthChart('', ''))
def get_movies(site_content): logger().info("Get movies") movies_section: str = MOVIES_POSTER movies: dict[str:list] = {} html_site_elements_content = Cleaner(style=True).clean_html( html.fromstring(site_content)) for movie in html_site_elements_content.xpath( MOVIE_TICKETS_BLOCK): # type: HtmlElement movie_block_tag = movie.tag if movie_block_tag == DIV_TAG: movies_section = movie.xpath( XPATH_GET_TEXT.format(xpath=MOVIES_TITLE_BLOCK))[0].strip() continue movies_poster = [] if movies.get( movies_section) is None else movies[movies_section] movies[movies_section] = movies_poster + fetch_movies(movie) return movies
def get_matches(site_content): logger().info("Get matches") matches_tree_xpath = "//div[contains(@class, 'statistics-table')]//tr//td[contains(text(), '-:-')]/ancestor::tr" match_host_team_xpath = ".//div[contains(@class, 'team_left')]//span" match_guest_team_xpath = ".//div[contains(@class, 'team_right')]//span" match_date_xpath = ".//span[contains(@class, 'date') and contains(@class, 'desktop')]" matches = [] xpath_get_text = "{xpath}//text()" for match in html.fromstring(site_content).xpath(matches_tree_xpath): match_host_team = match.xpath( xpath_get_text.format(xpath=match_host_team_xpath)) match_guest_team = match.xpath( xpath_get_text.format(xpath=match_guest_team_xpath)) match_date = match.xpath(xpath_get_text.format(xpath=match_date_xpath)) matches.append( Match(host_team=match_host_team, guest_team=match_guest_team, date=match_date)) return matches
def get_webdriver_instance(self, timeout=3, cookies=None): logger().info( "Initialization of {browser}.".format(browser=self.browser)) if self.browser == 'FIREFOX': executable_path = GeckoDriverManager().install() self.driver = webdriver.Firefox(executable_path=executable_path, options=get_firefox_options()) if self.browser == 'CHROME': executable_path = ChromeDriverManager().install() self.driver = webdriver.Chrome(executable_path=executable_path, options=get_chrome_options()) logger().info(f"Created instance of '{self.browser}' browser.") self.driver.implicitly_wait(timeout) self.driver.maximize_window() if cookies is None: cookies = {} for cookies in cookies: self.driver.add_cookie(cookie_dict=cookies) return self.driver
def __init__(self,start,end,thread_cnt,queue,function, wait_other_thread): threads=[] r=end-start+1 if thread_cnt < r: fragment = math.ceil(r / thread_cnt) big_trd = r % thread_cnt for i in range(big_trd): f_start = i * fragment + start f_end = (i + 1) * fragment + start threads.append(Thread(target=lambda q, start2,end2: q.put(function(start2,end2)), args=(queue, f_start,f_end))) fragment -= 1 small_trd = thread_cnt - big_trd for i in range(big_trd, big_trd + small_trd): f_start = i * fragment + big_trd + start f_end = (i + 1) * fragment + big_trd + start threads.append(Thread(target=lambda q, start2,end2: q.put(function(start2,end2)), args=(queue, f_start,f_end))) else: thread_cnt = r for i in range(thread_cnt): f_start = start+i f_end = f_start+1 threads.append(Thread(target=lambda q, start2,end2: q.put(function(start2,end2)), args=(queue, f_start,f_end))) for t in threads: try: t.start() except Exception as e: logger(e) for t in threads: t.join() if wait_other_thread: for i in threads: i.join()
def __init__(self, parent=None): super(memoWidgetImpl, self).__init__(parent) self.setupUi(self) self.setMouseTracking(True) log = logger() self.tempNodes = [] # 日历创建临时节点存储 self.memoList = [] self.yearDict = {} # 年节点存储 self.confmemo = log.getlogger('gui') self.sqlite = sqlite('/config/tomato.db') self.loadTree() self.createBtnMenu() # 日历功能 self.calendarWidget.clicked.connect(self.dayDirCreate) self.addTodayButton.clicked.connect(self.todayMemo) # 文件树功能 self.treeWidget.itemExpanded.connect(self.collapseOther) self.treeWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.treeWidget.customContextMenuRequested.connect( self.createRightMenu) self.treeWidget.itemDoubleClicked.connect(self.changeShow) # 文件列表功能 self.fileTableWidget.setColumnHidden(0, True) self.fileTableWidget.doubleClicked.connect(self.tableOpenMemo) # 文件编辑功能 self.searchWidget.setVisible(False) self.mdiArea.subWindowActivated.connect(self.articleCountFun) self.copyButton.clicked.connect(self.fileCopy) self.cutButton.clicked.connect(self.fileCut) self.pasteButton.clicked.connect(self.filePaste) self.revokeButton.clicked.connect(self.fileUndo) self.resumeButton.clicked.connect(self.fileRedo) self.fontComboBox.currentFontChanged.connect(self.fileChangeFont) self.fontSizeBox.valueChanged.connect(self.fileChangeSize) self.leftJustButton.clicked.connect(self.alignLeft) self.centerButton.clicked.connect(self.alignCenter) self.rightJustButton.clicked.connect(self.alignRight) self.bordButton.clicked.connect(self.fileBold) self.ItalicButton.clicked.connect(self.fileItalic) self.underlineButton.clicked.connect(self.fileUnderline) self.fontColorButton.clicked.connect(self.fileColorBox) self.signlePenButton.clicked.connect(self.fileColorBackBox) self.searchChangeButton.clicked.connect(self.serchBarChange) self.searchButton.clicked.connect(self.fileSearch) self.searchLineEdit.returnPressed.connect(self.fileSearch) self.saveButton.clicked.connect(self.fileSave)
def __init__(self, parent=None): super(miniBarImpl, self).__init__(parent) self.setupUi(self) self.conf = config() log = logger() self.confmini = log.getlogger('gui') self.task = {} self.timer = QTimer() self.messageView = messageWidgetImpl() self.move(int(self.conf.getOption('miniBar', 'placeX')), int(self.conf.getOption('miniBar', 'placeY'))) self.taskLabel.setText("无","white") self.normalSizeButton.clicked.connect(self.normalSize) self.timer.timeout.connect(self.taskStageShow) self.redoButton.clicked.connect(self.redoTask) self.startButton.clicked.connect(self.startTask) self.pauseButton.clicked.connect(self.pauseTask) self.stopButton.clicked.connect(self.stopTask)
def __init__(self, parent=None): super(todayItemImpl, self).__init__(parent) self.setupUi(self) self.task = {} self.top = 0 log = logger() self.doingLabel.setVisible(False) self.doingLabel.setText("正在执行") self.conftodo = log.getlogger('gui') self.upIcon = QtGui.QIcon() self.upIcon.addPixmap(QtGui.QPixmap(":/icon/top.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.downIcon = QtGui.QIcon() self.downIcon.addPixmap(QtGui.QPixmap(":/icon/untop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.topButton.clicked.connect(self.topTask) self.startButton.clicked.connect(self.startTask) self.deleteButton.clicked.connect(self.unlink)
def __init__(self, parent=None): super(todoWidgetImpl, self).__init__(parent) self.setupUi(self) self.flag = False self.unLock = False self.mouseflag = False self.taskRan = False log = logger() self.conftodo = log.getlogger('gui') self.messageView = messageWidgetImpl() self.showHideWidget.setVisible(False) self.conf = config() self.checkLock() self.sqlite = sqlite('/config/tomato.db') self.move(int(self.conf.getOption('todoList', 'placeX')), int(self.conf.getOption('todoList', 'placeY'))) self.lockButton.clicked.connect(self.checkLock) #锁定/解锁 self.changeButton.clicked.connect(self.changeCurrentPage) #切换当前页面
def __init__(self, parent=None): super(taskWidgetImpl, self).__init__(parent) self.setupUi(self) self.setMouseTracking(True) log = logger() self.conftask = log.getlogger('gui') self.sqlite = sqlite('/config/tomato.db') self.id = '' self.taskDeadLineEdit.setMinimumDate(QDate.currentDate()) #功能绑定 self.addTaskButton.clicked.connect(self.addTask) self.modifTaskButton.clicked.connect(self.modifTask) self.delTaskButton.clicked.connect(self.deletTask) self.cancleButton.clicked.connect(self.cancel) self.commitButton.clicked.connect(self.commitTask) self.calendarWidget.clicked.connect(self.currentDayTask) self.linkDayButton.clicked.connect(self.taskLinkDay) self.undoLinkButton.clicked.connect(self.taskUnlinkDay)
def bot_handler_wrapper(bot_request): try: return f(bot_request) except Exception as e: logger().exception(str(e))
class noBorderImpl: log = logger() confnoborder = log.getlogger('gui') flag = False _m_Position = None Margins = 3 Direction = None def move(self, pos): if self.windowState() == QtCore.Qt.WindowMaximized or self.windowState( ) == QtCore.Qt.WindowFullScreen: # 最大化或者全屏则不允许移动 return # 无边框移动窗体 def mousePressEvent(self, QMouseEvent): try: if QMouseEvent.button() == QtCore.Qt.LeftButton: self.flag = True self._m_Position = QMouseEvent.globalPos() - self.pos() if self.Direction == None or self.Direction not in range(8): self.setCursor(QtCore.Qt.ClosedHandCursor) QMouseEvent.accept() except Exception as e: self.confnoborder.error(e) pass def mouseMoveEvent(self, QMouseEvent): try: pos = QMouseEvent.pos() xPos, yPos = pos.x(), pos.y() wm, hm = self.width() - self.Margins, self.height() - self.Margins if QtCore.Qt.LeftButton and self.flag: if self.Direction == None or self.Direction not in range(8): self.move(QMouseEvent.globalPos() - self._m_Position) # QMouseEvent.accept() else: self._resizeWidget(pos) elif xPos <= self.Margins and yPos <= self.Margins: # 左上角 self.Direction = LeftTop self.setCursor(QtCore.Qt.SizeFDiagCursor) elif wm <= xPos <= self.width() and hm <= yPos <= self.height(): # 右下角 self.Direction = RightBottom self.setCursor(QtCore.Qt.SizeFDiagCursor) elif wm <= xPos and yPos <= self.Margins: # 右上角 self.Direction = RightTop self.setCursor(QtCore.Qt.SizeBDiagCursor) elif xPos <= self.Margins and hm <= yPos: # 左下角 self.Direction = LeftBottom self.setCursor(QtCore.Qt.SizeBDiagCursor) elif 0 <= xPos <= self.Margins and self.Margins <= yPos <= hm: # 左边 self.Direction = Left self.setCursor(QtCore.Qt.SizeHorCursor) elif wm <= xPos <= self.width() and self.Margins <= yPos <= hm: # 右边 self.Direction = Right self.setCursor(QtCore.Qt.SizeHorCursor) elif self.Margins <= xPos <= wm and 0 <= yPos <= self.Margins: # 上面 self.Direction = Top self.setCursor(QtCore.Qt.SizeVerCursor) elif self.Margins <= xPos <= wm and hm <= yPos <= self.height(): # 下面 self.Direction = Bottom self.setCursor(QtCore.Qt.SizeVerCursor) else: self.Direction = None self.setCursor(QtCore.Qt.ArrowCursor) except Exception as e: self.confnoborder.error(e) pass def mouseReleaseEvent(self, QMouseEvent): try: self.flag = False self.setCursor(QtCore.Qt.ArrowCursor) except Exception as e: self.confnoborder.error(e) pass finally: self.setCursor(QtCore.Qt.ArrowCursor) # 调整窗体大小 def _resizeWidget(self, pos): """调整窗口大小""" if self.Direction == None: return mpos = pos - self._m_Position xPos, yPos = mpos.x(), mpos.y() geometry = self.geometry() x, y, w, h = geometry.x(), geometry.y(), geometry.width( ), geometry.height() if self.Direction == LeftTop: # 左上角 if w - xPos > self.minimumWidth(): x += xPos w -= xPos if h - yPos > self.minimumHeight(): y += yPos h -= yPos elif self.Direction == RightBottom: # 右下角 if w + xPos > self.minimumWidth(): w += xPos self._m_Position = pos if h + yPos > self.minimumHeight(): h += yPos self._m_Position = pos elif self.Direction == RightTop: # 右上角 if h - yPos > self.minimumHeight(): y += yPos h -= yPos if w + xPos > self.minimumWidth(): w += xPos self._m_Position.setX(pos.x()) elif self.Direction == LeftBottom: # 左下角 if w - xPos > self.minimumWidth(): x += xPos w -= xPos if h + yPos > self.minimumHeight(): h += yPos self._m_Position.setY(pos.y()) elif self.Direction == Left: # 左边 if w - xPos > self.minimumWidth(): x += xPos w -= xPos else: return elif self.Direction == Right: # 右边 if w + xPos > self.minimumWidth(): w += xPos self._m_Position = pos else: return elif self.Direction == Top: # 上面 if h - yPos > self.minimumHeight(): y += yPos h -= yPos else: return elif self.Direction == Bottom: # 下面 if h + yPos > self.minimumHeight(): h += yPos self._m_Position = pos else: return self.setGeometry(x, y, w, h)
def __init__(self, parent=None): super(mainWindowImpl, self).__init__(parent) self.setupUi(self) self.centralwidget.setMouseTracking(True) self.setMouseTracking(True) self.mainWidget.setMouseTracking(True) self.windowBar.setMouseTracking(True) self.conf = config() self.closeNow = True self.task = {} self.webDav = webDavService() if self.conf.getOption('webDav', 'enable') == "True": self.webDav.download('/config/tomato.db') self.sqlite = sqlite('/config/tomato.db') log = logger() self.confmain = log.getlogger('gui') self.trayIcon() self.checkOverdue() self.timer = QTimer() #界面初始化 self.unlockDialog = unlockDialogImpl() self.settingDialog = settingDialogImpl() self.miniBar = miniBarImpl() self.todolist = todoWidgetImpl() self.messageView = messageWidgetImpl() self.miniSizeButton.setDisabled(True) self.taskTitleLabel.setText("无") self.readyTomatoLabel.setText("0") self.totalTomatoLabel.setText("0") self.timeLcd.display("00:00") self.firstWidget = firstWidgetImpl() statisWidget = statisWidgetImpl() self.taskWidget = taskWidgetImpl() memoWidget = memoWidgetImpl() marketWidget = marketWidgetImpl() self.stackedWidget.addWidget(self.firstWidget) self.stackedWidget.addWidget(statisWidget) self.stackedWidget.addWidget(self.taskWidget) self.stackedWidget.addWidget(memoWidget) self.stackedWidget.addWidget(marketWidget) self.reloadConf() #信号绑定 self.allRefreshSignal.connect(self.firstWidget.refreshAll) self.allRefreshSignal.connect(statisWidget.refreshAll) self.allRefreshSignal.connect(self.taskWidget.refreshAll) self.allRefreshSignal.connect(memoWidget.loadTree) self.allRefreshSignal.connect(marketWidget.refreshAll) self.taskRefreshSignal.connect(self.firstWidget.refreshAll) self.taskRefreshSignal.connect(statisWidget.refreshAll) self.taskRefreshSignal.connect(self.taskWidget.refreshAll) self.coinRefreshSignal.connect(self.firstWidget.refreshAllCoin) self.coinRefreshSignal.connect(marketWidget.sumCoin) self.rateRefreshSignal.connect(marketWidget.getRate) marketWidget.coinRefreshSignal.connect(self.firstWidget.refreshAllCoin) self.miniSizeSignal.connect(self.miniBar.miniShow) self.taskCheckSignal.connect(self.firstWidget.taskCheck) self.miniBar.normalSizeSignal.connect(self.normalShow) self.miniBar.taskFinishSignal.connect(self.taskfinish) self.miniBar.taskStopSignal.connect(self.stopTask) self.firstWidget.taskRefreshSignal.connect(self.taskWidget.refreshAll) self.taskWidget.taskRefreshSignal.connect(self.firstWidget.refreshAll) self.firstWidget.taskStartSignal.connect(self.taskStart) self.coinRefreshSignal.emit() #功能绑定 self.firstPageButton.clicked.connect( lambda: self.stackedWidget.setCurrentIndex(0)) self.statisButton.clicked.connect( lambda: self.stackedWidget.setCurrentIndex(1)) self.taskButton.clicked.connect( lambda: self.stackedWidget.setCurrentIndex(2)) self.memoButton.clicked.connect( lambda: self.stackedWidget.setCurrentIndex(3)) self.marketButton.clicked.connect( lambda: self.stackedWidget.setCurrentIndex(4)) self.settingButton.clicked.connect(self.setting) self.introButton.clicked.connect(self.infoDialog) self.redoTimerButton.clicked.connect(self.redoTask) self.startTimerButton.clicked.connect(self.startTask) self.pauseTimerButton.clicked.connect(self.pauseTask) self.stopTimerButton.clicked.connect(self.stopTask) self.miniSizeButton.clicked.connect(self.miniSize) self.sizePushButton.clicked.connect(self.windowSizeChange) self.timer.timeout.connect(self.taskStageShow)
from . import base_dataset import scipy.misc import imageio import numpy as np import torch import pandas as pd import os import torchvision as tv from util import util from util.logger import logger import cv2 import random from tqdm import tqdm log = logger() mean = torch.Tensor((0.485, 0.456, 0.406)) stdv = torch.Tensor((0.229, 0.224, 0.225)) # mean = torch.Tensor((0.5, 0.5, 0.5)) # stdv = torch.Tensor((0.5, 0.5, 0.5)) # print('attributeDataset warning: mean and stdv are 0.5') forward_transform = tv.transforms.Compose([ tv.transforms.ToTensor(), tv.transforms.Normalize(mean=mean, std=stdv), ]) # class Dataset(base_dataset.BaseDataset): # def __init__(self, image_list, transform=forward_transform, scale=(128, 128), crop_size=(160, 160), # bias=(0, 15), # csv_path='analysis/list_attr_celeba.csv', sep=' ', scale_attribute=True): # super(Dataset, self).__init__()
'-->Default configuration file will be use' configfilepath = os.path.join(os.getcwd(), 'config.json') else: raise Exception('ERROR: Unexpected number or argument passed') config_func = configreader.config() config = config_func.giveconfig(configfilepath) if not os.path.exists(config.projectpath): os.mkdir(config.projectpath) if 'dev' not in config.processlist: config_func.saveconfig() print '-->Creating logging file' log_func = logger.logger() log = log_func.givelogger(config.logfile) log.info('\n') log.info(' START '.center(48,'=')) log.info('Arah logger has been successfully started') log.info('Reading source file and creating a data frame') log.debug('Source path: %s' % config.sourecepath) primerawsource_df = pnd.read_csv(config.sourecepath) log.info('Raw source data frame created') if config.secondsource: log.info('Reading second source file and creating its data frame') log.debug('Secondary source path: %s' % config.secondsourcepath) secondrawsource_df = pnd.read_csv(config.secondsourcepath)