def matchtask(self, task: Dict[str, Any]) -> Union[bool, str]: for k, v in nested_items(task): if isinstance(k, str) and '\t' in k: return True if isinstance(v, str) and '\t' in v: return True return False
def matchtask(self, task: Dict[str, Any]) -> Union[bool, str]: for k, v in nested_items(task): if isinstance(v, str): cleaned = self.exclude_json_re.sub("", v) if bool(self.bracket_regex.search(cleaned)): return self.base_msg + v return False
def matchtask(self, task: Dict[str, Any]) -> Union[bool, str]: for k, v, parent in nested_items(task): if isinstance(k, str) and '\t' in k: return True if (parent, k) not in self.allow_list and isinstance( v, str) and '\t' in v: return True return False
def test_nested_items(): """Verify correct function of nested_items().""" data = {"foo": "text", "bar": {"some": "text2"}, "fruits": ["apple", "orange"]} items = [ ("foo", "text", ""), ("bar", {"some": "text2"}, ""), ("some", "text2", "bar"), ("fruits", ["apple", "orange"], ""), ("list-item", "apple", "fruits"), ("list-item", "orange", "fruits"), ] assert list(utils.nested_items(data)) == items
def matchtask(self, task: Dict[str, Any]) -> Union[bool, str]: for k, v, _ in nested_items(task): if k == 'when': if isinstance(v, str): if self.literal_bool_compare.search(v): return True elif isinstance(v, bool): pass else: for item in v: if isinstance( item, str ) and self.literal_bool_compare.search(item): return True return False
def matchtask(self, task: Dict[str, Any], file: 'Optional[Lintable]' = None) -> Union[bool, str]: for k, v, _ in nested_items(task): if k == 'when': if isinstance(v, str): if self.empty_string_compare.search(v): return True elif isinstance(v, bool): pass else: for item in v: if isinstance( item, str ) and self.empty_string_compare.search(item): return True return False
def matchtask(self, task: Dict[str, Any]) -> Union[bool, str]: for k, v in nested_items(task): if k == 'when': if self.literal_bool_compare.search(v): return True return False