class_docstr: Displays a progress bar.
  
  Args:
      target: Total number of steps expected, None if unknown.
      width: Progress bar width on screen.
      verbose: Verbosity mode, 0 (silent), 1 (verbose), 2 (semi-verbose)
      stateful_metrics: Iterable of string names of metrics that should *not*
          be averaged over time. Metrics in this list will be displayed as-is.
          All others will be averaged by the progbar before display.
      interval: Minimum visual progress update interval (in seconds).
      unit_name: Display name for step counts (usually "step" or "sample").
class_docstr_tok: ["Displays","a","progress","bar",".","Args",":","target",":","Total","number","of","steps","expected",",","None","if","unknown",".","width",":","Progress","bar","width","on","screen",".","verbose",":","Verbosity","mode",",","0","(","silent",")",",","1","(","verbose",")",",","2","(","semi-verbose",")","stateful_metrics",":","Iterable","of","string","names","of","metrics","that","should","*","not","*","be","averaged","over","time",".","Metrics","in","this","list","will","be","displayed","as-is",".","All","others","will","be","averaged","by","the","progbar","before","display",".","interval",":","Minimum","visual","progress","update","interval","(","in","seconds",")",".","unit_name",":","Display","name","for","step","counts","(","usually","``","step","''","or","``","sample","''",")","."]
docstr: Estimate the duration of a single step.
  
  Given the step number `current` and the corresponding time `now` this
  function returns an estimate for how long a single step takes. If this
  is called before one step has been completed (i.e. `current == 0`) then
  zero is given as an estimate. The duration estimate ignores the duration
  of the (assumed to be non-representative) first step for estimates when
  more steps are available (i.e. `current>1`).
  
  Args:
      current: Index of current step.
      now: The current time.
  
  Returns: Estimate of the duration of a single step.
docstr_tok: ["Estimate","the","duration","of","a","single","step",".","Given","the","step","number","`","current","`","and","the","corresponding","time","`","now","`","this","function","returns","an","estimate","for","how","long","a","single","step","takes",".","If","this","is","called","before","one","step","has","been","completed","(","i.e",".","`","current","==","0","`",")","then","zero","is","given","as","an","estimate",".","The","duration","estimate","ignores","the","duration","of","the","(","assumed","to","be","non-representative",")","first","step","for","estimates","when","more","steps","are","available","(","i.e",".","`","current",">","1","`",")",".","Args",":","current",":","Index","of","current","step",".","now",":","The","current","time",".","Returns",":","Estimate","of","the","duration","of","a","single","step","."]
code: def _estimate_step_duration(self, current, now):
      """Estimate the duration of a single step.
  
      Given the step number `current` and the corresponding time `now` this
      function returns an estimate for how long a single step takes. If this
      is called before one step has been completed (i.e. `current == 0`) then
      zero is given as an estimate. The duration estimate ignores the duration
      of the (assumed to be non-representative) first step for estimates when
      more steps are available (i.e. `current>1`).
  
      Args:
          current: Index of current step.
          now: The current time.
  
      Returns: Estimate of the duration of a single step.
      """
      if current:
          # there are a few special scenarios here:
          # 1) somebody is calling the progress bar without ever supplying
          #    step 1
          # 2) somebody is calling the progress bar and supplies step one
          #    multiple times, e.g. as part of a finalizing call
          # in these cases, we just fall back to the simple calculation
          if self._time_after_first_step is not None and current > 1:
              time_per_unit = (now - self._time_after_first_step) / (
                  current - 1
              )
          else:
              time_per_unit = (now - self._start) / current
  
          if current == 1:
              self._time_after_first_step = now
          return time_per_unit
      else:
          return 0
  
file_path: keras/keras/utils/progbar.py
imports: import math
  import os
  import sys
  import time
  from keras import backend
  from keras.api_export import keras_export
  from keras.utils import io_utils
label_desc: Use image node_id 5 for calling the Progbar obj's underlying member method code with example usage: obj._estimate_step_duration(current, now) and returns: time_per_unit, int