Skip to content
  1. Jul 12, 2023
  2. May 23, 2023
  3. May 21, 2023
  4. May 18, 2023
  5. Apr 08, 2023
  6. Mar 05, 2023
  7. Mar 01, 2023
  8. Feb 12, 2023
  9. Feb 09, 2023
  10. Feb 08, 2023
  11. Feb 07, 2023
  12. Feb 06, 2023
  13. Feb 05, 2023
  14. Feb 04, 2023
  15. Jan 29, 2023
  16. Jun 22, 2022
    • Thomas Touhey's avatar
      [core] Add polling_loop · 834774fa
      Thomas Touhey authored and ntome's avatar ntome committed
      This commit brings a new utility in woob for polling loops,
      in order to answer unwanted behaviours commonly found with
      polling loop implementations in modules:
      
      * Invalid cases suppresses the delay, e.g:
      
      	for _ in range(10):
      		is_invalid_case = True  # or other criterion
      		if is_invalid_case:
      			# Oops! No delay in that case.
      			continue
      
      		time.sleep(5)
      
      * Useless sleep at the end of the loop on the last
        iteration, e.g.:
      
      	for _ in range(5):
      		is_end = False
      		if is_end:
      			break
      
      		time.sleep(5)
      
      An example usage of this new polling_loop utility is the
      following:
      
      	from random import randint
      	from woob.tools.misc import polling_loop
      
      	for _ in polling_loop(count=5, delay=1):
      		number = randint(1, 100)
      		print('random number is %r' % number)
      
      		if number < 10:
      			break
      	else:
      		print('nevermind.')
      834774fa
  17. Apr 11, 2021
  18. Apr 05, 2021
  19. Apr 04, 2021
  20. Apr 03, 2021
  21. Mar 06, 2021
  22. Mar 05, 2021
  23. Mar 01, 2021
  24. Feb 27, 2021
  25. Sep 26, 2020