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


Python DataLogger.datewalker方法代码示例

本文整理汇总了Python中datalogger.DataLogger.datewalker方法的典型用法代码示例。如果您正苦于以下问题:Python DataLogger.datewalker方法的具体用法?Python DataLogger.datewalker怎么用?Python DataLogger.datewalker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datalogger.DataLogger的用法示例。


在下文中一共展示了DataLogger.datewalker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_datewalk

# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import datewalker [as 别名]
    def get_datewalk(args):
        """
        get list of datestrings between two datestrings

        ex: Datalogger/get_datewalk/{datestring1}/{datestring2}

        returns:
        json(list of datestrings)
        """
        datestring1, datestring2 = args[:2]
        data = tuple(DataLogger.datewalker(datestring1, datestring2))
        return json.dumps(data)
开发者ID:gunny26,项目名称:datalogger,代码行数:14,代码来源:code.py

示例2: test_statics

# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import datewalker [as 别名]
 def test_statics(self):
     self.assertTrue(isinstance(DataLogger.get_user(self.basedir), basestring))
     self.assertTrue(isinstance(DataLogger.get_group(self.basedir), basestring))
     self.assertTrue(isinstance(DataLogger.get_yesterday_datestring(), basestring))
     lbd = DataLogger.get_last_business_day_datestring()
     self.assertTrue(isinstance(DataLogger.get_last_business_day_datestring(), basestring))
     self.assertTrue(isinstance(DataLogger.datestring_to_date(lbd), datetime.date))
     for datestring in DataLogger.datewalker("2016-01-01", "2016-02-29"):
         self.assertTrue(isinstance(datestring, basestring))
     for datestring in DataLogger.monthwalker("2016-02"):
         self.assertTrue(isinstance(datestring, basestring))
     self.assertEqual(list(DataLogger.monthwalker("2016-02"))[-1], "2016-02-29")
     self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01"), tuple))
     self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01")[0], float))
     self.assertTrue(isinstance(DataLogger.get_ts_for_datestring("2016-01-01")[1], float))
开发者ID:gunny26,项目名称:datalogger,代码行数:17,代码来源:test_DataLogger.py

示例3: main

# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import datewalker [as 别名]
def main():
    for datestring in tuple(DataLogger.datewalker(startdate, args.enddate)):
        start_ts, stop_ts = DataLogger.get_ts_for_datestring(datestring)
        logging.debug("working on datestring %s (from %s to %s)", datestring, start_ts, stop_ts)
        for project in DataLogger.get_projects(args.basedir):
            if args.project is not None:
                if project != args.project:
                    logging.debug("skipping project %s", project)
                    continue
            logging.debug("working on project %s", project)
            for tablename in DataLogger.get_tablenames(args.basedir, project):
                if args.tablename is not None:
                    if tablename != args.tablename:
                        logging.debug("skipping tablename %s", tablename)
                        continue
                    logging.debug("working on tablename %s", tablename)
                archive(project, tablename, datestring)
开发者ID:gunny26,项目名称:datalogger,代码行数:19,代码来源:archiver.py

示例4: get_lt_ts

# 需要导入模块: from datalogger import DataLogger [as 别名]
# 或者: from datalogger.DataLogger import datewalker [as 别名]
 def get_lt_ts(self, project, tablename, args):
     """
     get longtime statistical values
     """
     # datestringStart + "/" + datestringStop + "/" + Base64.encode(indexKey) + "/" + valueKeyname + "/" + statFuncName
     start, stop, index_key_enc, value_keyname, stat_func_name = args
     index_key = tuple([unicode(key_value) for key_value in eval(base64.b64decode(index_key_enc))])
     datalogger = DataLogger(basedir, project, tablename)
     filterkeys = dict(zip(datalogger.index_keynames, index_key))
     ret_data = []
     for datestring in datalogger.datewalker(start, stop):
         try:
             tsastats = datalogger.load_tsastats(datestring, filterkeys=filterkeys)
             ret_data.append([datestring, tsastats[index_key][value_keyname][stat_func_name]])
         except DataLoggerRawFileMissing as exc:
             logging.error("No Input File for datestring %s found, skipping this date", datestring)
         except DataLoggerLiveDataError as exc:
             logging.error("Reading from live data is not allowed, skipping this data, and ending loop")
             break
     return json.dumps(ret_data)
开发者ID:gunny26,项目名称:datalogger,代码行数:22,代码来源:code2.py


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