Fast creation and reading of files on Python with configurations.
Project description
PyFastConfig
Fast creation and reading of files on Python with configurations. Usage example:
import PyFastConfig as fc
Save
#Declare any values
min_t = 25
max_t = 35
arr = [45, 'hello', 81.5]
Quick save:
array = [min_t, max_t, arr]
fc.save(array)
Result file (Config.txt):
min_t = int(25)
max_t = int(35)
arr = list([45, 'hello', 81.5])
Optional options:
file: File name can be specified
mode: "w" - write, "a" - append
save_types: default - True
save_names: default - True
fc.save(array, file="config.txt", mode="w", save_types=True, save_names=True)
Load
Quick load:
#import values (only if run_mode is not False)
#With copy namespace
exec(fc.load("config.txt"))
Optional options:
run_mode: default - True
Allows you to run (copy namespace) values from the library and continue working with them in the executable.
return_only_names: default - False
return_only_values: default - False
fc.load(file, run_mode=True, return_only_names=False, return_only_values=False)
If you changed the parameters for saving additional information (save_types and save_names) in the SAVE function, you must disable run_mode when reading such a file.
#Returns an array (use if you have disabled any of the following options: save_types or save_names)
print(fc.load("config.txt", run_mode=False))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PyFastConfig-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fe4ea66b839af6928938104235c61c4eee2072525b21f40c85190510e9c97d5 |
|
MD5 | c0ca0a91afdfcd83d913f19eca4c82df |
|
BLAKE2b-256 | 3944cb30fd6d850eb8b388d0c9c9e455ac76a0e2beaf2b11184d2c384d75b940 |