Saravanan666/pypi-org huggingface dataset:
Package: python-json-log-formatter
python-loggerSupplements a default formatter configuration for machine-readable JSON logging and applies it.This module should be included as a sub-module in python projects with logging.
Please avoid copy-pasting as no updates can be supplied that way.UsageInstall the module via therequirements.txtor per CLI:pip install python-json-log-formatterPlease include thePythonLoggermodule, using afrom module import classstatement.After the imports, please declare a version constant.This constant should usesemantic versioning, with a prepended date(YYYY/MM/DD).Other examples, without the date, can be foundhereBefore any argument parsing or any other logging, the logger should be initializedInEVERYfile, the logger needs to be imported usingLOGGER = logging.getLogger(__name__)frompython_json_log_formatterimportPythonLoggerimportloggingVERSION="1.0.0 (2022/11/24)"PythonLogger.setup_logger(VERSION)LOGGER=logging.getLogger(__name__)Optionally, it is also possible to change the log level:frompython_json_log_formatterimportPythonLoggerimportloggingVERSION="1.0.0 (2022/11/24)"PythonLogger.setup_logger(VERSION,logging.DEBUG)LOGGER=logging.getLogger(__name__)FeaturesSets the logging format for the root logger and thus for every child logger.
In EVERY file where logging happens, please useLOGGER = logging.getLogger(__name__)to get an individual logger.
Allows printing exception information on any logging level, not only on theEXCEPTIONlevel but also forINFOorDEBUG.
Supplyexec_infoto print these.Setspipeline_statusandjob_statustofailedonCRITICAL, supports minor logging levels (41, etc).To disable the logging on local machines, supplydisable_log_formatting=Truewhen configuring the logger.
Alternatively, without code changes, you can supply the ENV varDISABLE_LOG_FORMATTING"=Trueto generally disable it.Every attribute of the LogRecord will be included in the formatted message unless specified in theexcluded_logging_context_keyslist.
Package: python-jsonparser
# python-jsonparserThis package will help you to reduce your stress while parsing json in python.
Follow the steps below for usingpython-jsonparserInstall the package from pypipip install python-jsonparserNow let’s assume we have a json object as below.dummy = {“name”: {
“first_name”: “ABC”,
“last_name”: “EFG”
},
“details”: {
“phone”:[“xxxxxxxxx”, “00xxxxxxx”, “0000000000”]
}
}3. Now assume we wantfirst_name,last_nameand only firstphonenumber from the list.
For this create a classTestClassas below and inherit JSONParser from :from json_parser import JSONParserclass TestClass(JSONParser):first_name = ‘name/first_name’
last_name = ‘name/last_name’
phone = ‘details/$1’Create instance of your class and pass the json object.test_obj = TestClass(dummy)Now call the validate method from the object created.output = test_obj.validate()You will have following as the output:{
‘first_name’: ‘ABC’,
‘last_name’: ‘EFG’,
‘phone’: ‘00xxxxxxx’
}For getting the range of elements from the list you can use$x:$yfrom json_parser import JSONParserclass TestClass(JSONParser):first_name = ‘name/first_name’
last_name = ‘name/last_name’
phone = ‘details/$1:$3’Output:{
‘first_name’: ‘ABC’,
‘last_name’: ‘EFG’,
‘phone’: [‘00xxxxxxx’, ‘0000000000’]
}8. This was all about single object. What if you have json list of objects.
In that case setmany=Truewhile creating the instance of your class.For example:test_obj = TestClass(dummy, many=True)
Package: python-jsonpath
Python JSONPathA flexible JSONPath engine for Python.We followRFC 9535and test against theJSONPath Compliance Test Suite.Table of ContentsInstallLinksExamplesLicenseInstallInstall Python JSONPath usingpip:pip install python-jsonpathOrPipenv:pipenv install -u python-jsonpathOr fromconda-forge:conda install -c conda-forge python-jsonpathLinksDocumentation:https://jg-rp.github.io/python-jsonpath/.JSONPath Syntax:https://jg-rp.github.io/python-jsonpath/syntax/Change log:https://github.com/jg-rp/python-jsonpath/blob/main/CHANGELOG.mdPyPi:https://pypi.org/project/python-jsonpathSource code:https://github.com/jg-rp/python-jsonpathIssue tracker:https://github.com/jg-rp/python-jsonpath/issuesExamplesJSONPathimportjsonpathdata={"users":[{"name":"Sue","score":100},{"name":"John","score":86},{"name":"Sally","score":84},{"name":"Jane","score":55},]}user_names=jsonpath.findall("$.users[?@.score < 100].name",data)print(user_names)# ['John', 'Sally', 'Jane']JSON PointerSince version 0.8.0, we include anRFC 6901compliant implementation of JSON Pointer. See JSON Pointerquick start,guideandAPI referencefromjsonpathimportpointerdata={"users":[{"name":"Sue","score":100},{"name":"John","score":86},{"name":"Sally","score":84},{"name":"Jane","score":55},]}sue_score=pointer.resolve("/users/0/score",data)print(sue_score)# 100jane_score=pointer.resolve(["users",3,"score"],data)print(jane_score)# 55JSON PatchSince version 0.8.0, we also include anRFC 6902compliant implementation of JSON Patch. See JSON Patchquick startandAPI referencefromjsonpathimportpatchpatch_operations=[{"op":"add","path":"/some/foo","value":{"foo":{}}},{"op":"add","path":"/some/foo","value":{"bar":[]}},{"op":"copy","from":"/some/other","path":"/some/foo/else"},{"op":"add","path":"/some/foo/bar/-","value":1},]data={"some":{"other":"thing"}}patch.apply(patch_operations,data)print(data)# {'some': {'other': 'thing', 'foo': {'bar': [1], 'else': 'thing'}}}Licensepython-jsonpathis distributed under the terms of theMITlicense.
Package: python-jsonrepo
Copyright (c) 2017 Romary Dupuis,https://github.com/romarydPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.Description: UNKNOWN
Keywords: json repository
Platform: UNKNOWN
Classifier: Development Status :: 1 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Package: python-jsonrpc
Installationpip install python-jsonrpcHTTP Client Example#!/usr/bin/env python# coding: utf-8importpyjsonrpchttp_client=pyjsonrpc.HttpClient(url="http://example.com/jsonrpc",username="Username",password="Password")printhttp_client.call("add",1,2)# Result: 3# It is also possible to use the *method* name as *attribute* name.printhttp_client.add(1,2)# Result: 3# Notifications send messages to the server, without response.http_client.notify("add",3,4)HTTP Server Example#!/usr/bin/env python# coding: utf-8importpyjsonrpcclassRequestHandler(pyjsonrpc.HttpRequestHandler):@pyjsonrpc.rpcmethoddefadd(self,a,b):"""Test method"""returna+b# Threading HTTP-Serverhttp_server=pyjsonrpc.ThreadingHttpServer(server_address=('localhost',8080),RequestHandlerClass=RequestHandler)print"Starting HTTP server ..."print"URL: http://localhost:8080"http_server.serve_forever()CGI Example#!/usr/bin/env python# coding: utf-8importpyjsonrpcdefadd(a,b):"""Test function"""returna+b# Handles the JSON-RPC request and gets back the result to STDOUTpyjsonrpc.handle_cgi_request(methods=dict(add=add))Library Usage Example#!/usr/bin/env python# coding: utf-8importpyjsonrpcclassJsonRpc(pyjsonrpc.JsonRpc):@pyjsonrpc.rpcmethoddefadd(self,a,b):"""Test method"""returna+b# 1. Initialize JSON-RPC classrpc=JsonRpc()# 2. Create JSON-RPC string with parameters (= request string)request_json=pyjsonrpc.create_request_json("add",1,2)# request_json = '{"method": "add", "params": [1, 2], "id": "...", "jsonrpc": "2.0"}'# 3. Call the JSON-RPC function and get back the JSON-RPC result (= response string)response_json=rpc.call(request_json)# response_json = '{"result": 3, "id": "...", "jsonrpc": "2.0"}'# 4. Convert JSON-RPC string to Python objectsresponse=pyjsonrpc.parse_response_json(response_json)# 5. Print result or errorifresponse.error:print"Error:",response.error.code,response.error.messageelse:print"Result:",response.resultCherryPy Example#!/usr/bin/env python# coding: utf-8importcherrypyfrompyjsonrpc.cpimportCherryPyJsonRpc,rpcmethodclassRoot(CherryPyJsonRpc):@rpcmethoddefadd(self,a,b):"""Test method"""returna+bindex=CherryPyJsonRpc.request_handlerprint"Starting HTTP server ..."print"URL: http://localhost:8080"cherrypy.quickstart(Root())LicensesGNU Library or Lesser General Public License (LGPL)MIT License
Package: python-jsonrpc-server
A Python 2.7 and 3.4+ server implementation of theJSON RPC 2.0protocol. This library has been pulled
out of thePython Language Serverproject.Asynchronous request handling is supported using Python 3’sconcurrent.futuresmodule and the Python 2concurrent.futures backport.Installationpip install-Upython-jsonrpc-serverExamplesThe examples directory contains two examples of running language servers over websockets.examples/langserver.pyshows how to run a language server in-memory.examples/langserver_ext.pyshows how to run a subprocess language server, in this case thePython Language Server.Start by installingtornadoandpython-language-serverpip installpython-language-server[all]tornadoThen runningpython examples/langserver.pyorpython examples/langserver_ext.pywill host a websocket onws://localhost:3000/python.To setup a client, you can use the examples fromMonaco Language Client.DevelopmentTo run the test suite:pip install .[test] && toxLicenseThis project is made available under the MIT License.
Package: python-jsonstore
jsonstoreThis module provides a class that maps keys and values from a JSON file
onto its attributes.The goal was to provide a convenient way of loading and saving
configuration in a familiar human readable format. This is a bit more
flexible than theconfigparsermodule which is included with Python.This works is tested and working on Python 2.7+ and Python 3.3+. It will
not work on 2.6 or lower, but is expected to work on 3.0-3.2. The tests
do not work in 3.2.6 due tomistreatingthe 💩 when parsing the test code. This is also tested on pypy and pypy3.ExamplesBasics# by default JsonStore commits on every change unless in a transactionstore=JsonStore('config.json')store.a_string="something"store.a_list=[1,2,3]store.a_dictionary={'dict-list':[{}],'ln(2)':0.69314718056,'for-you':u"💐",}# you can use […] to set/get/delete string keysstore['some_key']="a value"# the key is split on '.'s and works on dictionariesdelstore['a_dictionary.dict-list']store['a_dictionary.new_value']="old value"#  you can also use the syntactic sugar for tuple keys (explicit lists work too)assertstore['a_dictionary','new_value']=="old value"# you can traverse lists tooassertstore['a_list',-1]==3# you can use slices in listsassertlen(store['a_list',1:])==2delstore['a_list',:2]assertstore.a_list==[3]# deep copies are made when assigning valuesmy_list=['fun']store.a_list=my_listassertstore.a_listisnotmy_listassert'a_list'instore# deep copies are also returned to avoid unsanitary changes being madestore.a_dictionary['new_value']="new value"# won't update the store!assertstore.a_dictionary['new_value']=="old value"assertstore.a_dictionaryisnotstore.a_dictionary# Appending to, extending a list>>>store.list=[1,2,3]# Because of the fact that .append won't modify the list in the actual file,# but only a copy...>>>store.list.append(4)>>>store.list[1,2,3]# ... we need to rather use the += operator to append to a list.>>>store.list+=[4]>>>store.list[1,2,3,4]# Similarly, we can extend the list>>>store.list+=[5,6]>>>store.list[1,2,3,4,5,6]TransactionsJsonStoreobjects can be used ascontext
managersto provide
transactions which are rolled back in the event of an exception. The
transaction model is primitive; you can only nest transactions.While a store is put into a transaction, it will not save changes to
file until all of the transactions have been closed.fromjsonstoreimportJsonStore# even with auto_commit=True, the file won't be saved until the last contexts has been closedwithJsonStore('config.json',indent=None,auto_commit=False)asstore:self.value=1# the context manager will roll back changes made if an exception is raisedstore=JsonStore('config.json',indent=None)try:withstore:store.value="new"raiseExceptionexceptException:pass# here we see the value that was saved previouslyassertstore.value==1
Package: python-jsonvalidator
Json ValidatorA simple json validaor that validates a json object against a provided schemaFeaturesValidates a json object against a provided schemaTech StackPython3Installationpip3installpython-jsonvalidatorUsage/Examplesfromjsonvalidatorimportjsonvalidatorschema={"name":["required","string"],"phone":["required","string"],"email":["required","string"],"test":["required","boolean"],"job":{"title":["required","string"],"department":["required","string"],"salary":[{"gross":["required","float"],"net":["required","float"],},],},"pet_names":["required","list"],}json_object={"name":"John Doe","phone":"+1 5555 5555","email":"email","test":True,"job":{"title":"Software Engineer","department":"Engineering","salary":[{"gross":50000.00,"net":50000.00,},],},"pet_names":["my pet"],}print(json_validator.validate_json(schema=schema,json_object=json_object))# returns a json objectLicenseMITAuthors@murungakibaara
Package: python-jspickle
This module implements a very fast JSON encoder/decoder for Python, thatalso will serialize and de-serialize objects information in the style of
pickle.  Thus allowing for objects to be easily transported over the wire.JSON stands for JavaScript Object Notation and is a text based lightweight
data exchange format which is easy for humans to read/write and for machines
to parse/generate. JSON is completely language independent and has multiple
implementations in most of the programming languages, making it ideal for
data exchange and storage.The module is written in C and it is up to 250 times faster when compared to
the other python JSON implementations which are written directly in python.
This speed gain varies with the complexity of the data and the operation and
is the the range of 10-200 times for encoding operations and in the range of
100-250 times for decoding operations.
Package: python-jss
# python-jss## Introduction:
This project aims to offer simple, elegant, pythonic access to the Jamf Casper JSS API.Jamf provides access to the JSS and most of its object types through a REST
API. python-jss allows you interact with the API to create new objects, list or
edit the existing ones, and to upload files to configured distribution points.The level of coverage for convenience methods and properties
is primarily centered on Computer management, and specifically, those aspects
which factor into policy and package management.Automating policy creation is streamlined; however, classMobileDeviceInvitationsprovides nothing beyond basicJSSObjectmethods and properties to the API. Those aspects which I use heavily in our
organization, and in support of
[JSSImporter](https://www.github.com/sheagcraig/JSSImporter), tend
to be more fleshed out, whereas aspects of the JSS API that I never use tend to
be minimalistic. However, based on the code here, it should be easy for anyone
wishing to do so to implement anew()method for those objects they’re
interested in, and I would be happy to include them. Send me your pull
requests!## Installing:
The easiest method is to use pip to grab python-jss:$ pip install python-jssHowever, if you use JSSImporter, its package installer uses easy_install since that is included on pre-10.10.5 OS X. You may want to use easy_install instead:$ easy_install -U python-jss.If you don’t have pip, you should probably get it:https://pip.pypa.io/en/latest/installing.htmlAlternately, download the source and copy the python-jss package wherever you normally install
your packages.Behind the scenes, python-jss requires the requests, pyasn1, and ndg-httpsclient packages. If you install using easy-install or pip, these dependencies are handled for you. Otherwise, you’ll have to acquire them yourself:easy_install -U pyasn1 ndg-httpsclient requests## Linux:
python-jss on Linux has some extra dependencies if you need to be able to mount distribution points.
- AFP distribution points require thefuse-afppackage.
- SMB distribution points require thecifs-utilspackage.As I’m currently developing on Fedora, these requirements are specific to RedHat-based distros. Feel free to test and comment on Debian so I can update!## Usage:
Please see [the wiki](https://github.com/sheagcraig/python-jss/wiki) for complete documentation.Also, [my blog](http://sheagcraig.github.io) has a series of posts about using [python-jss](https://github.com/sheagcraig/python-jss), [JSSImporter](https://github.com/sheagcraig/JSSImporter), and [jss_helper](https://github.com/sheagcraig/jss_helper), and solving unique problems using these tools.
Package: python-jtl
python-jtl provides a module called jtl which can be useful for parsing
JMeter results (so called JTL files). JTL files can be either of XML or
CSV (with or without the fieldnames) file format. jtl module supports
both XML and CSV (with and without the fieldnames) file formats.The typical usage in general looks like this:from jtl import create_parser

parser = create_parser('test_results.xml')
for sample in parser.itersamples():
    ...FeaturesParses JMeter results (JTL) into the iterator of the results samples;Supports both XML and CSV (with and without fieldnames) file formats;Supports custom delimiter character (CSV only);Stores results samples in named tuples;Uses iterative XML parsing for better performance;Automatically detects the file format (XML or CSV).
Package: python-jumbo-api
Jumbo.com APIUnofficial Python wrapper for the Jumbo.com API, a way to view your orders, time slots and basket information
Use the same credentials as the ones you use for the app or website.This library is not affiliated with Jumbo and retrieves data from the endpoints of the mobile application. Use at your own risk.ChangelogSee thechangelogfor more information.Home AssistantThis library is being used in Home Assistant as acustom component.ContributorsPeter NijssenRolf Berkenbosch
Package: python_justclick
https://github.com/moshkov/python_justclickЗависимостиPython 2.7+, 3.4+requestsУстановка$pipinstallpython_justclickЕсли используется Django, то в настройках проекта можно указать JUSTCLICK_USERNAME и JUSTCLICK_API_KEY.ОписаниеPython JustClick APIПозволяет работать с API JustClick. В текущей версии реализовано добавление подписчика в группы (AddLeadToGroup) и проверка статуса членства подписчика в группах (GetLeadGroupStatuses).JustClick:http://justclick.ru/Описание API:http://help.justclick.ru/archives/category/apiИспользованиеfrompython_justclick.justclickimportJustClickConnectionjustClickConnection=JustClickConnection('YOU_JUSTCLICK_USERNAME','YOU_JUSTCLICK_API_KEY')result=justClickConnection.add_lead_to_group(['group1','group2'],'lead@email.local',{"doneurl2":"https://your-site.local/success","lead_name":"Vasya Pupkin",})ifresult['error_code']==0:print'success'...Для Django (если в настройках заданы JUSTCLICK_USERNAME и JUSTCLICK_API_KEY):frompython_justclick.python_justclick_djangoimportjustClickConnectionresult=justClickConnection.add_lead_to_group(['group1','group2'],'lead@email.local',{"doneurl2":"https://your-site.local/success","lead_name":"Vasya Pupkin",})ifresult['error_code']==0:returnHttpResponseRedirect(reverse('thanks'))...TODOПроверка отвера API на корректностьОстальной функционал API JustClickТестыДокументация
Package: python-jwt
python-jwtModule for generating and verifyingJSON Web Tokens.All versions of python-jwt are now DEPRECATED. I don't have the time to maintain this module.Note:Versions 3.3.4 and later fix avulnerability(CVE-2022-39227) in JSON Web Token verification which lets an attacker with a valid token re-use its signature with modified claims. CVE to follow. Please upgrade!Note:From version 2.0.1 the namespace has changed fromjwttopython_jwt, in order to avoid conflict withPyJWT.Note:Versions 1.0.0 and later fix avulnerabilityin JSON Web Token verification so please upgrade if you're using this functionality. The API has changed so you will need to update your application.verify_jwtnow requires you to specify which signature algorithms are allowed.Usesjwcryptoto do the heavy lifting.SupportsRS256,RS384,RS512,PS256,PS384,PS512,HS256,HS384,HS512,ES256,ES384,ES512,ES256K,EdDSAandnonesignature algorithms.Unit tests, including tests for interoperability withjose.Supports Python 3.6+.Note:generate_jwtreturns the token as a Unicode string.Example:importpython_jwtasjwt,jwcrypto.jwkasjwk,datetimekey=jwk.JWK.generate(kty='RSA',size=2048)payload={'foo':'bar','wup':90};token=jwt.generate_jwt(payload,key,'PS256',datetime.timedelta(minutes=5))header,claims=jwt.verify_jwt(token,key,['PS256'])forkinpayload:assertclaims[k]==payload[k]The API is describedhere.Installationpipinstallpython_jwtAnother ExampleYou can read and write keys from and toPEM-formatstrings:importpython_jwtasjwt,jwcrypto.jwkasjwk,datetimekey=jwk.JWK.generate(kty='RSA',size=2048)priv_pem=key.export_to_pem(private_key=True,password=None)pub_pem=key.export_to_pem()payload={'foo':'bar','wup':90};priv_key=jwk.JWK.from_pem(priv_pem)pub_key=jwk.JWK.from_pem(pub_pem)token=jwt.generate_jwt(payload,priv_key,'RS256',datetime.timedelta(minutes=5))header,claims=jwt.verify_jwt(token,pub_key,['RS256'])forkinpayload:assertclaims[k]==payload[k]LicenceMITTestsmaketestLintmakelintCode Coveragemakecoveragecoverage.pyresults are availablehere.Coveralls page ishere.BenchmarksmakebenchHere are some results on a laptop with an Intel Core i5-4300M 2.6Ghz CPU and 8Gb RAM running Ubuntu 17.04.Generate Keyuser (ns)sys (ns)real (ns)RSA103,100,000200,000103,341,537Generate Tokenuser (ns)sys (ns)real (ns)HS256220,0000226,478HS384220,0000218,233HS512230,0000225,823PS2561,530,00010,0001,536,235PS3841,550,00001,549,844PS5121,520,00010,0001,524,844RS2561,520,00010,0001,524,565RS3841,530,00001,528,074RS5121,510,00001,526,089Load Keyuser (ns)sys (ns)real (ns)RSA210,0003,000210,791Verify Tokenuser (ns)sys (ns)real (ns)HS256100,0000101,478HS384100,00010,000103,014HS512110,0000104,323PS256230,0000231,058PS384240,0000237,551PS512240,0000232,450RS256230,0000227,737RS384230,0000230,698RS512230,0000228,624