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