예제 #1
0
    def wrapper(func):
        if not hasattr(func, "_checks"):
            func._checks = []
        func._checks.extend(utils.check_ast_node(a) for a in args)

        LOG.debug('checks() decorator executed')
        LOG.debug('  func._checks: %s', func._checks)
        return func
예제 #2
0
    def wrapper(func):
        if not hasattr(func, "_checks"):
            func._checks = []
        func._checks.extend(utils.check_ast_node(a) for a in args)

        LOG.debug('checks() decorator executed')
        LOG.debug('  func._checks: %s', func._checks)
        return func
예제 #3
0
    def load_blacklists(self, blacklist_namespace):
        self.blacklists_mgr = extension.ExtensionManager(
            namespace=blacklist_namespace,
            invoke_on_load=False,
            verify_requirements=False,
        )
        self.blacklist = {}
        blacklist = list(self.blacklists_mgr)
        for item in blacklist:
            for key, val in item.plugin().items():
                utils.check_ast_node(key)
                self.blacklist.setdefault(key, []).extend(val)

        self.blacklist_by_id = {}
        self.blacklist_by_name = {}
        for val in self.blacklist.values():
            for b in val:
                self.blacklist_by_id[b['id']] = b
                self.blacklist_by_name[b['name']] = b
예제 #4
0
    def load_blacklists(self, blacklist_namespace):
        self.blacklists_mgr = extension.ExtensionManager(
            namespace=blacklist_namespace,
            invoke_on_load=False,
            verify_requirements=False,
            )
        self.blacklist = {}
        blacklist = list(self.blacklists_mgr)
        for item in blacklist:
            for key, val in item.plugin().items():
                utils.check_ast_node(key)
                self.blacklist.setdefault(key, []).extend(val)

        self.blacklist_by_id = {}
        self.blacklist_by_name = {}
        for val in six.itervalues(self.blacklist):
            for b in val:
                self.blacklist_by_id[b['id']] = b
                self.blacklist_by_name[b['name']] = b
예제 #5
0
 def test_check_ast_node_good(self):
     node = b_utils.check_ast_node("Call")
     self.assertEqual("Call", node)
예제 #6
0
 def test_check_ast_node_good(self):
     node = b_utils.check_ast_node("Call")
     self.assertEqual("Call", node)