ConfigHelper
Can use it to save or recall preferences from Python.
-
Copyright (c) 2019 InfoLab (Donggun LEE)
-
How to install
pip install ConfigHelper
- Other version
# 0.0.3 pip install ConfigHelper==0.0.3
- Other version
-
Functions
config = ConfigHelper(data:dict) config = ConfigHelper(path:str) # URL is not supported. config = ConfigHelper(cls:type) # Class config = ConfigHelper(obj) # is not None # Returns the value. def getValue(key:str): return Value # Modify or add new value. def setValue(key:str, value:object): return None # Create New Object. (Init Variable) def newObject(cls:Class): return Object # Put a value in Object def setObject(obj:Object): pass # Return as "Dictionary". def toDict(): return Dictionary # Return as "JSON". def toJSON(): return String(=JSON) # Return as "File". def toFile(path:string): return file
-
How to use
- Test Class
# Test Class class Test: def __init__(self): self.name = "Donggun LEE" self.age = 24 def __str__(self): return "name : {}, age : {}".format(self.name, self.age)
- Import ConfigHelper
from ConfigHelper import Config
- Config None Example
# Config None Example print("Config None Example") cfg_none = Config() cfg_none.setValue("Version", "0.0.1") cfg_none.setValue("isTemporary", 0) cfg_none.setValue("isUserMode", 1) print(cfg_none.isTemporary) """ 0 """ print(cfg_none.Version) """ 0.0.1 """ print(cfg_none.toJSON()) """ { "Version": "0.0.1", "isTemporary": 0, "isUserMode": 1 } """ test = Test() print(test) """ name : Donggun LEE, age : 24 """ cfg_none.setValue("name", "LEE Donggun") cfg_none.setObject(test) print(test) """ name : LEE Donggun, age : 24 """ try: print(test.Version) """ """ except Exception as e: print(e) """ 'Test' object has no attribute 'Version' """ print(cfg_none.Version) """ 0.0.1 """ print(cfg_none.toDict()['Version']) """ 0.0.1 """ cfg_none.toFile("d:/a/b/c/d/e/f/config.json")
- Config Dictionaray Example
# Config Dictionaray Example print("Config Dictionaray Example") cfg_dict = Config({"name":"LEE Donggun", "age":40}) print(cfg_dict) """ { "age": 40, "name": "LEE Donggun" } """ test = cfg_dict.newObject(Test) print(test) """ name : LEE Donggun, age : 40 """ cfg_dict.setValue("age",70) cfg_dict.setObject(test) print(test) """ name : LEE Donggun, age : 70 """
- Config File Example
# Config File Example print("Config File Example") cfg_file = Config("d:/a/b/c/d/e/f/config.json") print(cfg_file) """ { "Version": "0.0.1", "isTemporary": 0, "isUserMode": 1, "name": "LEE Donggun" } """
- Config Class Example
# Config Class Example print("Config Class Example") cfg_class = Config(Test) print(cfg_class) """ { "age": 24, "name": "Donggun LEE" } """
- Config Object Example
# Config Object Example print("Config Object Example") cfg_obj = Config(Test()) print(cfg_class) """ { "age": 24, "name": "Donggun LEE" } """
- Test Class
Metadata
Release files for ConfigHelper 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ConfigHelper-0.0.3.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ConfigHelper-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / ConfigHelper-0.0.3.tar.gz
| Download URL | ConfigHelper-0.0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99361922e0d36d7918221f0f43dd9e1eedac2b3972eec366f1b9c86ab97b830a
|
|
BLAKE2b-256 checksum How to use checksums |
9db32fc4ad13cd744ca1b2884a64f6db0857b5e50fb4ab3e14514cfcf3065abf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Release files / ConfigHelper-0.0.3-py3-none-any.whl
| Download URL | ConfigHelper-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6525cfe07788e96bed1c2bb9e42fee5de0970c77b6b118de8d34937e7ff5d904
|
|
BLAKE2b-256 checksum How to use checksums |
a86d1f374fd89c97918c36ea508fd2186176c12f110a891d07541de080164fce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Security for ConfigHelper 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.