本文整理汇总了Python中net.sf.chellow.monad.Monad.getUtils方法的典型用法代码示例。如果您正苦于以下问题:Python Monad.getUtils方法的具体用法?Python Monad.getUtils怎么用?Python Monad.getUtils使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.chellow.monad.Monad
的用法示例。
在下文中一共展示了Monad.getUtils方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_start_up
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
def on_start_up(ctx):
if sys.platform.startswith('java'):
jython_start(ctx)
else:
cpython_start()
Monad.getUtils()['impt'](globals(), *LIBS)
for lib_name in LIBS:
try:
globals()[lib_name].startup()
except AttributeError:
pass
示例2: globals
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import db
import templater
import utils
import system_price
Monad.getUtils()["impt"](globals(), "db", "utils", "templater", "system_price")
Contract = db.Contract
render = templater.render
UserException = utils.UserException
inv, template = globals()["inv"], globals()["template"]
sess = None
importer = None
try:
sess = db.session()
if inv.getRequest().getMethod() == "GET":
importer = system_price.get_importer()
contract = Contract.get_non_core_by_name(sess, "system_price")
render(inv, template, {"importer": importer, "contract": contract})
else:
importer = system_price.get_importer()
contract = Contract.get_non_core_by_name(sess, "system_price")
importer.go()
inv.sendSeeOther("/reports/381/output/")
except UserException, e:
sess.rollback()
render(inv, template, {"messages": [str(e)], "importer": importer, "contract": contract})
finally:
if sess is not None:
sess.close()
示例3: content
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import datetime
import pytz
from dateutil.relativedelta import relativedelta
from sqlalchemy import or_, and_
import traceback
import utils
import db
Monad.getUtils()["impt"](globals(), "utils", "db")
HH, hh_format = utils.HH, utils.hh_format
RegisterRead, Bill, Supply, Era = db.RegisterRead, db.Bill, db.Supply, db.Era
inv = globals()["inv"]
year = inv.getInteger("end_year")
month = inv.getInteger("end_month")
months = inv.getInteger("months")
if inv.hasParameter("supply_id"):
supply_id = inv.getLong("supply_id")
else:
supply_id = None
def content():
sess = None
try:
sess = db.session()
finish_date = datetime.datetime(year, month, 1, tzinfo=pytz.utc) + relativedelta(months=1) - HH
示例4: globals
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import db
import templater
import utils
import bank_holidays
Monad.getUtils()['impt'](
globals(), 'db', 'utils', 'templater', 'bank_holidays')
Contract = db.Contract
render = templater.render
UserException = utils.UserException
inv, template = globals()['inv'], globals()['template']
sess = None
importer = None
try:
sess = db.session()
if inv.getRequest().getMethod() == "GET":
importer = bank_holidays.get_importer()
contract = Contract.get_non_core_by_name(sess, 'bank_holidays')
render(inv, template, {'importer': importer, 'contract': contract})
else:
importer = bank_holidays.get_importer()
contract = Contract.get_non_core_by_name(sess, 'bank_holidays')
importer.go()
inv.sendSeeOther("/reports/221/output/")
except UserException, e:
sess.rollback()
render(
inv, template, {
'messages': [str(e)], 'importer': importer, 'contract': contract})
finally:
示例5: hh
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import scenario
Monad.getUtils()["impt"](globals(), "scenario")
db_id = globals()["db_id"]
create_future_func = scenario.make_create_future_func_simple("aahedc", ["aahedc_gbp_per_gsp_kwh"])
def hh(supply_source):
bill = supply_source.supplier_bill
rate_set = supply_source.supplier_rate_sets["aahedc-rate"]
try:
supply_source.caches["aahedc"]
except KeyError:
supply_source.caches["aahedc"] = {}
try:
future_funcs = supply_source.caches["future_funcs"]
except KeyError:
future_funcs = {}
supply_source.caches["future_funcs"] = future_funcs
try:
future_funcs[db_id]
except KeyError:
future_funcs[db_id] = {"start_date": None, "func": create_future_func(1, 0)}
for hh in supply_source.hh_data:
bill["aahedc-msp-kwh"] += hh["msp-kwh"]
示例6: set_colour
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
import sys
from net.sf.chellow.monad import Monad
import utils
import db
Monad.getUtils()['impt'](globals(), 'utils', 'db')
inv, template = globals()['inv'], globals()['template']
hh_format = utils.hh_format
if sys.platform.startswith('java'):
from java.awt.image import BufferedImage
from javax.imageio import ImageIO
from java.awt import Color, Font
from java.lang import System
import math
import datetime
import pytz
from dateutil.relativedelta import relativedelta
HH = utils.HH
Site = db.Site
colour_list = [
Color.BLUE, Color.GREEN, Color.RED, Color.YELLOW, Color.MAGENTA,
Color.CYAN, Color.PINK, Color.ORANGE]
def set_colour(graphics, supplies, id):
graphics.setColor(supplies[id][0])
def add_colour(supplies, id, name, source_code):
if id not in supplies:
supplies[id] = [len(supplies), name, source_code]
示例7: on_shut_down
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import time
import traceback
import utils
import db
import hh_importer
import bsuos
import system_price
import bank_holidays
import rcrc
import tlms
import dloads
Monad.getUtils()['impt'](
globals(), 'utils', 'hh_importer', 'bsuos', 'rcrc', 'tlms', 'db',
'system_price', 'bank_holidays', 'dloads')
UserException = utils.UserException
def on_shut_down(ctx):
messages = []
sess = None
try:
sess = db.session()
for md in (
hh_importer, bsuos, system_price, rcrc, tlms, bank_holidays,
dloads):
try:
md.shutdown()
except UserException, e:
time.sleep(2)
示例8: hh
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import scenario
Monad.getUtils()['impt'](globals(), 'scenario')
db_id = globals()['db_id']
create_future_func = scenario.make_create_future_func_simple(
'ro', ['gbp_per_msp_kwh'])
def hh(supply_source):
bill = supply_source.supplier_bill
rate_set = supply_source.supplier_rate_sets['ro-rate']
try:
supply_source.caches['ro']
except KeyError:
supply_source.caches['ro'] = {}
try:
future_funcs = supply_source.caches['future_funcs']
except KeyError:
future_funcs = {}
supply_source.caches['future_funcs'] = future_funcs
try:
future_funcs[db_id]
except KeyError:
future_funcs[db_id] = {
'start_date': None, 'func': create_future_func(1, 0)}
for hh in supply_source.hh_data:
示例9: triad_calc
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
from dateutil.relativedelta import relativedelta
from sqlalchemy.sql.expression import null
from sqlalchemy import or_
import utils
import db
import triad_rates
import computer
import duos
Monad.getUtils()['impt'](
globals(), 'db', 'utils', 'templater', 'computer', 'duos', 'triad_rates')
HH, hh_after = utils.HH, utils.hh_after
Contract, RateScript = db.Contract, db.RateScript
db_id = globals()['db_id']
def triad_calc(
bill, prefix, triad_data, financial_year_start, financial_year_finish,
data_source, month_begin):
gsp_kw = 0
for i, triad_hh in enumerate(triad_data):
triad_prefix = prefix + '-' + str(i + 1)
bill[triad_prefix + '-date'] = triad_hh['hist-start']
bill[triad_prefix + '-msp-kw'] = triad_hh['msp-kw']
bill[triad_prefix + '-status'] = triad_hh['status']
bill[triad_prefix + '-laf'] = triad_hh['laf']
bill[triad_prefix + '-gsp-kw'] = triad_hh['gsp-kw']
gsp_kw += triad_hh['gsp-kw']
bill[prefix + '-gsp-kw'] = gsp_kw / 3
示例10: content
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import datetime
import pytz
from sqlalchemy import or_
from sqlalchemy.sql.expression import null
from dateutil.relativedelta import relativedelta
import traceback
import utils
import db
import computer
Monad.getUtils()['impt'](globals(), 'computer', 'db', 'utils')
inv, template = globals()['inv'], globals()['template']
hh_before, HH, hh_format = utils.hh_before, utils.HH, utils.hh_format
form_int = utils.form_int
Contract, Era = db.Contract, db.Era
caches = {}
end_year = form_int(inv, "end_year")
end_month = form_int(inv, "end_month")
months = form_int(inv, "months")
contract_id = form_int(inv, 'hhdc_contract_id')
def content():
sess = None
try:
sess = db.session()
contract = Contract.get_hhdc_by_id(sess, contract_id)
示例11: make_fields
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import StringIO
import sys
import os
import db
import utils
import templater
import hh_importer
Monad.getUtils()['impt'](
globals(), 'db', 'utils', 'templater', 'general_import', 'hh_importer')
Contract = db.Contract
UserException = utils.UserException
render = templater.render
inv, template = globals()['inv'], globals()['template']
def make_fields(sess, contract, message=None):
messages = None if message is None else [str(message)]
return {
'contract': contract,
'processes': hh_importer.get_hh_import_processes(contract.id),
'messages': messages}
sess = None
contract = None
try:
sess = db.session()
hh_importer_contract = Contract.get_non_core_by_name(sess, 'hh_importer')
if inv.getRequest().getMethod() == 'GET':
hhdc_contract_id = inv.getLong('hhdc_contract_id')
示例12: __init__
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from decimal import Decimal
from net.sf.chellow.monad import Monad
import utils
import edi_lib
Monad.getUtils()["impt"](globals(), "db", "utils", "templater", "bill_import", "edi_lib")
hh_after = utils.hh_after
read_type_map = {"00": "N", "01": "E", "02": "E", "04": "C", "06": "X", "07": "N"}
class Parser:
def __init__(self, f):
self.parser = edi_lib.EdiParser(f)
self.line_number = None
def make_raw_bills(self):
raw_bills = []
for self.line_number, code in enumerate(self.parser):
if code == "CLO":
cloc = self.parser.elements[0]
account = cloc[1]
elif code == "BCD":
ivdt = self.parser.elements[0]
invn = self.parser.elements[2]
btcd = self.parser.elements[5]
reference = invn[0]
bill_type_code = btcd[0]
issue_date = self.parser.to_date(ivdt[0])
elif code == "MHD":
示例13: ccl
# 需要导入模块: from net.sf.chellow.monad import Monad [as 别名]
# 或者: from net.sf.chellow.monad.Monad import getUtils [as 别名]
from net.sf.chellow.monad import Monad
import datetime
import pytz
import utils
import db
import computer
import scenario
Monad.getUtils()["impt"](globals(), "db", "utils", "computer", "scenario")
HH = utils.HH
Contract = db.Contract
db_id = globals()["db_id"]
create_future_func = scenario.make_create_future_func_simple("ccl", ["ccl_rate"])
def ccl(data_source):
rate_set = data_source.supplier_rate_sets["ccl-rate"]
if data_source.supply.find_era_at(data_source.sess, data_source.finish_date + HH) is None:
sup_end = data_source.finish_date
else:
sup_end = None
try:
cache = data_source.caches["ccl"]
except:
data_source.caches["ccl"] = {}
cache = data_source.caches["ccl"]
try: