const.py 797 B

123456789101112131415161718192021222324252627
  1. # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
  2. # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
  3. # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
  4. OP_PRECEDENCE = {
  5. op: precedence
  6. for precedence, ops in enumerate(
  7. [
  8. ["Lambda"], # lambda x: x + 1
  9. ["IfExp"], # 1 if True else 2
  10. ["or"],
  11. ["and"],
  12. ["not"],
  13. ["Compare"], # in, not in, is, is not, <, <=, >, >=, !=, ==
  14. ["|"],
  15. ["^"],
  16. ["&"],
  17. ["<<", ">>"],
  18. ["+", "-"],
  19. ["*", "@", "/", "//", "%"],
  20. ["UnaryOp"], # +, -, ~
  21. ["**"],
  22. ["Await"],
  23. ]
  24. )
  25. for op in ops
  26. }