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
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
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
def test_check_ast_node_good(self): node = b_utils.check_ast_node("Call") self.assertEqual("Call", node)