brain_sqlalchemy.py 780 B

1234567891011121314151617181920212223242526272829303132333435
  1. from astroid.brain.helpers import register_module_extender
  2. from astroid.builder import parse
  3. from astroid.manager import AstroidManager
  4. def _session_transform():
  5. return parse(
  6. """
  7. from sqlalchemy.orm.session import Session
  8. class sessionmaker:
  9. def __init__(
  10. self,
  11. bind=None,
  12. class_=Session,
  13. autoflush=True,
  14. autocommit=False,
  15. expire_on_commit=True,
  16. info=None,
  17. **kw
  18. ):
  19. return
  20. def __call__(self, **local_kw):
  21. return Session()
  22. def configure(self, **new_kw):
  23. return
  24. return Session()
  25. """
  26. )
  27. register_module_extender(AstroidManager(), "sqlalchemy.orm.session", _session_transform)