コード例 #1
0
ファイル: core.py プロジェクト: hellhovnd/logilab-aspects
 def _update_methods(self, pointcut):
     """Updates the _method dictionnary
     Only updates methods that weren't in the pointcut
     """
     for weaved_object, method_names in pointcut.items():
         method_map = self._methods.get(weaved_object, {})
         for met_name in method_names:
             base_method, method = weaver.get_original_method(weaved_object, met_name)
             method_map[met_name] = (method, base_method)
             # base_method.im_func.func_globals
         self._methods[weaved_object] = method_map
コード例 #2
0
ファイル: core.py プロジェクト: Tubbz-alt/logilab-aspects
 def _update_methods(self, pointcut):
     """Updates the _method dictionnary
     Only updates methods that weren't in the pointcut
     """
     for weaved_object, method_names in pointcut.items():
         method_map = self._methods.get(weaved_object, {})
         for met_name in method_names:
             base_method, method = weaver.get_original_method(
                 weaved_object, met_name)
             method_map[met_name] = (method, base_method)
             # base_method.im_func.func_globals
         self._methods[weaved_object] = method_map
コード例 #3
0
ファイル: profiler.py プロジェクト: Tubbz-alt/logilab-aspects
    def _update_methods(self, pointcut):
        """Override AbstractAspect's update_methods because we also need
        to update our profile stats. (We might fix this with
        an appropriate hook)
        """
        for weaved_object, method_names in pointcut.items():
            method_map = self._methods.get(weaved_object, {})
            if weaved_object not in self.__profile_dict:
                self.__profile_dict[weaved_object] = {}

            for met_name in method_names:
                base_method, method = weaver.get_original_method(
                    weaved_object, met_name)
                method_map[met_name] = (method, base_method)
                if met_name not in self.__profile_dict[weaved_object]:
                    self.__profile_dict[weaved_object][met_name] = []

            self._methods[weaved_object] = method_map
コード例 #4
0
ファイル: profiler.py プロジェクト: anih/logilab-aspects
    def _update_methods(self, pointcut):
        """Override AbstractAspect's update_methods because we also need
        to update our profile stats. (We might fix this with
        an appropriate hook)
        """
        for weaved_object, method_names in pointcut.items():
            method_map = self._methods.get(weaved_object, {})
            if weaved_object not in self.__profile_dict:
                self.__profile_dict[weaved_object] = {}

            for met_name in method_names:
                base_method, method = weaver.get_original_method(weaved_object,
                                                                 met_name)
                method_map[met_name] = (method, base_method)
                if met_name not in self.__profile_dict[weaved_object]:
                    self.__profile_dict[weaved_object][met_name] = []
                
            self._methods[weaved_object] = method_map
コード例 #5
0
ファイル: contracts.py プロジェクト: anih/logilab-aspects
 def _update_methods(self, pointcut):
     """Override AbstractAspect's update_methods because we also need
     to update self._contract_definitions, and loops are exactly the
     same for both self._methods andself._contract_definitions (i.e.
     it's just a performance optimization. (We might fix this with
     an appropriate hook)
     """
     for weaved_object, method_names in pointcut.items():
         method_map = self._methods.get(weaved_object, {})
         contract_map = {} # self._contract_definitions[weaved_object]
         
         for met_name in method_names:
             base_method, method = weaver.get_original_method(weaved_object,
                                                              met_name)
             # if met_name not in method_map:
             method_map[met_name] = (method, base_method)
             # if met_name not in contract_map:
             contract_map[met_name] = self.precompile_contracts(
                 weaved_object, base_method)
         
         self._methods[weaved_object] = method_map
         self._contract_definitions[weaved_object] = contract_map