Advertisement
Guest User

no

a guest
Oct 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2. class dbClient():
  3. //shdjsahdjajshd
  4.  
  5. client = dbClient()
  6.  
  7. class Example(client.Document):
  8. //Some stuff
  9. @property
  10. def Document(self):
  11. return HandlerWrapper(self).subclass()
  12.  
  13. @property
  14. def session(self, db=None): #Alias
  15. return self.Session()
  16.  
  17. def Session(self, db=None):
  18. return SessionHandler(self, db=db) # What ever it is
  19.  
  20. async def run2():
  21. async with client.Session() as s:
  22. print(await Example.query(number=2, boolean=False, string_ieq="test"))
  23.  
  24.  
  25. class HandlerWrapper:
  26. def __init__(self, client):
  27. self.client = client
  28.  
  29. def subclass(self):
  30. wrapper = self
  31.  
  32. class HandlerDocument(Handler):
  33. def _get_wrapper(self):
  34. return wrapper
  35.  
  36. return HandlerDocument
  37.  
  38.  
  39. class Handler:
  40. def __init__(self, **kwargs):
  41. pass
  42.  
  43. @staticmethod
  44. def _get_wrapper(self):
  45. return None
  46.  
  47. @staticmethod
  48. def _find_session():
  49. print(dir(calframe[2][0]))
  50. for varss in globals():
  51. print(varss)
  52.  
  53. @staticmethod
  54. async def query(**kwargs):
  55. s = Handler._find_session() #I want to get 's' here or type of 'Session'
  56. return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement