How to use the tqdm._utils._environ_cols_wrapper function in tqdm

To help you get started, we’ve selected a few tqdm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github timvieira / arsenal / arsenal / View on Github external
def console_width(minimum=None, default=80):
    "Return width of available window area."
    from tqdm._utils import _environ_cols_wrapper
    return max(minimum or 0, _environ_cols_wrapper()(sys.stdout) or default)
github asyml / texar-pytorch / texar / torch / run / View on Github external
test_every: OptionalList[Condition] = None,
                 test_mode: str = 'predict',
                 # Logging
                 log_every: OptionalList[Condition] = None,
                 log_format: Optional[str] = None,
                 log_destination: OptionalList[LogDest] = None,
                 print_model_arch: bool = True,
                 valid_log_format: Optional[str] = None,
                 test_log_format: Optional[str] = None,
                 valid_progress_log_format: Optional[str] = None,
                 test_progress_log_format: Optional[str] = None,
                 show_live_progress: Union[bool, MaybeList[str]] = False):

            from tqdm._utils import _environ_cols_wrapper, _term_move_up
            self._tty_ncols: Optional[Callable] = _environ_cols_wrapper()
            self._tty_move_up: str = _term_move_up()
        except ImportError:
            self._tty_ncols = None

        # Meta variables
        self._should_terminate = False  # .terminate()
        self._should_remove_current_action = False  # .remove_action()
        # Since an event action could be internally fire other events (e.g.
        # validation), there could be nested events. Thus we keep track of
        # the number of layers.
        self._event_nested_layers = 0  # ._fire_event()
        self._status_line_str: Optional[str] = None

        self.model = model
        self.train_data = train_data
        self.valid_data = valid_data