Beispiel #1
0
 def _parse(self):
     glb = {}
     loc = {}
     exec(compile(self.__code.code, "[Strategy:%s]" % self.__code.name, mode="exec"), glb, loc)
     for key, value in loc.items():
         if inspect.isfunction(value):
             if key == "init":
                 self._init(loc)
             else:
                 self._extract_signal_setting(key, value)
     self.__signals_ast = find_func_in_module(self.signals, self.__ast_root)
     self.__globals.update(Globals({key: value for key, value in loc.items() if key not in self.signals}, {}))
Beispiel #2
0
 def _parse(self):
     glb = {}
     loc = {}
     exec(
         compile(self.__code.code,
                 "[Strategy:%s]" % self.__code.name,
                 mode="exec"), glb, loc)
     for key, value in loc.items():
         if inspect.isfunction(value):
             if key == "init":
                 self._init(loc)
             else:
                 self._extract_signal_setting(key, value)
     self.__signals_ast = find_func_in_module(self.signals, self.__ast_root)
     self.__globals.update(
         Globals(
             {
                 key: value
                 for key, value in loc.items() if key not in self.signals
             }, {}))
Beispiel #3
0
 def _get_system_func_ast(self, func):
     path = os.path.join(self.user_dir.get_sys_func_dir(), func + ".py")
     with codecs.open(path, "r", "utf-8") as f:
         func_ast = find_func_in_module(func, ast.parse(f.read()))
         f.close()
     return func_ast
Beispiel #4
0
 def _get_system_func_ast(self, func):
     path = os.path.join(self.user_dir.get_sys_func_dir(), func + ".py")
     with codecs.open(path, "r", "utf-8") as f:
         func_ast = find_func_in_module(func, ast.parse(f.read()))
         f.close()
     return func_ast