mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-12-13 22:12:32 +00:00
dfff49e31f
* chore: add pre-commit config * chore: fix pre-commit errors * chore: add black pre-commit hook * style: format python files with black * chore: add isort pre-commit hook * style: format python files using isort * chore: add pyupgrade pre-commit hook * refactor: upgrade code to python3.7 * Allow stacking PRs Co-authored-by: Julian Tölle <julian.toelle97@gmail.com> --------- Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
23 lines
530 B
Python
Executable file
23 lines
530 B
Python
Executable file
#!/usr/bin/env python
|
|
"""Prepends a relative timestamp to each input line from stdin and writes it to stdout."""
|
|
|
|
|
|
import sys
|
|
import time
|
|
|
|
|
|
def main():
|
|
"""Main program entry point."""
|
|
start = time.time()
|
|
|
|
sys.stdin.reconfigure(errors="surrogateescape")
|
|
sys.stdout.reconfigure(errors="surrogateescape")
|
|
|
|
for line in sys.stdin:
|
|
seconds = time.time() - start
|
|
sys.stdout.write("%02d:%02d %s" % (seconds // 60, seconds % 60, line))
|
|
sys.stdout.flush()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|