Today I learned that Python comes with the operator module. This provides various operators as functions, which made me think of db/filters.py, where we define several functions again like exact, which is equal to operator.eq.
This PR reduces possible errors and maintenance for us by replacing our functions with those from operator. Please note that more might be possible; there is e.g. operator.contains, but it's not a drop-in replacement for in_ (I tried, some tests failed) and I didn't want to spend too much time on this, so for now, it's not included here.
Today I learned that Python comes with the operator module. This provides various operators as functions, which made me think of
db/filters.py
, where we define several functions again likeexact
, which is equal tooperator.eq
. This PR reduces possible errors and maintenance for us by replacing our functions with those fromoperator
. Please note that more might be possible; there is e.g.operator.contains
, but it's not a drop-in replacement forin_
(I tried, some tests failed) and I didn't want to spend too much time on this, so for now, it's not included here.