Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ThisThreadGenerator.py 485 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  1. class ThisThreadGenerator(object):
  2. def __init__(self, generator_func, user_param=None):
  3. super().__init__()
  4. self.generator_func = generator_func
  5. self.user_param = user_param
  6. self.initialized = False
  7. def __iter__(self):
  8. return self
  9. def __next__(self):
  10. if not self.initialized:
  11. self.initialized = True
  12. self.generator_func = self.generator_func(self.user_param)
  13. return next(self.generator_func)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...