Name | iniUts JSON |
Version |
1.1.8
JSON |
| download |
home_page | None |
Summary | Ini file manipulator |
upload_time | 2024-04-16 22:56:35 |
maintainer | None |
docs_url | None |
author | Melque Lima |
requires_python | None |
license | MIT |
keywords |
iniuts
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Ini Uts
#
### Installation
```sh
pip install iniUts
```
## Usage
#
<!-- //==================================================== -->
## read
##### test.ini file
```ini
[Person]
name = myname
age = 31
amount = 20.3
friends = friend1,friend2,friend3
dob = 1991-12-23
```
##### python code
```py
from iniUts import IniUts
ini = IniUts('test.ini')
data = ini.read('Person','name')
print(result)
```
##### output
```py
"myname"
```
<!-- //==================================================== -->
## write
##### test.ini file
```ini
[PERSON]
name = myname
```
##### python code
```py
from iniUts import IniUts
ini = IniUts('test.ini')
ini.write('PERSON','last_name','mylastname')
```
##### test.ini file
```ini
[PERSON]
name = myname
last_name = mylastname
```
<!-- //==================================================== -->
## getKeys
##### test.ini file
```ini
[PERSON]
name = myname
last_name = mylastname
```
##### python code
```py
from iniUts import IniUts
ini = IniUts('test.ini')
keys = ini.getKeys("PERSON")
print(keys)
```
##### output
```py
['name','last_name']
```
<!-- //==================================================== -->
## Section2Dict
##### test.ini file
```ini
[PERSON]
name = myname
age = 31
amount = 20.3
friends = friend1,friend2,friend3
dob = 1991-12-23
```
##### python code
```py
from iniUts import IniUts
ini = IniUts('test.ini')
ini.Section2Dict('PERSON')
print(Person)
```
##### output
```py
{
"name" = "myname"
"age" = "31"
"amount" = "20.3"
"friends" = "friend1,friend2,friend3"
"dob" = "1991-12-23"
}
```
<!-- //==================================================== -->
## link
##### test.ini file
```ini
[PERSON]
name = myname
age = 31
amount = 20.3
friends = friend1,friend2,friend3
dob = 1991-12-23
```
##### python code
```py
from iniUts import IniUts
from datetime import datetime
from dataclasses import dataclass
ini = IniUts('test.ini')
@ini.link('PERSON')
class Person():
name : str
age : int
amount : float
friends: tuple = ','
dob : datetime = "%Y-%m-%d"
print(Person.name)
print(Person.age)
print(Person.amount)
print(Person.friends)
print(Person.dob)
```
##### output
```py
myname
31
20.3
("friend1","friend2","friend3")
datetime.datetime(1991, 12, 2, 0, 0)
```
# ENVIORNMENT CHANGING
<!-- //==================================================== -->
## Link
##### prd.ini file
```ini
[PERSON]
name = myName # Will be changed in DEV
age = 31
amount = 20.3
friends = friend1,friend2,friend3
dob = 1991-12-23
[CONFIG]
ip = <some_ip>
path = <some_path> # Will be changed in DEV
```
##### dev.ini file
```ini
[PERSON] #change only PERSON name
name = myOtherName
[CONFIG] #change only CONFIG path
path = <another_path>
```
##### python code
```py
from iniUts import IniUts
from datetime import datetime
from dataclasses import dataclass
ini = IniUts('prd.ini','dev.ini',in_prd=True) #CHANGE S WILL BE MADE IF IN DEVELOPMENT MODE
@ini.link('PERSON')
class Person():
name : str
age : int
amount : float
friends: tuple = ','
dob : datetime = "%Y-%m-%d"
@ini.link('CONFIG')
class Config():
ip : str
path : str
print(Person.name)
print(Person.age)
print(Config.ip)
print(Config.path)
```
##### output
```py
#==================== IN PRD
myName
31
<some_ip>
<some_path>
#==================== IN DEV
myOtherName
16
<some_ip>
<some_path>
```
Change Log
==========
1.0.0 (2023-04-26)
------------------
- First Release
1.0.1 (2023-04-26)
------------------
- Bug Fixed
1.0.2 (2023-04-26)
------------------
- Upercase Bug Fixed
1.0.3 (2023-04-26)
------------------
- Upercase Write Bug Fixed
1.0.4 (2023-04-28)
------------------
- Update Class bug fixed
1.0.6 (2023-04-28)
------------------
- empty_as_null
1.0.7 (2023-04-28)
------------------
- changing enviornment
Raw data
{
"_id": null,
"home_page": null,
"name": "iniUts",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "iniUts",
"author": "Melque Lima",
"author_email": "melque_ex@yahoo.com.br",
"download_url": "https://files.pythonhosted.org/packages/e8/78/90121611f255f07dd2156c97246acf1c08f25fac22602a5605072e639601/iniUts-1.1.8.tar.gz",
"platform": null,
"description": "# Ini Uts\r\n#\r\n### Installation\r\n\r\n```sh\r\npip install iniUts\r\n```\r\n\r\n## Usage\r\n#\r\n<!-- //==================================================== -->\r\n## read\r\n##### test.ini file\r\n```ini\r\n[Person]\r\nname = myname\r\nage = 31\r\namount = 20.3\r\nfriends = friend1,friend2,friend3\r\ndob = 1991-12-23\r\n```\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\n\r\nini = IniUts('test.ini')\r\ndata = ini.read('Person','name')\r\n\r\nprint(result)\r\n```\r\n##### output\r\n```py\r\n\"myname\"\r\n```\r\n\r\n<!-- //==================================================== -->\r\n## write\r\n##### test.ini file\r\n```ini\r\n[PERSON]\r\nname = myname\r\n```\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\n\r\nini = IniUts('test.ini')\r\nini.write('PERSON','last_name','mylastname')\r\n\r\n```\r\n##### test.ini file\r\n```ini\r\n[PERSON]\r\nname = myname\r\nlast_name = mylastname\r\n```\r\n<!-- //==================================================== -->\r\n## getKeys\r\n##### test.ini file\r\n```ini\r\n[PERSON]\r\nname = myname\r\nlast_name = mylastname\r\n```\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\n\r\nini = IniUts('test.ini')\r\nkeys = ini.getKeys(\"PERSON\")\r\nprint(keys)\r\n```\r\n##### output\r\n```py\r\n['name','last_name']\r\n```\r\n\r\n<!-- //==================================================== -->\r\n## Section2Dict\r\n##### test.ini file\r\n```ini\r\n[PERSON]\r\nname = myname\r\nage = 31\r\namount = 20.3\r\nfriends = friend1,friend2,friend3\r\ndob = 1991-12-23\r\n```\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\n\r\nini = IniUts('test.ini')\r\nini.Section2Dict('PERSON')\r\nprint(Person)\r\n\r\n```\r\n##### output\r\n```py\r\n{\r\n \"name\" = \"myname\"\r\n \"age\" = \"31\"\r\n \"amount\" = \"20.3\"\r\n \"friends\" = \"friend1,friend2,friend3\"\r\n \"dob\" = \"1991-12-23\"\r\n}\r\n\r\n```\r\n<!-- //==================================================== -->\r\n## link\r\n##### test.ini file\r\n```ini\r\n[PERSON]\r\nname = myname\r\nage = 31\r\namount = 20.3\r\nfriends = friend1,friend2,friend3\r\ndob = 1991-12-23\r\n```\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\nfrom datetime import datetime\r\nfrom dataclasses import dataclass\r\n\r\nini = IniUts('test.ini')\r\n\r\n@ini.link('PERSON')\r\nclass Person():\r\n name : str\r\n age : int\r\n amount : float\r\n friends: tuple = ','\r\n dob : datetime = \"%Y-%m-%d\"\r\n\r\nprint(Person.name)\r\nprint(Person.age)\r\nprint(Person.amount)\r\nprint(Person.friends)\r\nprint(Person.dob)\r\n\r\n```\r\n##### output\r\n```py\r\nmyname\r\n31\r\n20.3\r\n(\"friend1\",\"friend2\",\"friend3\")\r\ndatetime.datetime(1991, 12, 2, 0, 0)\r\n\r\n```\r\n\r\n# ENVIORNMENT CHANGING\r\n\r\n<!-- //==================================================== -->\r\n## Link\r\n##### prd.ini file\r\n```ini\r\n[PERSON] \r\nname = myName # Will be changed in DEV\r\nage = 31\r\namount = 20.3\r\nfriends = friend1,friend2,friend3\r\ndob = 1991-12-23\r\n\r\n[CONFIG]\r\nip = <some_ip>\r\npath = <some_path> # Will be changed in DEV\r\n\r\n```\r\n##### dev.ini file\r\n```ini\r\n[PERSON] #change only PERSON name\r\nname = myOtherName\r\n\r\n[CONFIG] #change only CONFIG path\r\npath = <another_path>\r\n\r\n```\r\n\r\n##### python code\r\n```py\r\nfrom iniUts import IniUts\r\nfrom datetime import datetime\r\nfrom dataclasses import dataclass\r\n\r\nini = IniUts('prd.ini','dev.ini',in_prd=True) #CHANGE S WILL BE MADE IF IN DEVELOPMENT MODE\r\n\r\n@ini.link('PERSON')\r\nclass Person():\r\n name : str\r\n age : int\r\n amount : float\r\n friends: tuple = ','\r\n dob : datetime = \"%Y-%m-%d\"\r\n\r\n@ini.link('CONFIG')\r\nclass Config():\r\n ip : str\r\n path : str\r\n\r\n\r\nprint(Person.name)\r\nprint(Person.age)\r\nprint(Config.ip)\r\nprint(Config.path)\r\n\r\n```\r\n##### output\r\n```py\r\n#==================== IN PRD\r\nmyName\r\n31\r\n<some_ip>\r\n<some_path>\r\n#==================== IN DEV\r\nmyOtherName\r\n16\r\n<some_ip>\r\n<some_path>\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\nChange Log\r\n==========\r\n\r\n1.0.0 (2023-04-26)\r\n------------------\r\n- First Release\r\n\r\n1.0.1 (2023-04-26)\r\n------------------\r\n- Bug Fixed\r\n\r\n1.0.2 (2023-04-26)\r\n------------------\r\n- Upercase Bug Fixed\r\n\r\n1.0.3 (2023-04-26)\r\n------------------\r\n- Upercase Write Bug Fixed\r\n\r\n1.0.4 (2023-04-28)\r\n------------------\r\n- Update Class bug fixed\r\n\r\n1.0.6 (2023-04-28)\r\n------------------\r\n- empty_as_null\r\n\r\n\r\n1.0.7 (2023-04-28)\r\n------------------\r\n- changing enviornment\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Ini file manipulator",
"version": "1.1.8",
"project_urls": null,
"split_keywords": [
"iniuts"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e87890121611f255f07dd2156c97246acf1c08f25fac22602a5605072e639601",
"md5": "def3442ad631dcc302c85d8701e5509f",
"sha256": "41e4f03176c8f79aafa2f144a0c98803a708cd90e448b56b97b67b1a9c5392d4"
},
"downloads": -1,
"filename": "iniUts-1.1.8.tar.gz",
"has_sig": false,
"md5_digest": "def3442ad631dcc302c85d8701e5509f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2149464,
"upload_time": "2024-04-16T22:56:35",
"upload_time_iso_8601": "2024-04-16T22:56:35.219507Z",
"url": "https://files.pythonhosted.org/packages/e8/78/90121611f255f07dd2156c97246acf1c08f25fac22602a5605072e639601/iniUts-1.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-16 22:56:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "iniuts"
}