本文整理匯總了Python中MOSES.getTargetFor方法的典型用法代碼示例。如果您正苦於以下問題:Python MOSES.getTargetFor方法的具體用法?Python MOSES.getTargetFor怎麽用?Python MOSES.getTargetFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MOSES
的用法示例。
在下文中一共展示了MOSES.getTargetFor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getTargetFor [as 別名]
def run(self):
self.mutex.unlock()
current_data = []
self.past_data = []
while True:
try:
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
except:
try:
time.sleep(self.sleeper)
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
except:
try:
time.sleep(self.sleeper)
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
except:
try:
time.sleep(self.sleeper)
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
except:
try:
time.sleep(self.sleeper)
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
except:
raise
cleaned_data = list(itertools.chain(*data))
if cleaned_data != self.past_data:
#print "Getting data for %s" %self.start_date
#print "Emitting information!"
#print "Sending %d articles." %len(cleaned_data)
targets_data = []
for entry in cleaned_data:
piggy_row = {
"Description Type": entry["Description Type"],
"Source": entry["Source"],
"BU": entry["BU"],
"Super-Category": entry["Super-Category"],
"Category": entry["Category"],
"Sub-Category": entry["Sub-Category"],
"Vertical": entry["Vertical"]
}
article_date = entry["Article Date"]
target = MOSES.getTargetFor(self.user_id, self.password, piggy_row, article_date, category_tree=self.category_tree)
targets_data.append(target)
self.piggybankChanged.emit(cleaned_data, targets_data)
self.past_data = cleaned_data
self.sleeper = 10
self.mutex.lock()
示例2: getEfficiency
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getTargetFor [as 別名]
def getEfficiency(self):
"""Calculator Row"""
row = {
"Description Type": str(self.calcWidgets["Description Type"].currentText()),
"Source": str(self.calcWidgets["Source"].currentText()),
"BU": str(self.calcWidgets["BU"].currentText()),
"Super-Category": str(self.calcWidgets["Super-Category"].currentText()),
"Category": str(self.calcWidgets["Category"].currentText()),
"Sub-Category": str(self.calcWidgets["Sub-Category"].currentText()),
"Vertical": str(self.calcWidgets["Vertical"].currentText())
}
target = float(MOSES.getTargetFor(self.userID, self.password, row, self.target_date, self.category_tree))
self.target = target
self.calcWidgets["Target"].setText("%s"%target)
quantity = float(self.calcWidgets["Quantity"].value())
self.efficiency = (quantity*100.00/target) if target > 0 else None
return self.efficiency
示例3: getPiggyBank
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getTargetFor [as 別名]
def getPiggyBank(self):
#self.sleeper = sleeper
data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
cleaned_data = list(itertools.chain(*data))
targets_data = []
for entry in cleaned_data:
piggy_row = {
"Description Type": entry["Description Type"],
"Source": entry["Source"],
"BU": entry["BU"],
"Super-Category": entry["Super-Category"],
"Category": entry["Category"],
"Sub-Category": entry["Sub-Category"],
"Vertical": entry["Vertical"]
}
target = MOSES.getTargetFor(self.user_id, self.password, piggy_row, entry["Article Date"], category_tree=self.category_tree)
targets_data.append(target)
self.piggybankChanged.emit(cleaned_data, targets_data)