dtTimeFrame is a module that pack time track functions and subprocess call functions into one single class.
Project description
dtTimeFrame
dtTimeFrame is a module that pack time track functions and subprocess call functions into one single class.
- Homepage: https://github.com/SotongDJ/dtTimeFrame
Install dtTimeFrame
pip install dttimeframe
Example codes
tag()
from dtTimeFrame.timeFrame import tag # type: ignore
# Initiation
Tool = tag()
Tool.log.name = "log.txt" # filename of the log file, store stdout info
Tool.error.name = "err.txt" # filename of the err file, store stderr info
Tool.extra.name = "log.json" # filename of the extra command record, store time stamp, commands and others info
# start logging and write header into log/err files
Tool.start()
# > your code insert here <
# print time stamp with personalized msg
Tool.timeStamp("PREVIEW: show something you want to info")
# command runner, base on subprocess.call()
phrase_str = F"echo this command line"
Tool.runCommand(phrase_str)
# command runner with specific output file
phrase_str = F"echo this command line into specific output file: test.txt"
Tool.runCommand(phrase_str,export_file="test.txt")
# > your code insert here <
# end logging and write footer into log/err files
Tool.stop()
detector()
from dtTimeFrame.timeFrame import detector # type: ignore
file_be_process_handle = detector(print_func=print,call_func=print)
# "file_be_process_handle = detector(print_func=Tool.timeStamp,call_func=Tool.runCommand)"
# combine use with tag()
file_be_process_handle.do(target_str="target.txt")
if file_be_process_handle.missing(): # if target.txt missing?
with open(file_be_process_handle.doing_str,"w") as target_handle: # doing-target.txt
target_handle.write("Hello world\n")
file_be_process_handle.done() # rename doing-target.txt as target.txt
print(open(file_be_process_handle.target_str).read())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dttimeframe-3.6.5.tar.gz
(17.0 kB
view details)
Built Distribution
File details
Details for the file dttimeframe-3.6.5.tar.gz
.
File metadata
- Download URL: dttimeframe-3.6.5.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c57cd66ab04c1845b8d365ff59dc4a2f11d69e6450cb819c9a38e252b2c59816 |
|
MD5 | 141543fe068954987ca3da15fb0d015e |
|
BLAKE2b-256 | 8480d99ca9dccec945c85c910458ba5571e2bf250e2e75a156c2568d56d1553e |
File details
Details for the file dttimeframe-3.6.5-py3-none-any.whl
.
File metadata
- Download URL: dttimeframe-3.6.5-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00d679a5c8ffe1487db6c2c11f2fcebe436489be06e1e2d9deb7868b60dab349 |
|
MD5 | c22ecf119c8b2ee9479747ac2c51492d |
|
BLAKE2b-256 | 4b29160a53e5d6fe9510610d19e789c770e15cf46f5433a478ae58febfefe91f |