operator.py 521 B

12345678910111213141516171819202122
  1. from __future__ import absolute_import
  2. import operator
  3. from cytoolz.functoolz import curry
  4. # Tests will catch if/when this needs updated
  5. IGNORE = {
  6. "__abs__", "__index__", "__inv__", "__invert__", "__neg__", "__not__",
  7. "__pos__", "_abs", "abs", "attrgetter", "index", "inv", "invert",
  8. "itemgetter", "neg", "not_", "pos", "truth"
  9. }
  10. locals().update(
  11. {name: f if name in IGNORE else curry(f)
  12. for name, f in vars(operator).items() if callable(f)}
  13. )
  14. # Clean up the namespace.
  15. del curry
  16. del operator