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 details)
Built Distribution
File details
Details for the file PyFastConfig-2.0.tar.gz
.
File metadata
- Download URL: PyFastConfig-2.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74a27527d3d70c5f8d6c6794ff86736631c3570fc6220a6bd16217afb225230 |
|
MD5 | 3e27cb52658420447e19554e5d07f882 |
|
BLAKE2b-256 | ebcfd255b55c5cf8e7e472ad74ee3a338510b9620c52734290fb3f96e58273ca |
File details
Details for the file PyFastConfig-2.0-py3-none-any.whl
.
File metadata
- Download URL: PyFastConfig-2.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.26.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49020952295a1f59cb45ab2c9133240528611e1e1a3cc872e5ce9c2609e9d05 |
|
MD5 | 4f0215aec040bfac87c23f027b8b543d |
|
BLAKE2b-256 | e8348a6cef334aadde6684b70d7eb9b9b51f97923d082661b4fbbac2dec1cb03 |