brain_threading.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (c) 2016, 2018-2020 Claudiu Popa <pcmanticore@gmail.com>
  2. # Copyright (c) 2017 Łukasz Rogalski <rogalski.91@gmail.com>
  3. # Copyright (c) 2020-2021 hippo91 <guillaume.peillex@gmail.com>
  4. # Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
  5. # Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com>
  6. # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
  7. # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
  8. from astroid.brain.helpers import register_module_extender
  9. from astroid.builder import parse
  10. from astroid.manager import AstroidManager
  11. def _thread_transform():
  12. return parse(
  13. """
  14. class lock(object):
  15. def acquire(self, blocking=True, timeout=-1):
  16. return False
  17. def release(self):
  18. pass
  19. def __enter__(self):
  20. return True
  21. def __exit__(self, *args):
  22. pass
  23. def locked(self):
  24. return False
  25. def Lock():
  26. return lock()
  27. """
  28. )
  29. register_module_extender(AstroidManager(), "threading", _thread_transform)