Commit 965d0c74 by lichenggang

update pep8

parents 8911f4dc 34df6cbc
Showing with 6 additions and 3 deletions
...@@ -52,6 +52,8 @@ class MongoOperator: ...@@ -52,6 +52,8 @@ class MongoOperator:
ts = int(time.time()) - 3600 * 72 # 72h ts = int(time.time()) - 3600 * 72 # 72h
elif plat in ('microchip', 'heilind', 'element14', 'chip1stop', 'future'): elif plat in ('microchip', 'heilind', 'element14', 'chip1stop', 'future'):
ts = int(time.time()) - 3600 * 24 # 24h ts = int(time.time()) - 3600 * 24 # 24h
elif plat in ("richardsonrfpd",):
ts = int(time.time()) - 3600 * 96 # 96h
else: else:
ts = int(time.time()) - 3600 * 48 # 48 ts = int(time.time()) - 3600 * 48 # 48
return ts return ts
...@@ -122,16 +124,15 @@ class MongoOperator: ...@@ -122,16 +124,15 @@ class MongoOperator:
old_tiered_rate = glo.get_value(plat)["tiered"] if glo.get_value(plat) else 0 old_tiered_rate = glo.get_value(plat)["tiered"] if glo.get_value(plat) else 0
if stock_rate >= 10 or tiered_rate >= 10: if stock_rate >= 10 or tiered_rate >= 10:
msg_line = "" msg_line = ""
if old_stock_rate == 0: if old_stock_rate == 0 or old_tiered_rate == 0:
print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total
, "空库存率", stock_rate, "空价格率", tiered_rate, ) , "空库存率", stock_rate, "空价格率", tiered_rate, )
msg_line = demo1.format(plat, stock_rate, tiered_rate) msg_line = demo1.format(plat, stock_rate, tiered_rate)
else: else:
stock__ontrast_ratio = stock_rate - old_stock_rate stock__ontrast_ratio = stock_rate - old_stock_rate
tiered__ontrast_ratio = tiered_rate - old_tiered_rate tiered__ontrast_ratio = tiered_rate - old_tiered_rate
if not -10 < stock__ontrast_ratio < 10 or not -10 < tiered__ontrast_ratio < 10: if not -3 < stock__ontrast_ratio < 3 or not -3 < tiered__ontrast_ratio < 3:
msg_line = demo2.format(plat, stock__ontrast_ratio, tiered__ontrast_ratio) msg_line = demo2.format(plat, stock__ontrast_ratio, tiered__ontrast_ratio)
print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total, "空库存率", print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total, "空库存率",
stock_rate, "空价格率", tiered_rate, "空库存变化率", stock__ontrast_ratio, stock_rate, "空价格率", tiered_rate, "空库存变化率", stock__ontrast_ratio,
"空价格变化率", tiered__ontrast_ratio, ) "空价格变化率", tiered__ontrast_ratio, )
...@@ -143,3 +144,5 @@ class MongoOperator: ...@@ -143,3 +144,5 @@ class MongoOperator:
print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total) print(plat, "空库存数量", stock_num, "空价格数量", stock_num, "总量", total)
if msgs: if msgs:
return msg return msg
else:
return
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment