@@ -96,11 +96,17 @@ def _to_identifier(val: Union[ObjId, str]) -> Union[afm_models.AfmLocalIdentifie
9696
9797
9898class AttributeFilter (Filter ):
99- def __init__ (self , label : Union [ObjId , str , Attribute ], values : list [str ] | None = None ) -> None :
99+ def __init__ (
100+ self ,
101+ label : Union [ObjId , str , Attribute ],
102+ values : list [str ] | None = None ,
103+ uses_arbitrary_values : bool | None = None ,
104+ ) -> None :
100105 super ().__init__ ()
101106
102107 self ._label = _extract_id_or_local_id (label )
103108 self ._values = values or []
109+ self ._uses_arbitrary_values = uses_arbitrary_values
104110
105111 @property
106112 def label (self ) -> Union [ObjId , str ]:
@@ -114,6 +120,10 @@ def label(self, label: Union[ObjId, str]) -> None:
114120 def values (self ) -> list [str ]:
115121 return self ._values
116122
123+ @property
124+ def uses_arbitrary_values (self ) -> bool | None :
125+ return self ._uses_arbitrary_values
126+
117127 def is_noop (self ) -> bool :
118128 return False
119129
@@ -128,7 +138,10 @@ class PositiveAttributeFilter(AttributeFilter):
128138 def as_api_model (self ) -> afm_models .PositiveAttributeFilter :
129139 label_id = _to_identifier (self ._label )
130140 elements = afm_models .AttributeFilterElements (values = self .values )
131- body = PositiveAttributeFilterBody (label = label_id , _in = elements , _check_type = False )
141+ kwargs : dict [str , Any ] = {}
142+ if self ._uses_arbitrary_values is not None :
143+ kwargs ["uses_arbitrary_values" ] = self ._uses_arbitrary_values
144+ body = PositiveAttributeFilterBody (label = label_id , _in = elements , _check_type = False , ** kwargs )
132145 return afm_models .PositiveAttributeFilter (body , _check_type = False )
133146
134147 def description (self , labels : dict [str , str ], format_locale : str | None = None ) -> str :
@@ -144,7 +157,10 @@ def is_noop(self) -> bool:
144157 def as_api_model (self ) -> afm_models .NegativeAttributeFilter :
145158 label_id = _to_identifier (self ._label )
146159 elements = afm_models .AttributeFilterElements (values = self .values )
147- body = NegativeAttributeFilterBody (label = label_id , not_in = elements , _check_type = False )
160+ kwargs : dict [str , Any ] = {}
161+ if self ._uses_arbitrary_values is not None :
162+ kwargs ["uses_arbitrary_values" ] = self ._uses_arbitrary_values
163+ body = NegativeAttributeFilterBody (label = label_id , not_in = elements , _check_type = False , ** kwargs )
148164 return afm_models .NegativeAttributeFilter (body )
149165
150166 def description (self , labels : dict [str , str ], format_locale : str | None = None ) -> str :
0 commit comments