def run(code): scanner = Scanner(code) tokens = scanner.scan_tokens() if error.had_error: return parser = Parser(tokens) stmts = parser.parse() if error.had_error: return res = resolver.Resolver(interp) res.resolve(stmts) if error.had_error: return interp.interpret(stmts)
def run( output_dir: str, context_dir: str, mappings: Sequence[str], ): # Load context. if context_dir is not None: for context_path in glob("{0}/*.csv".format(context_dir)): contents = resolver.load_file(context_path) values = [[value.strip() for value in row.split(",")] for row in contents] context.add(os.path.split(context_path)[1], values[0], values[1:]) # Execute mappings. for mapping in mappings: r = resolver.Resolver(resolver.load_file(mapping)) r.resolve()
def run(source: str): scanner = scan.Scanner(source) parser = parse.Parser(scanner.scan()) statements = parser.parse() if Lox.had_error: return resolver = resolve.Resolver(Lox.interpreter) resolver.resolve(statements) # print(Lox.interpreter._locals) if Lox.had_error: return Lox.interpreter.interpret(statements)
handler = logging.handlers.SysLogHandler(address='/dev/log') handler.setLevel(loglevel) handler.setFormatter(formatter) logger.addHandler(handler) config = read_conffile(sys.argv[1]) logger.debug('Finished reading configuration\n') #logging_config = config['logging'] #dictConfig(logging_config) #socket_file = config['socket-file'] HOSTNAME_BASE = config['hostname-base'] resolver = resolver.Resolver(config) try: while True: line = sys.stdin.readline() logger.debug('Got line %s' % line) try: process(line, resolver) except: #traceback.print_exc(file=sys.stderr) logger.error(traceback.format_exc()) break except: #traceback.print_exc(file=sys.stderr)
def __init__(self, config): self.config = config self.resolver = resolver.Resolver(config) self.server_ip = config['server-ip'] self.hostname_base = config['hostname-base']
import resolver resObj = resolver.Resolver() from rmrb_play_ctrl.core.dns import resolver resObj = resolver.Resolver() resObj.nameservers = ['8.8.8.8'] stra = resObj.query('pricloud.cn', 'a') print 'result:', stra
'a-p': queue.Queue(), 'p-a': queue.Queue() } resolver_args = () resolver_kwargs = { 'ip': '127.0.100.253', 'port': 53, 'a-r': appmgr_kwargs['a-r'], 'r-a': appmgr_kwargs['r-a'] } proxymgr_args = () proxymgr_kwargs = { 'a-p': appmgr_kwargs['a-p'], 'p-a': appmgr_kwargs['p-a'] } threads = [ resolver.Resolver(name='resolver', args=resolver_args, kwargs=resolver_kwargs), proxy.ProxyMgr(name='proxymgr', args=proxymgr_args, kwargs=proxymgr_kwargs), appmgr.AppMgr(name='appmgr', args=appmgr_args, kwargs=appmgr_kwargs), ] for t in threads: t.start() time.sleep(1)
# pr.disable() # # # In section you want to profile # pr.enable() # # print " goal_state = " # print goal_state solver_type = sys.argv[1].split(',')[0].upper() initial_board = sys.argv[2].split(',') board_temp_string = ''.join(initial_board) # print board_temp_string board_temp_list = list(board_temp_string) solver = resolver.Resolver(board_temp_string) # print board_temp_list initial_time = time.time() # print solver_type if solver_type == "BFS": solver.bfs_Solve() elif solver_type == "DFS": solver.dfs_Solve() elif solver_type == "AST": solver.a_Star_Solve() final_time = time.time() #