misc
Miscellaneous utility functions for BitBazaar.
StdCapture(stderr=False)
Bases: list
Capture stdout/stderr for the duration of a with block.
(e.g. print statements)
Example:
with StdCapture(stderr=True) as out: # By default only captures stdout
print('hello')
sys.stderr.write('world')
print(out) # ['hello', 'world']
Creation of new capturer.
By default only stdout is captured, stderr=True enables capturing stderr too.
Source code in py/bitbazaar/misc/_std_capture.py
__enter__()
Entering the capturing context.
__exit__(*args)
copy_sig(f)
Keep e.g. a class's init signature when subclassing.
From: https://github.com/python/typing/issues/769#issuecomment-903760354
in_ci()
Returns true if it looks like the program is running from a CI service, e.g. Github Actions.
is_tcp_port_listening(host, port)
Check if something is listening on a certain tcp port or not.
Source code in py/bitbazaar/misc/__init__.py
Last update:
August 7, 2024
Created: August 7, 2024
Created: August 7, 2024