3
0
Fork 0

fix: fix 'singleton-comparison' for pylint

This commit is contained in:
Lance Edgar 2025-09-01 10:46:35 -05:00
parent 48494ee5e4
commit 2bcdeb42cd
2 changed files with 23 additions and 8 deletions

View file

@ -11,7 +11,6 @@ disable=fixme,
missing-function-docstring,
missing-module-docstring,
no-member,
singleton-comparison,
super-init-not-called,
too-many-locals,
too-many-nested-blocks,

View file

@ -446,7 +446,7 @@ class AlchemyFilter(GridFilter):
# probably does not expect that, so explicitly include them.
return query.filter(
sa.or_(
self.model_property == None,
self.model_property == None, # pylint: disable=singleton-comparison
self.model_property != value,
)
)
@ -491,14 +491,18 @@ class AlchemyFilter(GridFilter):
"""
Filter data with an ``IS NULL`` query. The value is ignored.
"""
return query.filter(self.model_property == None)
return query.filter(
self.model_property == None # pylint: disable=singleton-comparison
)
def filter_is_not_null(self, query, value): # pylint: disable=unused-argument
"""
Filter data with an ``IS NOT NULL`` query. The value is
ignored.
"""
return query.filter(self.model_property != None)
return query.filter(
self.model_property != None # pylint: disable=singleton-comparison
)
class StringAlchemyFilter(AlchemyFilter):
@ -550,7 +554,12 @@ class StringAlchemyFilter(AlchemyFilter):
# sql probably excludes null values from results, but user
# probably does not expect that, so explicitly include them.
return query.filter(sa.or_(self.model_property == None, sa.and_(*criteria)))
return query.filter(
sa.or_(
self.model_property == None, # pylint: disable=singleton-comparison
sa.and_(*criteria),
)
)
class NumericAlchemyFilter(AlchemyFilter):
@ -628,14 +637,18 @@ class BooleanAlchemyFilter(AlchemyFilter):
Filter data with an "is true" condition. The value is
ignored.
"""
return query.filter(self.model_property == True)
return query.filter(
self.model_property == True # pylint: disable=singleton-comparison
)
def filter_is_false(self, query, value): # pylint: disable=unused-argument
"""
Filter data with an "is false" condition. The value is
ignored.
"""
return query.filter(self.model_property == False)
return query.filter(
self.model_property == False # pylint: disable=singleton-comparison
)
def filter_is_false_null(self, query, value): # pylint: disable=unused-argument
"""
@ -643,7 +656,10 @@ class BooleanAlchemyFilter(AlchemyFilter):
ignored.
"""
return query.filter(
sa.or_(self.model_property == False, self.model_property == None)
sa.or_(
self.model_property == False, # pylint: disable=singleton-comparison
self.model_property == None, # pylint: disable=singleton-comparison
)
)