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:
fc.save(min_t, max_t, arr)
Result file (Config.txt):
min_t = int(25)
max_t = int(35)
arr = list([45, 'hello', 81.5])
Optional options:
Name | Accepts values | Default |
---|---|---|
*args | Arguments | Required |
file | File name | "config.txt" |
mode | Write modes: "w" - rewrite "a" - append | "w" |
save_types | True/False | True |
save_names | True/False | True |
fc.save(*args, 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"))
Import inside a function:
def func():
exec(fc.load("config.txt", function_mode=True))
Optional options:
Name | Explanation | Default |
---|---|---|
file | File name | Required |
run_mode | Allows you to run (copy namespace) values from the library and continue working with them in the executable. | True |
function_mode | Does the same as run_mode , but inside a function. | False |
return_only_names | True/False | False |
return_only_values | True/False | False |
fc.load(file, run_mode=True, function_mode=False, 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
PyFastConfig-2.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for PyFastConfig-2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49020952295a1f59cb45ab2c9133240528611e1e1a3cc872e5ce9c2609e9d05 |
|
MD5 | 4f0215aec040bfac87c23f027b8b543d |
|
BLAKE2b-256 | e8348a6cef334aadde6684b70d7eb9b9b51f97923d082661b4fbbac2dec1cb03 |