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


Python Entry.date方法代码示例

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


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

示例1: load_claims

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import date [as 别名]
def load_claims(claims):
    example = UwExample()
    example.proj_start_date = date(claims.date.max().year + 1, 1, 1)
    example.proj_end_date = date(example.proj_start_date.year, 12, 31)
    example.unique_iden = generate_file_name()
    example.example_name = example.unique_iden
    example.proj_annual_enroll = int(claims.sort_index(by=['date'], ascending=[False])[:1].ee_count.min())
    example.med_trend = MED_TREND
    example.rx_trend = RX_TREND
    example.med_margin_perc = 1
    example.rx_margin_perc = 1
    example.lag_med = 2
    example.lag_rx = 1
    db.session.add(example)
    db.session.commit()
    
    for index, row in claims.iterrows():
        entry = Entry()
        entry.date = row.date
        entry.ee_count = int(row.ee_count)
        entry.med_cost = float(row.med_cost)
        entry.rx_cost = float(row.rx_cost)
        entry.sl_reim = float(row.sl_reim)
        entry.uw_example_id = example.id
        db.session.add(entry)
    db.session.commit()
    return example.unique_iden
开发者ID:dikee,项目名称:ercot,代码行数:29,代码来源:l_helpers.py

示例2: handle_entry

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import date [as 别名]
  def handle_entry(self, message):

    entry = Entry(author='Julian')
    raw, entry.content = self.get_content(message)

    if entry.content is None:
      logging.error("Failed to find message body")
      logging.error(message)
      return

    matches = re.search("diaryentry(\d+)", raw)
    if matches is None:
      logging.error("received mail that wasn't a diary entry")
      logging.error(raw)
      return

    entry.date = datetime.date.fromtimestamp(int(matches.group(1)))
    entry.put()

    num_attachments = 0

    # fall back to raw mail message for attachment parsing
    for part in message.original.walk():
      content_type = part.get_content_type()
      if content_type not in ["text/plain", "text/html", "multipart/mixed",
                              "multipart/alternative"]:
        attachment = Attachment(name=part.get_param("name"),
                                content_type=content_type)

        # store attachment in blobstore
        bucket = '/infinite-diary.appspot.com'
        filename = os.path.join(bucket, 'attachments',
                                time.strftime('%Y-%m-%d_%H-%M'),
                                str(num_attachments))

        with gcs.open(filename, 'w') as f:
          f.write(base64.b64decode(part.get_payload()))

        attachment.content = blobstore.create_gs_key('/gs' + filename)
        attachment.entry = entry.key()
        attachment.thumbnail = images.get_serving_url(attachment.content,
                                                      size=400)

        attachment.put()
        num_attachments += 1
开发者ID:Mononofu,项目名称:infinite-diary,代码行数:47,代码来源:mail.py


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