@@ -157,7 +157,7 @@ def contains(self, value: str) -> 'FilterCondition':
157157 self .relation = FilterConditionRelation .EQUAL
158158 return self
159159
160- def __and__ (self , other : FilterElement ) -> 'FilterChain' :
160+ def __and__ (self , other : Optional [ FilterElement ] ) -> 'FilterChain' :
161161 """
162162 Dynamically construct a 'and' filter chain object using binary operations.
163163 :param other: The other filter element to chain to this element.
@@ -172,10 +172,12 @@ def __and__(self, other: FilterElement) -> 'FilterChain':
172172 return FilterChain (FilterChainConnective .AND ).add_filter (self ).add_filter (other )
173173 else :
174174 raise FilterCompilationException ('Unknown filter element connective operation' )
175+ elif other is None :
176+ return self
175177 else :
176178 raise FilterCompilationException ('Unknown filter element type' )
177179
178- def __or__ (self , other : FilterElement ) -> 'FilterChain' :
180+ def __or__ (self , other : Optional [ FilterElement ] ) -> 'FilterChain' :
179181 """
180182 Dynamically construct a 'or' filter chain object using binary operations.
181183 :param other: The other filter element to chain to this element.
@@ -190,6 +192,8 @@ def __or__(self, other: FilterElement) -> 'FilterChain':
190192 return FilterChain (FilterChainConnective .OR ).add_filter (self ).add_filter (other )
191193 else :
192194 raise FilterCompilationException ('Unknown filter element connective operation' )
195+ elif other is None :
196+ return self
193197 else :
194198 raise FilterCompilationException ('Unknown filter element type' )
195199
@@ -242,7 +246,7 @@ def add_filter(self, filter_element: FilterElement, front: bool = False) -> 'Fil
242246
243247 return self
244248
245- def __and__ (self , other : FilterElement ) -> 'FilterChain' :
249+ def __and__ (self , other : Optional [ FilterElement ] ) -> 'FilterChain' :
246250 """
247251 Dynamically construct a 'and' filter chain object using binary operations.
248252 :param other: The other filter element to chain to this element.
@@ -269,10 +273,12 @@ def __and__(self, other: FilterElement) -> 'FilterChain':
269273 return FilterChain (FilterChainConnective .AND ).add_filter (self ).add_filter (other )
270274 else :
271275 raise FilterCompilationException ('Unknown filter element connective operation' )
276+ elif other is None :
277+ return self
272278 else :
273279 raise FilterCompilationException ('Unknown filter element type' )
274280
275- def __or__ (self , other : FilterElement ) -> 'FilterChain' :
281+ def __or__ (self , other : Optional [ FilterElement ] ) -> 'FilterChain' :
276282 """
277283 Dynamically construct a 'and' filter chain object using binary operations.
278284 :param other: The other filter element to chain to this element.
@@ -299,5 +305,7 @@ def __or__(self, other: FilterElement) -> 'FilterChain':
299305 return FilterChain (FilterChainConnective .OR ).add_filter (self ).add_filter (other )
300306 else :
301307 raise FilterCompilationException ('Unknown filter element connective operation' )
308+ elif other is None :
309+ return self
302310 else :
303311 raise FilterCompilationException ('Unknown filter element type' )
0 commit comments