kmisc


Namekmisc JSON
Version 2.1.124 PyPI version JSON
download
home_pagehttps://github.com/kagepark/kmisc
SummaryEnginering useful library
upload_time2025-07-28 16:12:32
maintainerNone
docs_urlNone
authorKage Park
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Open Kage's useful tools and class to public.
(Long time used and upgraded)
But, this is develope version.
So, suddenly it will be big change when I got some more good idea.
I re-groupped to library.
and change name to klib

# Install
```javascript
pip3 install kmisc
```

# Import functions

# Custom Dictionary Class

Convert Dictionary to Object style Dictionary
## Contents
1. Create tree type items 
1. Added New commands
   1. Put()    : Put value at a item
   1. Get()    : Get value of item
   1. Del()    : Delete item
   1. Update() : Update value at item
   1. Print()  : Print dictionary 
   1. Diff()   : Compare two dictionary
   1. Check()  : Check put the value is same as the item(key)'s value
   1. List()   : Return list of keys value 
   1. Proper() : Show/Set/Update property at the item.
   1. Find()   : Find data in the dictionary
   1. Load()   : Load saved data from file
   1. Save()   : dictionary save to file
   1. Sort()   : Sort dictionary
   1. FirstKey(): Get first Key 
   1. FirstKey(): Get first Key 
1. Added property at each key

- Initialize dictionary 


```javascript
from kmisc import kDict
root=kDict.kDict()
```

```javascript
from kmisc import kDict
>>> test={
      'a':123,
      'b':{
         'c':{'ddd'},
         'e':{}
      }
    }
root=kDict.kDict(test)
```

- Add new data

```javascript
>>> root.tree.apple.color='red'
```
or

```javascript
>>> root.tree.apple.Put('color','red')
```
or
```javascript
>>> root.tree.apple['color']='red'
```
- Get data
```javascript
>>> root.tree.apple.color.Get()
```
or
```javascript
>>> root.tree.apple.Get('color')
```
- Print dictionary
```javascript
>>> root.Print()
>>> root.tree.Print()
```
- Set property at Apple's color

  - Set readonly
```javascript
>>> root.tree.apple.color.Proper('readonly',True)
```
  - Try change data
```javascript
>>> root.tree.apple.Put('color','white')
item is readonly

>>> root.tree.Print()
{'color': {'._d': 'red', '._p': {'readonly': True}}}
```
  - Unset readonly
```javascript
>>> root.tree.apple.color.Proper('readonly',False)
```
  - Try change data
```javascript
>>> root.tree.apple.Put('color','white')
>>> root.tree.Print()
{'color': {'._d': 'red', '._p': {'readonly': True}}}
```
Sample Dictionary:
```javascript
{'a': 123,
 'b': {'c': set(['ddd']), 'e': {}, 'z': 123},
 'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},
          'banana': {'banana2': {'._d': 'white', '._p': {}},
                     'banana3': {'._d': 'yellow', '._p': {}},
                     'color': {'._d': 'yellow', '._p': {'readonly': True}}},
          'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}
```
  - Find readonly property item path
```javascript
>>> root.Find('readonly',property=True)
['tree/banana/color']
```
  - Find apple key path
```javascript
>>> root.Find('apple',mode='key')
['tree/apple']
```
  - Find white color data path
```javascript
>>> root.Find('white')
['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']
```
  - Find 123 data path
```javascript
>>> root.Find('white')
['a', 'b/z']
```
  - Find white color data path in key and value
```javascript
>>> root.Find('yellow',mode='all')
['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']
```
  - Save Data (always use root if not then save partial data)
```javascript
>>> from kmisc import kDict
>>> kDict.kDict._dfile_='<dict file name>'
>>> root.Save()
```
  - Load Data (always use root if not then load at key)
```javascript
>>> from kmisc import kDict
>>> kDict.kDict._dfile_='<dict file name>'
>>> root.Load()
```
# MISC functions
Useful commands

Type : Similar as isinstance(<obj>,(chk,type))
```javascript
>>> import kmisc as km
>>> km.Type('abc','str')
>>> True
>>> km.Type('abc',str)
>>> True
```

Copy: copy data for list,dict,str,int,tuple...

```javascript
>>> new_data=Copy(<data>)
```

Join : Similar as os.path().join()
Joining data of bytes,string,....

Next: Get data from list,tuple,dict,string

Delete : Delete data in list,tuple,dict,str

COLOR : class for console,html color string

FIND : find string or format data 

DIFF : diff between data

LIST : handle list()

