iiasa / ixmp4

A data warehouse for high-powered scenario analysis in the domain of integrated assessment of climate change and energy systems modeling
https://docs.ece.iiasa.ac.at/ixmp4
MIT License
11 stars 6 forks source link

Use opearator functions instead of our own where possible #106

Closed glatterf42 closed 2 months ago

glatterf42 commented 3 months ago

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.