本文整理汇总了Python中mio.runtime.find函数的典型用法代码示例。如果您正苦于以下问题:Python find函数的具体用法?Python find怎么用?Python find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: evalArg
def evalArg(self, receiver, context, m, *args):
if len(args) > 1:
return runtime.find("Tuple").clone(tuple(arg.eval(context) for arg in args))
elif len(args) == 1:
return args[0].eval(context)
else:
return runtime.find("None")
开发者ID:prologic,项目名称:mio,代码行数:7,代码来源:object.py
示例2: __init__
def __init__(self, value=u""):
super(String, self).__init__(value=value)
self.create_methods()
try:
self.parent = runtime.find("String")
except AttributeError:
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:string.py
示例3: update_status
def update_status(self):
mode = self.value.mode
closed = self.value.closed
filename = self.value.name
self["mode"] = runtime.find("String").clone(mode)
self["filename"] = runtime.find("String").clone(filename)
if closed:
self["closed"] = runtime.find("True")
else:
self["closed"] = runtime.find("False")
开发者ID:prologic,项目名称:mio,代码行数:12,代码来源:file.py
示例4: __init__
def __init__(self):
super(System, self).__init__()
self["args"] = self.build_args()
self["version"] = runtime.find("String").clone((mio.__version__))
self["stdin"] = File(sys.stdin)
self["stdout"] = File(sys.stdout)
self["stderr"] = File(sys.stderr)
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:12,代码来源:system.py
示例5: __init__
def __init__(self):
super(Traits, self).__init__()
self.create_objects()
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:7,代码来源:__init__.py
示例6: _del
def _del(self, receiver, context, m, key):
key = unicode(key.eval(context))
value = receiver[key]
del receiver[key]
if isinstance(value, Object):
value.bindig = None
return runtime.find("None")
开发者ID:prologic,项目名称:mio,代码行数:7,代码来源:object.py
示例7: find
def find(self, receiver, context, m, sub, start=None, end=None):
sub = bytes(sub.eval(context))
start = int(start.eval(context)) if start is not None else None
end = int(end.eval(context)) if end is not None else None
return runtime.find("Number").clone(
receiver.value.find(sub, start, end)
)
开发者ID:prologic,项目名称:mio,代码行数:7,代码来源:bytes.py
示例8: __init__
def __init__(self):
super(Importer, self).__init__()
self["paths"] = self.build_paths()
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:7,代码来源:importer.py
示例9: __init__
def __init__(self):
super(Module, self).__init__()
self.file = None
self.name = None
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:module.py
示例10: __init__
def __init__(self):
super(Continuation, self).__init__()
self.context = None
self.message = None
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:continuation.py
示例11: __init__
def __init__(self):
super(Trait, self).__init__()
self.requirements = []
self.create_methods()
self.parent = runtime.find(
"Trait" if self.__class__ is not Trait else "Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:trait.py
示例12: __init__
def __init__(self, path=None, expanduser=False):
super(Path, self).__init__()
path = posix.getcwdu() if path is None else path
self.value = posixpath.expanduser(path) if expanduser else path
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:path.py
示例13: __init__
def __init__(self):
super(Error, self).__init__()
self["type"] = None
self["message"] = None
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:8,代码来源:error.py
示例14: __init__
def __init__(self):
super(Range, self).__init__()
self.start = None
self.stop = None
self.step = None
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:9,代码来源:range.py
示例15: __init__
def __init__(self):
super(State, self).__init__()
self.isContinue = False
self.isReturn = False
self.isBreak = False
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:9,代码来源:state.py
示例16: test_setParent
def test_setParent(mio):
assert mio.eval("World = Object clone()")
assert mio.eval("World parent") == runtime.find("Object")
with raises(TypeError):
mio.eval("World setParent(World)", reraise=True)
assert mio.eval("Foo = Object clone()")
assert mio.eval("World setParent(Foo)")
assert mio.eval("World parent") == mio.eval("Foo")
开发者ID:prologic,项目名称:mio,代码行数:10,代码来源:test_objects.py
示例17: make_chain
def make_chain(messages, all=True):
root = node = None
while messages:
if len(messages) > 1 and is_assignment(messages[1]):
name = messages.pop(0).name
object = runtime.find("String").clone(name)
key = Message(name, object)
op = messages.pop(0)
if op.name == "=" and op.next is not None and op.next.name in ("()", "[]", "{}",):
value = Message(
"()", args=[Message(op.next.name, args=op.next.args)])
elif op.args:
value = Message("()", args=op.args)
else:
value = make_chain(messages, all=False)
message = Message("set", args=[key, value])
elif is_operator(messages[0]):
message = messages.pop(0)
if messages and not message.args:
if operators.get(message.name) == 1:
arg = messages.pop(0)
# Set the argument (a Message) previous attribute to the
# current message
arg.previous = message
message.args.append(arg)
message.call = True
else:
chain = make_chain(messages, all=False)
if chain is not None:
# Set the argument (a Message) previous attribute to
# the current message
chain.previous = message
message.args.append(chain)
message.call = True
elif message.next is not None:
chain = message.next
message.next = None
chain.previous = message
message.args.append(chain)
message.call = True
elif messages[0].terminator and not all:
break
else:
message = messages.pop(0)
if root is None:
root = node = message
else:
node.next = node = message
return root
开发者ID:prologic,项目名称:mio,代码行数:55,代码来源:parser.py
示例18: __call__
def __call__(self, receiver, context=None, m=None, *args):
self.create_locals(receiver, context, m)
self.locals.attrs.update(self.kwargs)
# Set positional arguments *args
if len(self.args) == 1 and self.args[0].name == "*":
# XXX: Can we make this just a list of args? Or always a list of
# messages?
self.locals[self.args[0].args[0].name] = runtime.find("List").clone(
[
arg.eval(context) if isinstance(arg, Message) else arg
for arg in args
if not isinstance(arg, Message) or (isinstance(arg, Message) and arg.name != "set" and not arg.args)
]
)
else:
# Set positional arguments
for i, arg in enumerate(self.args):
if i < len(args):
self.locals[arg.name] = args[i].eval(context) if isinstance(args[i], Message) else args[i]
else:
self.locals[arg.name] = runtime.find("None")
# Set keyword argumetns **kwargs
if "**" in [arg.name for arg in self.args]:
i = [arg.name for arg in self.args].index("**")
d = {}
for arg in [arg for arg in args if arg.name == "set"]:
d[arg.args[0].name] = arg.eval(context)
self.locals[self.args[i].args[0].name] = runtime.find("Dict").clone(d)
else:
# Set default keyword argumetns
for k, v in self.kwargs.items():
self.locals[k] = v
# Set keyword arguments
for arg in [arg for arg in args if isinstance(arg, Message) and arg.name == "set"]:
self.locals[arg.args[0].name] = arg.eval(context)
return self.body.eval(self.locals, self.locals)
开发者ID:prologic,项目名称:mio,代码行数:41,代码来源:block.py
示例19: _method
def _method(self, receiver, context, m, *args):
args, body = args[:-1], args[-1:][0]
# Evaluate kwargs first
ctx = runtime.find("Object").clone()
kwargs = OrderedDict([(arg.args[0].name, arg.eval(ctx)) for arg in args if arg.name == "set"])
args = [arg for arg in args if not arg.name == "set"]
from mio.core.block import Block
return Block(body, args, kwargs)
开发者ID:prologic,项目名称:mio,代码行数:12,代码来源:object.py
示例20: __init__
def __init__(self, body=None, args=None, kwargs=None, scope=None):
super(Block, self).__init__()
self.body = body if body is not None else self
self.args = args if args is not None else ()
self.kwargs = kwargs if kwargs is not None else {}
self.scope = scope
self.locals = None
self.create_methods()
self.parent = runtime.find("Object")
开发者ID:prologic,项目名称:mio,代码行数:13,代码来源:block.py
注:本文中的mio.runtime.find函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论