docstr: Return a generator which yields the items added to the bar
  during construction, and updates the progress bar *after* the
  yielded block returns.
docstr_tok: ["Return","a","generator","which","yields","the","items","added","to","the","bar","during","construction",",","and","updates","the","progress","bar","*","after","*","the","yielded","block","returns","."]
code: def generator(self):
      """Return a generator which yields the items added to the bar
      during construction, and updates the progress bar *after* the
      yielded block returns.
      """
      # WARNING: the iterator interface for `ProgressBar` relies on
      # this and only works because this is a simple generator which
      # doesn't create or manage additional state. If this function
      # changes, the impact should be evaluated both against
      # `iter(bar)` and `next(bar)`. `next()` in particular may call
      # `self.generator()` repeatedly, and this must remain safe in
      # order for that interface to work.
      if not self.entered:
          raise RuntimeError(
              "You need to use progress bars in a with block."
          )
  
      if self.is_hidden:
          for rv in self.iter:
              yield rv
      else:
          for rv in self.iter:
              self.current_item = rv
              yield rv
              self.update(1)
          self.finish()
          self.render_progress()
  
imports: import contextlib
  import math
  import os
  import sys
  import time
  from ._compat import _default_text_stdout
  from ._compat import CYGWIN
  from ._compat import get_best_encoding
  from ._compat import int_types
  from ._compat import isatty
  from ._compat import open_stream
  from ._compat import range_type
  from ._compat import strip_ansi
  from ._compat import term_len
  from ._compat import WIN
  from .exceptions import ClickException
  from .utils import echo
label_desc: Use image node_id 20 for calling the ProgressBar obj's underlying member method code with example usage: obj.generator() without return types