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


Python TimeAgent.dt2tlst方法代码示例

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


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

示例1: jsondict

# 需要导入模块: from nell.utilities import TimeAgent [as 别名]
# 或者: from nell.utilities.TimeAgent import dt2tlst [as 别名]
 def jsondict(self, tz):
     start = self.period.start if tz == 'UTC' else TimeAgent.utc2est(self.period.start)
     end   = self.period.end() if tz == 'UTC' else TimeAgent.utc2est(self.period.end())
     w = self.period.window
     # stakeholder want's 'T' or '' for this
     sponsored = self.period.session.project.is_sponsored()
     sponsored = '' if not sponsored else 'T'
     js =   {"id"           : self.period.id
           , "session"      : SessionHttpAdapter(self.period.session).jsondict()
           , "session_name" : self.period.session.name
           , "handle"       : self.period.toHandle()
           , "stype"        : self.period.session.session_type.type[0].swapcase()
           , "end_date"     : d2str(end)
           , "end_time"     : t2str(end)
           , "date"         : d2str(start)
           , "time"         : t2str(start)
           , "lst"          : str(TimeAgent.dt2tlst(self.period.start))
           , "duration"     : self.period.duration
           , "sscore"       : self.period.score       # scheduling score
           , "cscore"       : -1.0                    # current score
           , "forecast"     : dt2str(self.period.forecast)
           , "backup"       : self.period.backup
           , "moc_ack"      : self.period.moc_ack if self.period.moc_ack is not None else False
           , "state"        : self.period.state.abbreviation if self.period.state is not None else ""
           , "windowed"     : True if w is not None else False
           , "wdefault"     : self.period.is_windowed_default() \
                                  if w is not None else None
           , "wstart"       : d2str(w.start_date()) if w is not None else None
           , "wend"         : d2str(w.last_date()) if w is not None else None
           , "sponsored"    : sponsored
           , "sponsor"      : self.period.session.project.sponsor_text()
           , "receivers"    : self.period.get_rcvrs_json()
             }
     # include the accounting but keep the dict flat
     if self.period.accounting is not None:
         accounting_js = self.period.accounting.jsondict()
         # make sure the final jsondict has only one 'id'
         accounting_id = accounting_js.pop('id')
         accounting_js.update({'accounting_id' : accounting_id})
         js.update(accounting_js)
     return js
开发者ID:,项目名称:,代码行数:43,代码来源:


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