本文整理汇总了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)