本文整理汇总了Python中sandbox.Sandbox.new方法的典型用法代码示例。如果您正苦于以下问题:Python Sandbox.new方法的具体用法?Python Sandbox.new怎么用?Python Sandbox.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sandbox.Sandbox
的用法示例。
在下文中一共展示了Sandbox.new方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sandbox import Sandbox [as 别名]
# 或者: from sandbox.Sandbox import new [as 别名]
def run(self):
"""Process the judge request - create the sandbox,
compile the source, execute and generate results."""
with Sandbox.new() as sandbox:
with sandbox.file(self.fileFullName) as sourceFile:
sourceFile.write(self.source)
self.compile(sandbox)
self.execute(sandbox)
示例2: Node
# 需要导入模块: from sandbox import Sandbox [as 别名]
# 或者: from sandbox.Sandbox import new [as 别名]
# -*- coding: utf-8 -*-
from node import Node
from sandbox import Sandbox
import locale
import logging
import sys
# Set the default locale for dates and times in logs
locale.setlocale(locale.LC_ALL, '')
FORMAT = '%(asctime)s - %(levelname)s - [%(module)s.%(funcName)s] %(message)s'
logging.basicConfig(
level=logging.DEBUG,
format=FORMAT,
datefmt='%c'
)
if __name__ == '__main__':
# Test if the chosen sandbox can run on this system
with Sandbox.new() as sandbox:
sandbox.test_sandbox()
# Start the Node
try:
node = Node()
node.run()
except KeyboardInterrupt:
logging.info("Node successfully terminated.")
sys.exit(0)