Skip to main content

Jangli

Scope

  • Data Definition
  • Data mapping

Convert json to python object

Convert json or dict to model object.

Supports

  • dict
  • json
  • json dumps
from jangli.json_to_object import json_to_obj

data = '{"password": "123456", "id": 1, "name": "john"}'



class Student:
    def __init__(self):
        self.id = None
        self.name = None
        self.password = None


s = json_to_obj(data, Student)
print(s.name)

Convert json to python object with static variable

Convert json or dict to model object. Class containing static variables

Supports

  • dict
  • json
  • json dumps
from jangli.json_to_object import json_to_obj

data_2 = '{"password": "123456", "id": 1, "name": "john", "school" : "SOHS"}'


class Student:
    school = None

    def __init__(self):
        self.id = None
        self.name = None
        self.password = None


s2 = json_to_obj(data_2, Student)
print(s2.school)

Custom object list

Create list of similar object. Pass a model which you want create a list. It only allows model objects which model passed whle creating list of objects.

from jangli.list_of_object import ListObject


class A:
    def __init__(self, b):
        self.b = b


lt = ListObject(A)
lt.append(A(7))
lt.insert(1, A(8))

print(lt)

Output : [<__main__.A object at 0x00CA3730>, <__main__.A object at 0x00CC6E10>]

Case Change to CamelCase

Converter snack case to camel case.

from jangli.case_type import CamelCase


@CamelCase
class NewClass:

    def __init__(self):
        self.a = 7
        self.b = "hi"
        self.c = True
        self._from = None


new = NewClass()

print(new.__dict__)

String of None to None

Change string of None to None,

EX :

String of None is : x = 'None'

After change : x = None

from jangli.checker.none_checker import NoneChecker

@NoneChecker
class A:

    def __init__(self):
        self.b = 8
        self.c = "None"
        self.d = True


print(A().__dict__)
>>> {'b': 8, 'c': None, 'd': True}

Re-Try Function

If a function failed one or many times, you can retry N no. of times just by passing retry_value = ?.

If retry_value = 1

A function will execute ones, mean while any error any occurring function will through exception.

@Retry(retry_value=1)
def x_fun():
    print("Function is executing ones")

If retry_value = 2

A function will execute twice if first execution fails else only ones.

@Retry(retry_value=2)
def x_fun():
    print("raise exception")
    raise Exception("Try twice")

If retry_value = 0

A function is disabled and could not execute the function.

@Retry(retry_value=0)
def x_fun():
    print("Function is disabled")

MIT License : Copyright (c) 2019 Abhimanyu Haralukallu

Metadata

Release files for jangli 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jangli 1.2.1
File Size Uploaded Provenance Actions
jangli-1.2.1.tar.gz 3.7 kB Without provenance Details for jangli-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jangli 1.2.1
File Interpreter ABI Platform Actions
jangli-1.2.1-py3-none-any.whl Python 3 none any Details for jangli-1.2.1-py3-none-any.whl

Total release size: 8.8 kB

Release files / jangli-1.2.1.tar.gz

Download URL jangli-1.2.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a3e4bc3e7f3be327d79f43d744d162a4daf273de91054fe220459917ec444e93
BLAKE2b-256 checksum
How to use checksums
b4d6103258b7713443e453f4077151f1fcb1e868b3d0f18fed1c5880f4e0f9d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.19.1 CPython/3.7.2

Release files / jangli-1.2.1-py3-none-any.whl

Download URL jangli-1.2.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dde3e23d5060087f7061b587a19d7bb0b00c291810c4af281606bdb492e26314
BLAKE2b-256 checksum
How to use checksums
73ce5d5ea21d6af0a06ea8cc2c50a32e56e01c975cb405684ae8719460d94ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.19.1 CPython/3.7.2

Security for jangli 1.2.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page