Skip to main content

kvk file handler

Project description

KvK

KvK file handler

Installation:

$ pip install kvk

KvK file example (file.kvk):

<#
    class "example" ::>
        (id) -> "0"
        (available) -> "true"
    class "anotherExample" ::>
        (id) -> "1"
        (accessible) -> "true"
#>

Creation of KvK object:

import kvk
fileHandler = kvk.KvK('file.kvk')

Read a KvK file:

fileHandler.read()
# output: [{'example':{'id':'0', 'available':'true'}}, {'anotherExample':{'id':'1', 'accessible':'true'}}]

Write a KvK file:

fileHandler.write(content=[{'newClass':{'id':'2', 'trust':'true'}}, {'anotherNewClass':{'id':'3', 'available':'true'}}]
  • The file content is removed and replaced with the new content

Get a class or an attribute from file:

fileHandler.get(element='newClass')
# output: {'id':'2', 'trust':'true'}

fileHandler.get(element='id', className='anotherNewClass')
# output: 3

Add a class:

fileHandler.addClass(className='addedClass')
  • Adds the class to the end of the file

Add an attribute:

fileHandler.addAttr(className='addedClass', attrName='addedAttribute', attrContent='first')
  • The attributes are added at the top of the class, before the existing arguments

Edit a class:

fileHandler.editClass(oldClassName='addedClass', newClassName='editedClass')

Edit an attribute:

fileHandler.editAttr(className='editedClass', oldAttrName='addedAttribute', newAttrName='editedAttribute', attrContent='alwaysFirst')
  • Changing the attribute content is not required

Remove a class:

fileHandler.removeClass(className='editedClass')
  • Removes both class and related attributes

Remove an attribute:

fileHandler.removeAttr(className='anotherNewClass', attrName='available')

Check if empty or not

fileHandler.isEmpty()
# output: False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kvk-1.3.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

kvk-1.3.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file kvk-1.3.2.tar.gz.

File metadata

  • Download URL: kvk-1.3.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for kvk-1.3.2.tar.gz
Algorithm Hash digest
SHA256 87c3ebe39781fdf844b1825f1bf474865d90889c71bbf4176bffc5af2e8ceb31
MD5 416706e92eabb8ce02b7800a7d855a8b
BLAKE2b-256 781b99bbcb3a7e0357b9fbaf5f6f7dce1900cbcf407d80e8564353d168616748

See more details on using hashes here.

File details

Details for the file kvk-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: kvk-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for kvk-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 519fabc176b8c78afa8c4afd54307e53737dc878a3f412f5fd92e53359c2ea38
MD5 a09e606bec38636233b779dff31a3d00
BLAKE2b-256 ec274ac5c84e67b4b52514ed0e59ab9719dcb544421adcef18a5525a1897cc62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page