本文整理汇总了Python中mo_logs.Log.unexpected方法的典型用法代码示例。如果您正苦于以下问题:Python Log.unexpected方法的具体用法?Python Log.unexpected怎么用?Python Log.unexpected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mo_logs.Log
的用法示例。
在下文中一共展示了Log.unexpected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter
# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import unexpected [as 别名]
def filter(self, where):
if len(self.edges)==1 and self.edges[0].domain.type=="index":
# USE THE STANDARD LIST FILTER
from jx_python import jx
return jx.filter(self.data.values()[0].cube, where)
else:
# FILTER DOES NOT ALTER DIMESIONS, JUST WHETHER THERE ARE VALUES IN THE CELLS
Log.unexpected("Incomplete")
示例2: simplify_esfilter
# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import unexpected [as 别名]
def simplify_esfilter(esfilter):
try:
output = wrap(_normalize(wrap(esfilter)))
output.isNormal = None
return output
except Exception as e:
from mo_logs import Log
Log.unexpected("programmer error", cause=e)
示例3: compileEdges2Term
# 需要导入模块: from mo_logs import Log [as 别名]
# 或者: from mo_logs.Log import unexpected [as 别名]
def compileEdges2Term(mvel_compiler, edges, constants):
"""
TERMS ARE ALWAYS ESCAPED SO THEY CAN BE COMPOUNDED WITH PIPE (|)
GIVE MVEL CODE THAT REDUCES A UNIQUE TUPLE OF PARTITIONS DOWN TO A UNIQUE TERM
GIVE LAMBDA THAT WILL CONVERT THE TERM BACK INTO THE TUPLE
RETURNS TUPLE OBJECT WITH "type" and "value" ATTRIBUTES.
"type" CAN HAVE A VALUE OF "script", "field" OR "count"
CAN USE THE constants (name, value pairs)
"""
# IF THE QUERY IS SIMPLE ENOUGH, THEN DO NOT USE TERM PACKING
edge0 = edges[0]
if len(edges) == 1 and edge0.domain.type in ["set", "default"]:
# THE TERM RETURNED WILL BE A MEMBER OF THE GIVEN SET
def temp(term):
return FlatList([edge0.domain.getPartByKey(term)])
if edge0.value and is_variable_name(edge0.value):
return Data(
field=edge0.value,
term2parts=temp
)
elif COUNT(edge0.domain.dimension.fields) == 1:
return Data(
field=edge0.domain.dimension.fields[0],
term2parts=temp
)
elif not edge0.value and edge0.domain.partitions:
script = mvel_compiler.Parts2TermScript(edge0.domain)
return Data(
expression=script,
term2parts=temp
)
else:
return Data(
expression=mvel_compiler.compile_expression(edge0.value, constants),
term2parts=temp
)
mvel_terms = [] # FUNCTION TO PACK TERMS
fromTerm2Part = [] # UNPACK TERMS BACK TO PARTS
for e in edges:
domain = e.domain
fields = domain.dimension.fields
if not e.value and fields:
code, decode = mvel_compiler.Parts2Term(e.domain)
t = Data(
toTerm=code,
fromTerm=decode
)
elif fields:
Log.error("not expected")
elif e.domain.type == "time":
t = compileTime2Term(e)
elif e.domain.type == "duration":
t = compileDuration2Term(e)
elif e.domain.type in domains.ALGEBRAIC:
t = compileNumeric2Term(e)
elif e.domain.type == "set" and not fields:
def fromTerm(term):
return e.domain.getPartByKey(term)
code, decode = mvel_compiler.Parts2Term(e.domain)
t = Data(
toTerm=code,
fromTerm=decode
)
else:
t = compileString2Term(e)
if not t.toTerm.body:
mvel_compiler.Parts2Term(e.domain)
Log.unexpected("what?")
fromTerm2Part.append(t.fromTerm)
mvel_terms.append(t.toTerm.body)
# REGISTER THE DECODE FUNCTION
def temp(term):
terms = term.split('|')
output = FlatList([t2p(t) for t, t2p in zip(terms, fromTerm2Part)])
return output
return Data(
expression=mvel_compiler.compile_expression("+'|'+".join(mvel_terms), constants),
term2parts=temp
)