当前位置: 首页>>代码示例>>Python>>正文


Python MOSES.getTargetFor方法代码示例

本文整理汇总了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()
开发者ID:vinay87,项目名称:oink,代码行数:51,代码来源:PiggyBanker.py

示例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
开发者ID:vinay87,项目名称:oink,代码行数:21,代码来源:EfficiencyCalculator.py

示例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)
     
             
开发者ID:vinay87,项目名称:oink,代码行数:21,代码来源:PiggyBanker.py


注:本文中的MOSES.getTargetFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。