Saravanan666/pypi-org huggingface dataset:
Package: json_logic_qubit
This parser acceptsJsonLogicrules and
executes them in Python.This is a Python porting of the excellent GitHub project byjwadhamsfor JavaScript:json-logic-js.All credit goes to him, this is simply an implementation of the same
logic in Python (small differences below).The JsonLogic format is designed to allow you to share rules (logic)
between front-end and back-end code (regardless of language difference),
even to store logic along with a record in a database. JsonLogic is
documented extensively atJsonLogic.com,
including examples of everysupported
operationand a place totry
out rules in your browser.The same format can also be executed in PHP by the libraryjson-logic-phpExamplesSimplefromjson_logicimportjsonLogicjsonLogic({"==":[1,1]})# TrueThis is a simple test, equivalent to1 == 1. A few things about the
format:The operator is always in the “key” position. There is only one key
per JsonLogic rule.The values are typically an array.Each value can be a string, number, boolean, array (non-associative),
or nullCompoundHere we’re beginning to nest rules.jsonLogic({"and":[{">":[3,1]},{"<":[1,3]}]})# TrueIn an infix language (like Python) this could be written as:((3>1)and(1<3))Data-DrivenObviously these rules aren’t very interesting if they can only take
static literal data. TypicallyjsonLogicwill be called with a rule
object and a data object. You can use thevaroperator to get
attributes of the data object:jsonLogic({"var":["a"]},# Rule{a:1,b:2}# Data)# 1If you like, we supportsyntactic
sugaron unary
operators to skip the array around values:jsonLogic({"var":"a"},{a:1,b:2})# 1You can also use thevaroperator to access an array by numeric
index:jsonLogic({"var":1},["apple","banana","carrot"])# "banana"Here’s a complex rule that mixes literals and data. The pie isn’t ready
to eat unless it’s cooler than 110 degrees,andfilled with apples.rules={"and":[{"<":[{"var":"temp"},110]},{"==":[{"var":"pie.filling"},"apple"]}]}data={"temp":100,"pie":{"filling":"apple"}}jsonLogic(rules,data)# TrueAlways and NeverSometimes the rule you want to process is “Always” or “Never.” If the
first parameter passed tojsonLogicis a non-object,
non-associative-array, it is returned immediately.#AlwaysjsonLogic(True,data_will_be_ignored);# True#NeverjsonLogic(False,i_wasnt_even_supposed_to_be_here);# FalseInstallationThe best way to install this library is viaPIP:pipinstalljson-logic-qubit
Package: json-log-viewer
JSON Log ViewerA simple tool to extra JSON logs from files, merge them, and display them in an
easy-to-read format.Installationpip install json-log-viewerUsagejlv <FILE1> <FILE2>File FormatThe script expects a file containing JSON objects, any other content will be ignored.Each JSON object must contain the following fields:levela log level, any ofDEBUG,INFO,WARNorERRORmessagethe log messagetimestampthe logs time stampAny additional fields are displayed as part of the log.
Package: jsonLookup
jsonLookupSearching in MySQL JSON field in DjangoChallengeMySQL has introduced JSON fields in MySQL Server 5.7, Currently it works well withjsonfieldfor Data Saving and retrieval. The problem that Searching can only be done through LIKE operator which isn't convinent for all function.ObjectiveCreating a new custom lookup operator "has" for Django that will support JSON Search in MySQL.InstallationInstall the Package$pipinstalljsonLookupRegister to JSONFieldsfromjsonLookupimporthasLookup,jcontainsLookupJSONField.register_lookup(hasLookup)JSONField.register_lookup(jcontainsLookup)Write your JSON queries# Create test objectsUser.objects.create(name="Ahmed",properties={"city":"Giza","Address":{"district":"Ahram","Code":11263}})User.objects.create(name="Mohamed",properties={"city":"Cairo","Address":{"district":"Helipolis","Code":11351}})# Run first queryq=User.objects.filter(properties__has="$.city=Giza")printq[0].name"Ahmed"# Run Second queryq=User.objects.filter(properties__has="$.Address.Code=11351")printq[0].name"Mohamed"
Package: jsonl-to-conll
A simple tool to convert JSONL to CONLLInstallationTo install, runpip3install--userjsonl-to-conllUsageSample Usagejsonl-to-conllinput.jsonloutput.conllDocumentationusage:jsonl-to-conll[-h]input_filenameoutput_filenamejsonl-to-conll:error:thefollowingargumentsarerequired:input_filename,output_filename
Package: jsonly
Jsonly누구나 데이터베이스 활용을누구나 데이터베이스를 사용할 수 있어요!여러가지 데이터베이스를 쉽게 활용할 수 있어요!지원 파일 : .json / .db자세한 사용법은 여기를 참조해주세요!Installation$ pip install jsonlyExampleDATA#data.json(default){"기본":{"사과":"애플"},"하나":"일","둘":"이"}GET데이터를 불러올 때 사용하는 메소드# get.pyfromjsonly.clientimportUseJsonlyjsonly=UseJsonly(path="data.json")print(jsonly.get(path="기본/사과"))# result
>>> 애플SET데이터를 덮어씌울 때 사용하는 메소드# set.pyfromjsonly.clientimportUseJsonlyjsonly=UseJsonly(path="data.json")data={"기본중에":"기본"}print(jsonly.set(data=data))# result
>>> True#data.json(modifiedfromdefault){"기본중에":"기본"}UPDATE데이터를 루트 경로에 추가할 때 사용하는 메소드# update.pyfromjsonly.clientimportUseJsonlyjsonly=UseJsonly(path="data.json")data={"새로운":"데이터"}print(jsonly.update(data=data))# result
>>> True#data.json(modifiedfromdefault){"기본":{"사과":"애플"},"하나":"일","둘":"이","새로운":"데이터"}INSERT데이터를 특정 경로에 추가할 때 사용하는 메소드# insert.pyfromjsonly.clientimportUseJsonlyjsonly=UseJsonly(path="data.json")data={"데이터":"삽입"}print(jsonly.insert(data=data,path='기본'))# result
>>> True#data.json(modifiedfromdefault){"기본":{"데이터":"삽입"},"하나":"일","둘":"이",}
Package: jsonmanager
jsonmanageris validation, coercion, and forms for JSON.Features include:
- JSON validation
- JSON forms
- JSON form validation
- JSON validators
- JSON coercion
- JSON schemasPython 3.x is supported. Python 2.7.x is not yet supported.For more information aboutjsonmanager, see the project’s github page:github.com/jmatthias/jsonmanager
Package: json-mapper
# About json-mapperPackage for map and parse JSON text to python dict.For example, to bring to readable form of responses from the Rest API.# Usage exampleSuppose we have such a terrible JSON dump:```python{"ApiResponse": {"ApiResponseWrapper": {"HotelsResponse": [{"Country": "Russia","HotelId": "1234","HotelName": "Space Hotel","Photos": [{"BigUrl": "http://www.image.url.com","ThumbnailUrl": "http://www.image.url.com"},... other photos ...],"RoomsResponse": [{"BedsCount": "1","RoomId": "12312"},... other rooms ...]},... other hotels ...],"ResponseTimestamp": "2342423423423423","SessionId": "0ABAA840-F6EC-6913-A1C2-7341899060B6"},"SomeProperty": "SomeData"}}```Example to map the his pretty:```pythonimport jsonfrom json_mapper.mapper import map_jsonjson_data = json.loads(open('dump.json').read())mapping_config = {'ApiResponse.ApiResponseWrapper': {'ResponseTimestamp': 'last_update','{loop=>hotels} HotelsResponse': {'HotelId':  'id','Country':  'country','{loop=>photos} Photos': 'BigUrl','{loop=>rooms} RoomsResponse': {'RoomId':       'id','BedsCount':    'beds'}}}}result = map_json(mapping_config, json_data)>>> pprint(result){'hotels': [{'country': u'Russia','id': u'1234','photos': [u'http://www.image.url.com',u'http://www.image.url.com'],'rooms': [{'beds': u'1', 'id': u'12312'},{'beds': u'1', 'id': u'12312'}]},{'country': u'Russia','id': u'1234','photos': [u'http://www.image.url.com',u'http://www.image.url.com'],'rooms': [{'beds': u'1', 'id': u'12312'},{'beds': u'1', 'id': u'12312'}]}],'last_update': u'2342423423423423'}```See full example in tests directory.
Package: jsonmapping
# jsonmapping [![Build Status](https://travis-ci.org/pudo/jsonmapping.svg?branch=master)](https://travis-ci.org/pudo/jsonmapping)To transform flat data structures into nested object graphs matching JSONschema definitions, this package defines a mapping language. It defines howthe columns of a source data set (e.g. a CSV file, database table) are to beconverted to the fields of a JSON schema.The format allows mapping nested structures, including arrays. It also supportsthe application of very basic data transformation steps, such as generating aURL slug or hashing a column value.## Example mappingThe mapping format is independent of any particular JSON schema, such thatmultiple mappings could be defined for any one particular schema.```json{"schema": {"$ref": "http://www.popoloproject.com/schemas/person.json"},"mapping": {"id": {"column": "person_id"},"name": {"column": "person_name"},"memberships": [{"mapping": {"role": {"default": "Member of Organization"},"organization": {"mapping": {"id": {"columns": ["org_id"],"constant": "default-org"},"name": {"column": "org_name","constant": "Default Organization","transforms": ["strip"]}}}}}]}}```This mapping would apply to a four-column CSV file and map it to a set ofnested JSON objects (a [Popolo](http://www.popoloproject.com/) person, with amembership in an organization).## Data TransformsWhile ``jsonmapping`` is not a data cleaning tool, it supports some very basicdata transformation operations that can be applied on a particular column orset of columns. These include:* ``coalesce``: Select the first non-null value from the list of items.* ``slugify``: Transform each string into a URL slug form.* ``join``: Merge together the string values of all selected columns.* ``upper``: Transform the text to upper case.* ``lower``: Transform the text to lower case.* ``strip``: Remove leading and trailing whitespace.* ``hash``: Generate a SHA1 hash of the given value.## Usage``jsonmapping`` is available on the Python Package Index:```bash$ pip install jsonmapping```The library can then be used as follows:```pythonfrom jsonschema import RefResolverfrom jsonmapping import Mapper# ... load the mapping ...mapping = load_mapping()resolver = RefResolver.from_schema(mapping)# ... grab some data ...rows = read_csv()objs = []# This will transform flat data rows into nested JSON objects:for obj, err in Mapper.apply_iter(rows, mapping, resolver):if err is None:objs.append(obj)```## TestsThe test suite will usually be executed in it's own ``virtualenv`` and perform acoverage check as well as the tests. To execute on a system with ``virtualenv``and ``make`` installed, type:```bash$ make test```
Package: jsonmask
OverviewImplementsGoogle Partial Response/json-maskin Python.RequirementsPython 2.7Python 3.6+InstallationInstall jsonmask with pip:$pipinstalljsonmaskor directly from the source code:$gitclonehttps://github.com/zapier/jsonmask.git
$cdjsonmask
$pythonsetup.pyinstallUsageAfter installation, the package can imported:$python
>>>importjsonmask
>>>jsonmask.__version__To prune dictionaries:>>>importjsonmask>>>mask=jsonmask.parse_fields('a,b(c,d)')>>>jsonmask.apply_json_mask({'a':{'nested_within_a':True,},'b'{'c':True,'d':{'Will get included?':'Yes'},'e':'Tough luck here',},'c':'Definitely hopeless',},mask,){'a':{'nested_within_a':True,},'b'{'c':True,'d':{'Will get included?':'Yes'},},}
Package: jsonmask-ng
OverviewImplementsGoogle Partial Response/json-maskin Python.jsonmask_ng is a fork ofjsonmaskfrom Zapier that seems discontinued.RequirementsPython 3.7Python 3.8Python 3.9Python 3.10Python 3.11InstallationInstall jsonmask_ng with pip:$pipinstalljsonmask_ngor directly from the source code:$gitclonehttps://github.com/juanyque/jsonmask_ng.git
$cdjsonmask_ng
$pythonsetup.pyinstallUsageAfter installation, the package can imported:$python
>>>importjsonmask_ng
>>>jsonmask_ng.__version__To prune dictionaries:>>>importjsonmask_ng>>>mask=jsonmask_ng.parse_fields('a,b(c,d)')>>>jsonmask_ng.apply_json_mask({'a':{'nested_within_a':True,},'b':{'c':True,'d':{'Will get included?':'Yes'},'e':'Tough luck here',},'c':'Definitely hopeless',},mask,)Output:{'a':{'nested_within_a':True,},'b':{'c':True,'d':{'Will get included?':'Yes'},},}ContributeTo setup an appropriate dev environment:With docker environment availablerun: `./docker_start.sh``run testsmake testClean (test, cache, ...)make cleanClean (test, cache, ... including virtualenv)make clean-all(you will need amake allafter this)Build dist package:make buildSet PyPI credentials:poetry config pypi-token.pypi pypi-xxxxxTOKENXxxx(find token in~/.pypircfile or create a new one onhttps://pypi.org/manage/account/token/)Build dist package:make uploadUtil commands:To fix poetry.lock with minimal changes:poetry lock --no-updateTo fix poetry.lock updating package versions:poetry lock(this could don't work)Afterpoetry lock...probably you will need to domake allto update packages on virtualenv
Package: jsonmason
JsonMasonWhatA utility/library for transforming an object into an editable stream, and reconstructing an object from that stream.
To be precise:Transform an an object of acyclic nested collections into an iterable of assignment operations (deconstruction)Create an object of acyclic nested collections from an iterable of assignment operations (reconstruction)WhyDeconstructing only to reconstruct does not seem very useful in itself. The power is in operating on the intermediary format — the iterable of nodes
lends itself well to pattern matching, transformations, and other forms of computation.HowIn the shellIf you've installed this package (egpipx install jsonmason), then you should have two executables on your$PATH. Both accept JSON on standard input, and print the deconstruction of that JSON on standard output.jsonmason-nodedumpmakes it easy togrepfor patterns - this is a bit likegron, but is intended to make it easy to find patterns for creating transformations in your Python code.jsonmason-jsdumpis even more like , as it prints JS-style assignments that can be pasted straight into a JS console.In Python codeThe basics:from jsonmason import deconstruct, reconstructIn addition there is a moduleattrdictwhich makes it possible to address dicts by "dot-attribute-paths" (as in JS).from jsonmason import AttrDictFor examples, have a look at the module docstrings:libjsonmasonattrdictTestingRuntest.py.
Package: json-matcher
# json_matcherMatch json object with query like elasticsearch/lucene query.examples (jrep)# cat a.txt
{ “foo”: “bar”, “bar”: “foo” }
# jrep “foo:bar” /tmp/a.txt
{ “foo”: “bar”, “bar”: “foo” }examples (json_matcher)>>> import json_matcher
>>> matcher = json_matcher.compile('foo:bar bar:foo')
>>> j = dict(foo='bar', bar='foo')
>>> m = matcher.match(j)
>>> m.groups()
[('foo', 'bar'), ('bar', 'foo')]>>> matcher = json_matcher.compile('foo:>10 bar:foo')
>>> j = dict(foo=11, bar='foo')
>>> matcher.match(j).groups()
[('foo', 11), ('bar', 'foo')]
>>> j = dict(foo=9, bar='foo')
>>> matcher.match(j)
>>> m = matcher.match(j)
>>> print(m)
None>>> json_matcher.match('foo:[10 TO 20] AND bar:foo', dict(foo=11, bar='foo')).groups()
[('foo', 11), ('bar', 'foo')]>>> nested = dict(A=dict(B=dict(C='Hello World')))
>>> json_matcher.match('A.B.C:"Hello World"', nested).groups()
[('A.B.C', 'Hello World')]match text or number with`field_name:value`match regular expression with`field_name:/regularexpression/`match range with`field_name:[10TO 20]`,`field_name:[10TO 20}`(exclusive 20)match range(open range) with`field_name:>20`(like elasticsearch not lucene)match field existence with`_exists_:field_name`match expression with`_expression:"pythonexpression"`TODO:multiple match with high performace (with Ahocorasik and RE2???)
Package: json-merger
Module for merging JSON Objects.Free software: GPLv2 licenseDocumentation:https://pythonhosted.org/json-merger/For the simple use-case:pip installjson-mergerTo install contrib dependencies:pip installjson-merger[contrib]ChangesVersion 0.7.5In dict_merger head is always kept if root matches update.In dict_merger update is always kept if root matches head.Version 0.7.4KEEP_UPDATE_CONFLICT_ON_HEAD_DELETEdoesn’t take the root into account any longer.Version 0.7.3Add new typoe of conflictINSERT.KEEP_HEAD_ENTITIES_CONFLICT_ON_NEW_UPDATEwill create INSERT conflict instead of REMOVE one.Version 0.7.2Add new strategyKEEP_HEAD_ENTITIES_CONFLICT_ON_NEW_UPDATEwhich will create conflict when there is a new value in update.Version 0.7.1Fix bug when DictMergeOps.keep_longest is used inside lists.Version 0.7.0Add a new strategy for conflicts on head delete (contrib).Version 0.6.1Smarter handling of conflicts in case of authors with the same name (contrib).Version 0.6.0Correctly handle unicode in author names (contrib).Version 0.5.2:Fix duplicate patches.Version 0.5.1:Fixpatch_to_conflict_setfor list patches.Version 0.5.0:Conflict methodto_jsonit returns a list of patches conflicts of a single one.Version 0.4.0:It’s now possible to have field- and content- dependent merger operations.Version 0.3.2:Initial public release.
Package: json-merge-tree
json-merge-treeJSON Merge Tree (built on top ofjsonmerge) merges JSON objects in a hierarchy,
allowing customization of how objects are merged.The hierarchy is defined by the caller'sparentsmodule, which specifies a function for each resource type that
returns the parent ID and another function to get its parents (unless it's the top level).It relies on a SQLAlchemyTablecontaining the fieldsid(UUID),resource_id(UUID),resource_type(string),slug(string),
and a field that stores the JSON object you want to merge.InstallationInstall this package, e.g.,pip install json-merge-tree.## merge_tree

Main entrypoint for merging JSON objects in a table up a hierarchy defined by `parents`.

### Example
```python
from json_merge_tree import merge_tree

import widget_service.parents
from widget_service.db import widgets

# Merge widgets of all the requested resource's ancestors and return the result
merged_json = merge_tree(
    table=widgets, 
    id='228135fb-6a3d-4551-93db-17ed1bbe466a', 
    type='brand', 
    json_field='widget', 
    parents=widget_service.parents, 
    slugs=None, 
    debug='annotate'
)mergeGeneric function to merge two JSON objects together. Largely the same asjsonmerge.Merger.mergebut with the added ability to customize how objects are merged with the annotations below.Merge key annotationsYou can append the annotation listed below to a key at any level to customize how its value affects the merged json.--UnsetUnset this key in the merged json. The value of this key does not matter - you can set it tonull.E.g. 1{"colors":{"content":"#000000","section--":null}}merged into{"colors":{"section":"#000001"}}results in{"colors":{"content":"#000000"}}E.g. 2{"styles":{"h1--":null,"h2":{"fontSize":3}}}merged into{"styles":{"h1":{"fontWeight":"heading"}}}results in{"styles":{"h2":{"fontSize":3}}}!ReplaceReplace this key's value with this value.E.g. 1{"colors":{"content":"#000000","section!":"#000002"}}merged into{"colors":{"section":"#000001"}}results in{"colors":{"content":"#000000","section":"#000002"}}E.g. 2{"styles":{"h1!":{"fontFamily":"heading","fontSize":5}}}merged into{"styles":{"h1":{"fontWeight":"heading"}}}results in{"styles":{"h1":{"fontFamily":"heading","fontSize":5}}}SlugsSlugs are kind of a weird feature – and getting weirder as we use them to solve more use cases.Originally, A slug was a named json object scopedundera resource in the hierarchy to be merged. In our case, a custom-page theme merged under one of the resources in our resource hierarchy.The use of slugs has been extended to included named json object mixinsnotassociated with any one resource at the bottom of the hierarchy, but scoped to a resource at any level. For example, a site wants to have a "dark" theme that could be applied to any page within the site.When merging, the library first merges the json objects without slugs,thenmerges json objects with slugs at each level. Multiple slugs can be included when merging.
Package: jsonmetamodel
jsonmetamodeljsonmetamodelis used to provide a definition of struct like classes with direct
type conversion, which are returning aMappingtype likedict.InstallingInstalling the latest release using pip is recommended.$pipinstalljsonmetamodelBasic Usage>>>fromjsonmetamodelimportJsonModel,JsonInteger,JsonString>>>classPerson(JsonModel):...name=JsonString()...age=JsonInteger()...>>>person=Person({"age":"65","name":"Max Power"})>>>personMappingTreeItem({"age":65,"name":"Max Power"})>>>person["age"]65>>>person.age65>>>person.age=66>>>person.age66>>>dict(person){"age":65,"name":"Max Power"}ContributionAny contribution by reporting a bug or desired changes are welcomed. The preferred
way is to create an issue on the gitlab's project page, to keep track of everything
regarding this project.Contribution of Source CodeCode styleThis project follows the recommendations ofPEP8.
The project is usingblackas the code formatter.WorkflowFork the project on Gitlab.Commit changes to your own branch.Submit apull requestfrom your fork's branch to our branch'dev'.AuthorsDavid Scheliga@gitlab@LinkedinInitial workMaintainerLicenseThis project is licensed under the GNU GENERAL PUBLIC LICENSE - see theLICENSEfile for detailsAcknowledgeCode style: blackPurpleBoothKeep a Changelog
Package: jsonmgnt
jsonmgntA simple JSON parsing tool.InstallationInstall it via pip:pipinstalljsonmgntUsageimportjsonmgntdat2=jsonmgnt.parse('{"Invoker": "SunStrike"}')print(dat2['Invoker'])# SunStrikedat1=jsonmgnt.parse('{"Hammer Level": 25}')print(dat1['Hammer Level'])# 25The examples using the find_keys().data=[{"key":1},{"key":2},{"my":{"key":{"chain":"A","rope":5,"string":1.2,"cable":False}}},{"your":{"key":{"chain":"B","rope":7,"string":0.7,"cable":True}}}]p.find_keys(data,['rope','cable'])[[5,False],[7,True]]p.find_keys(data,['rope','cable'],group=False)[5,False,7,True]
Package: jsonml
jsonmlThis library is a python implementation of jsonml.See below for jsonml specifications.http://www.jsonml.org/RequirementPython 3.8+Getting StartedfromjsonmlimportParserparser=Parser()obj=["tag1",["tag2",["tag3","1"]]]tree_1=parser.parse(obj)xml_1=parser.to_xml(tree_1)jsonml=parser.to_jsonml(tree_1)tree_2=parser.parse_from_xml_string(xml_1)assertparser.to_jsonml(tree_2)==jsonml<tag1><tag2><tag3>1</tag3></tag2></tag1>[
  "tag1",
  [
    "tag2",
    [
      "tag3",
      "1"
    ]
  ]
]Contributepoetry install
pre-commit install
source .venv/bin/activate
make
Package: json-model
# Json-ModelJson-Model is simple library to create Json Models from Python Objects. Library supports field validation by Python Types and required fields.# UsageUsage is really simple. Json-Model on this moment supports 7 basics fields:- `Integer`- `String`- `Float`- `List`- `Timestamp`- `Datetime`- `ForeignField`Each field has attribute:- `required` - Boolean attribute in default is set to `False`.- `default` - set default value when field is empty.To start work with JsonModel, create Json-Model class with all fields what you need in Json object.```pythonimport datetimeimport timefrom json_model import fieldsfrom json_model import libsclass Scholarship(libs.JsonModel):amount = fields.Float(required=True)currency = fields.String(default='USD')months = fields.List(required=True)class Student(libs.JsonModel):name = fields.String(required=True)surname = fields.String(required=True)age = fields.Integer()day_of_birth = fields.Datetime()scholarship = fields.ForeignField()created_at = fields.Timestamp()if __name__ == '__main__':scholarship = Scholarship()scholarship.amount = 500.00scholarship.months = [1, 2, 3, 4, 5, 8, 9, 10]student = Student()student.name = "Andrew"student.surname = "Gardner"student.age = 26student.day_of_birth = datetime.datetime.strptime('Jun 1 1999  1:33PM', '%b %d %Y %I:%M%p')student.scholarship = scholarshipstudent.created_at = int(time.time())print(student.to_json())# Create objects by dictionary objects as parameter of JsonModel class.student = Student(**{'name': 'Andrew','surname': 'Gardner','age': 26,'day_of_birth': datetime.datetime.strptime('Jun 1 1999  1:33PM', '%b %d %Y %I:%M%p'),'scholarship': Scholarship(**{'amount': 500.00, 'months': [1, 2, 3, 4]}),'created_at': int(time.time())})print(student.to_json())```Congratulation You have just created your first JsonModel implementation.