progressbar.base module
Sentinels for “no length known” and “no value given”.
Both sentinels are classes, not instances, and both are falsey. That
is the whole point of FalseMeta: it lets the rest of the library write
if self.max_value: and have that mean “has a known, usable length”,
without a separate is UnknownLength check at every site. See
ProgressBar.data and the update-gate logic in progressbar.bar for
the call sites that rely on it.
-
class progressbar.base.FalseMeta[source]
Bases: type
Metaclass making its classes evaluate as false.
Applied to the sentinels below so they can stand in for a missing
value in a boolean test rather than needing an identity comparison.
-
class progressbar.base.IO[source]
Bases: Generic
Generic base class for TextIO and BinaryIO.
This is an abstract, generic version of the return of open().
NOTE: This does not distinguish between the different possible
classes (text vs. binary, read vs. write vs. read/write,
append-only, unbuffered). The TextIO and BinaryIO subclasses
below capture the distinctions between text vs. binary, which is
pervasive in the interface; however we currently do not offer a
way to track the other distinctions in the type system.
-
abstractmethod close() → None[source]
-
abstract property closed: bool
-
abstractmethod fileno() → int[source]
-
abstractmethod flush() → None[source]
-
abstractmethod isatty() → bool[source]
-
abstract property mode: str
-
abstract property name: str
-
abstractmethod read(n: int = -1) → AnyStr[source]
-
abstractmethod readable() → bool[source]
-
abstractmethod readline(limit: int = -1) → AnyStr[source]
-
abstractmethod readlines(hint: int = -1) → List[source]
-
abstractmethod seek(offset: int, whence: int = 0) → int[source]
-
abstractmethod seekable() → bool[source]
-
abstractmethod tell() → int[source]
-
abstractmethod truncate(size: int = None) → int[source]
-
abstractmethod writable() → bool[source]
-
abstractmethod write(s: AnyStr) → int[source]
-
abstractmethod writelines(lines: List) → None[source]
-
class progressbar.base.TextIO[source]
Bases: IO[str]
Typed version of the return of open() in text mode.
-
abstract property buffer: BinaryIO
-
abstract property encoding: str
-
abstract property errors: str | None
-
abstract property line_buffering: bool
-
abstract property newlines: Any
-
class progressbar.base.Undefined[source]
Bases: object
No value was supplied, where None is itself meaningful.
-
class progressbar.base.UnknownLength[source]
Bases: object
The total amount of work is not knowable in advance.
Passed as max_value for an iterable with no __len__ (a
generator, a stream) so the bar renders progress without a
percentage or an ETA.