@@ -164,14 +164,14 @@ def _rel_merge_helper(
164164
165165_UNARY_OPERATORS = (_SPECIAL_OPERATOR_ISNULL , _SPECIAL_OPERATOR_ISNOTNULL )
166166
167- _REGEX_INSESITIVE = _SPECIAL_OPERATOR_INSENSITIVE + "{}"
167+ _REGEX_INSENSITIVE = _SPECIAL_OPERATOR_INSENSITIVE + "{}"
168168_REGEX_CONTAINS = ".*{}.*"
169169_REGEX_STARTSWITH = "{}.*"
170170_REGEX_ENDSWITH = ".*{}"
171171
172172# regex operations that require escaping
173173_STRING_REGEX_OPERATOR_TABLE = {
174- "iexact" : _REGEX_INSESITIVE ,
174+ "iexact" : _REGEX_INSENSITIVE ,
175175 "contains" : _REGEX_CONTAINS ,
176176 "icontains" : _SPECIAL_OPERATOR_INSENSITIVE + _REGEX_CONTAINS ,
177177 "startswith" : _REGEX_STARTSWITH ,
@@ -181,7 +181,7 @@ def _rel_merge_helper(
181181}
182182# regex operations that do not require escaping
183183_REGEX_OPERATOR_TABLE = {
184- "iregex" : _REGEX_INSESITIVE ,
184+ "iregex" : _REGEX_INSENSITIVE ,
185185}
186186# list all regex operations, these will require formatting of the value
187187_REGEX_OPERATOR_TABLE .update (_STRING_REGEX_OPERATOR_TABLE )
@@ -693,16 +693,16 @@ def build_additional_match(self, ident: str, node_set: "AsyncNodeSet") -> None:
693693 for _ , value in node_set .must_match .items ():
694694 if isinstance (value , dict ):
695695 label = ":" + value ["node_class" ].__label__
696- stmt = _rel_helper (lhs = source_ident , rhs = label , ident = "" , ** value )
696+ stmt = f"EXISTS ( { _rel_helper (lhs = source_ident , rhs = label , ident = '' , ** value )} )"
697697 self ._ast .where .append (stmt )
698698 else :
699699 raise ValueError ("Expecting dict got: " + repr (value ))
700700
701701 for _ , val in node_set .dont_match .items ():
702702 if isinstance (val , dict ):
703703 label = ":" + val ["node_class" ].__label__
704- stmt = _rel_helper (lhs = source_ident , rhs = label , ident = "" , ** val )
705- self ._ast .where .append ("NOT " + stmt )
704+ stmt = f"NOT EXISTS ( { _rel_helper (lhs = source_ident , rhs = label , ident = '' , ** val )} )"
705+ self ._ast .where .append (stmt )
706706 else :
707707 raise ValueError ("Expecting dict got: " + repr (val ))
708708
0 commit comments