STR: handle string

TIME : handle time formats

SHELL : handle command run,progress,....

BYTES: handle byte data

CONVERT : data converter

MAC : handle mac address

VERSION : handle version

IP : handle IP address

GET: getting data from anywhere

IS: check the data 

LOG: handle log data

HOST:  handle Host Information

FILE: handle File (Read/Write)

WEB: handle web protocol data

EMAIL: handle email data

ANSI : handle hansi data

Multiprocessor : handle multi processing

FUNCTION: handle function information

SCREEN: handle ipmi SOL

CLI : handle Command Line Interface 

Cut: cutting string to format

Get: Getting data from anywhere

Replace : replace string data

Insert : add data 

Update: update data

printf : similar as printf in c

sprintf : similar as sprintf in c

Sort : sorting data

findXML : Get XML data

cat : similar as linux cat command

ls : similar as linux ls command

IsSame: check both data is same or not

etc...



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kagepark/kmisc",
    "name": "kmisc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Kage Park",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c9/40/9627ba7b4648f39c79b9258011356cfde075b12912220a0633fdf8e34d64/kmisc-2.1.124.tar.gz",
    "platform": null,
    "description": "Open Kage's useful tools and class to public.\n(Long time used and upgraded)\nBut, this is develope version.\nSo, suddenly it will be big change when I got some more good idea.\nI re-groupped to library.\nand change name to klib\n\n# Install\n```javascript\npip3 install kmisc\n```\n\n# Import functions\n\n# Custom Dictionary Class\n\nConvert Dictionary to Object style Dictionary\n## Contents\n1. Create tree type items \n1. Added New commands\n   1. Put()    : Put value at a item\n   1. Get()    : Get value of item\n   1. Del()    : Delete item\n   1. Update() : Update value at item\n   1. Print()  : Print dictionary \n   1. Diff()   : Compare two dictionary\n   1. Check()  : Check put the value is same as the item(key)'s value\n   1. List()   : Return list of keys value \n   1. Proper() : Show/Set/Update property at the item.\n   1. Find()   : Find data in the dictionary\n   1. Load()   : Load saved data from file\n   1. Save()   : dictionary save to file\n   1. Sort()   : Sort dictionary\n   1. FirstKey(): Get first Key \n   1. FirstKey(): Get first Key \n1. Added property at each key\n\n- Initialize dictionary \n\n\n```javascript\nfrom kmisc import kDict\nroot=kDict.kDict()\n```\n\n```javascript\nfrom kmisc import kDict\n>>> test={\n      'a':123,\n      'b':{\n         'c':{'ddd'},\n         'e':{}\n      }\n    }\nroot=kDict.kDict(test)\n```\n\n- Add new data\n\n```javascript\n>>> root.tree.apple.color='red'\n```\nor\n\n```javascript\n>>> root.tree.apple.Put('color','red')\n```\nor\n```javascript\n>>> root.tree.apple['color']='red'\n```\n- Get data\n```javascript\n>>> root.tree.apple.color.Get()\n```\nor\n```javascript\n>>> root.tree.apple.Get('color')\n```\n- Print dictionary\n```javascript\n>>> root.Print()\n>>> root.tree.Print()\n```\n- Set property at Apple's color\n\n  - Set readonly\n```javascript\n>>> root.tree.apple.color.Proper('readonly',True)\n```\n  - Try change data\n```javascript\n>>> root.tree.apple.Put('color','white')\nitem is readonly\n\n>>> root.tree.Print()\n{'color': {'._d': 'red', '._p': {'readonly': True}}}\n```\n  - Unset readonly\n```javascript\n>>> root.tree.apple.color.Proper('readonly',False)\n```\n  - Try change data\n```javascript\n>>> root.tree.apple.Put('color','white')\n>>> root.tree.Print()\n{'color': {'._d': 'red', '._p': {'readonly': True}}}\n```\nSample Dictionary:\n```javascript\n{'a': 123,\n 'b': {'c': set(['ddd']), 'e': {}, 'z': 123},\n 'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},\n          'banana': {'banana2': {'._d': 'white', '._p': {}},\n                     'banana3': {'._d': 'yellow', '._p': {}},\n                     'color': {'._d': 'yellow', '._p': {'readonly': True}}},\n          'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}\n```\n  - Find readonly property item path\n```javascript\n>>> root.Find('readonly',property=True)\n['tree/banana/color']\n```\n  - Find apple key path\n```javascript\n>>> root.Find('apple',mode='key')\n['tree/apple']\n```\n  - Find white color data path\n```javascript\n>>> root.Find('white')\n['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']\n```\n  - Find 123 data path\n```javascript\n>>> root.Find('white')\n['a', 'b/z']\n```\n  - Find white color data path in key and value\n```javascript\n>>> root.Find('yellow',mode='all')\n['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']\n```\n  - Save Data (always use root if not then save partial data)\n```javascript\n>>> from kmisc import kDict\n>>> kDict.kDict._dfile_='<dict file name>'\n>>> root.Save()\n```\n  - Load Data (always use root if not then load at key)\n```javascript\n>>> from kmisc import kDict\n>>> kDict.kDict._dfile_='<dict file name>'\n>>> root.Load()\n```\n# MISC functions\nUseful commands\n\nType : Similar as isinstance(<obj>,(chk,type))\n```javascript\n>>> import kmisc as km\n>>> km.Type('abc','str')\n>>> True\n>>> km.Type('abc',str)\n>>> True\n```\n\nCopy: copy data for list,dict,str,int,tuple...\n\n```javascript\n>>> new_data=Copy(<data>)\n```\n\nJoin : Similar as os.path().join()\nJoining data of bytes,string,....\n\nNext: Get data from list,tuple,dict,string\n\nDelete : Delete data in list,tuple,dict,str\n\nCOLOR : class for console,html color string\n\nFIND : find string or format data \n\nDIFF : diff between data\n\nLIST : handle list()\n\nSTR: handle string\n\nTIME : handle time formats\n\nSHELL : handle command run,progress,....\n\nBYTES: handle byte data\n\nCONVERT : data converter\n\nMAC : handle mac address\n\nVERSION : handle version\n\nIP : handle IP address\n\nGET: getting data from anywhere\n\nIS: check the data \n\nLOG: handle log data\n\nHOST:  handle Host Information\n\nFILE: handle File (Read/Write)\n\nWEB: handle web protocol data\n\nEMAIL: handle email data\n\nANSI : handle hansi data\n\nMultiprocessor : handle multi processing\n\nFUNCTION: handle function information\n\nSCREEN: handle ipmi SOL\n\nCLI : handle Command Line Interface \n\nCut: cutting string to format\n\nGet: Getting data from anywhere\n\nReplace : replace string data\n\nInsert : add data \n\nUpdate: update data\n\nprintf : similar as printf in c\n\nsprintf : similar as sprintf in c\n\nSort : sorting data\n\nfindXML : Get XML data\n\ncat : similar as linux cat command\n\nls : similar as linux ls command\n\nIsSame: check both data is same or not\n\netc...\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Enginering useful library",
    "version": "2.1.124",
    "project_urls": {
        "Homepage": "https://github.com/kagepark/kmisc"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52af420c1f8aa429e981c3cb3256f3d3b8435be8b0a0e4c29ccab05a1087cc09",
                "md5": "c3ac856b99cc448efa79ab3eef974b81",
                "sha256": "32244598aac71b49f15bf97788e4dccc72639bf3f4efbd6343e8e750eb4d78a9"
            },
            "downloads": -1,
            "filename": "kmisc-2.1.124-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3ac856b99cc448efa79ab3eef974b81",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 40656,
            "upload_time": "2025-07-28T16:12:31",
            "upload_time_iso_8601": "2025-07-28T16:12:31.011579Z",
            "url": "https://files.pythonhosted.org/packages/52/af/420c1f8aa429e981c3cb3256f3d3b8435be8b0a0e4c29ccab05a1087cc09/kmisc-2.1.124-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9409627ba7b4648f39c79b9258011356cfde075b12912220a0633fdf8e34d64",
                "md5": "4a83aa8702c0ec28d9f847b8e5350f6c",
                "sha256": "4af8476873d29a1662de3523e4a4c3889c4ea5d1ea7af16175faa9fcc05d98f2"
            },
            "downloads": -1,
            "filename": "kmisc-2.1.124.tar.gz",
            "has_sig": false,
            "md5_digest": "4a83aa8702c0ec28d9f847b8e5350f6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 43420,
            "upload_time": "2025-07-28T16:12:32",
            "upload_time_iso_8601": "2025-07-28T16:12:32.016743Z",
            "url": "https://files.pythonhosted.org/packages/c9/40/9627ba7b4648f39c79b9258011356cfde075b12912220a0633fdf8e34d64/kmisc-2.1.124.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 16:12:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kagepark",
    "github_project": "kmisc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "kmisc"
}
        
Elapsed time: 1.32304s