Saravanan666/pypi-org huggingface dataset:
Package: json2htmls
json2htmlsjson2htmlsis a package that converts json (dict) to html tables.InstallationUse the package managerpipto install json2htmls.pipinstalljson2htmlsAvailable methodsjson_to_html-convertsjson(dict)tohtmlnormalize-normalizesjson(dict),convertsvaluestostringsbuilder-mainmethodthatgeneratestablesjson_arrays_to_dictionary-convertsarrayofobjectstoobjects,withsuffixesjson_arrays_destroy-removesarraysfromsourceUsageExamplefromjson2htmlsimportjson_to_htmlimportjsonwithopen('tests/sample.json')asjson_file:# warning currently keys with values are not supported , e.g. "key": ["1", "2"]data=json.load(json_file)source,html=json_to_html(data)# source is the dictionary , html is the html itselfResult , usehtmlviewerto see the result<!DOCTYPE html><html><head><title>Report</title><style>table{page-break-inside:auto}tr{page-break-inside:avoid;page-break-after:auto}thead{display:table-header-group}tfoot{display:table-footer-group}.pointer{display:block;clear:both;page-break-after:always;}.clearfix{overflow:auto;clear:both}.clearfix::after{content:&quot;&quot;;clear:both;display:table;}body{margin:07rem;}table{width:100%;font-size:0.8rem;}th,td{border:0.11remsolidblack;}table,th,td{border-collapse:collapse;padding:0.25rem1rem;text-align:left;margin:0;}tr:nth-child(even){background-color:#cccccc61;}</style></head><body><tableclass="clearfix"id="table_id"><tbody><divclass="pointer"></div><h3>General</h3><tr><th>Id</th><td>0001</td></tr><tr><th>Type</th><td>donut</td></tr><tr><th>Name</th><td>Cake</td></tr><tr><th>Ppu</th><td>0.55</td></tr><tr></tr></tbody></table><tableclass="clearfix"id="table_batter"style="page-break-inside: avoid; margin-top: 2rem;"><tbody><trid="row_heading_batter_heading"><tdcolspan="2"><h3class="clearfix">Batter - 4</h3></td></tr><trid="row_heading_batter_0"><th>Id</th><th>Type</th></tr><trid="row_batter_0"><td>1001</td><td>Regular</td></tr><trid="row_batter_1"><td>1002</td><td>Chocolate</td></tr><trid="row_batter_2"><td>1003</td><td>Blueberry</td></tr><trid="row_batter_3"><td>1004</td><td>Devil's Food</td></tr></tbody></table><h3>Batters</h3><tableclass="clearfix"id="table_batters"><tbody></tbody></table><tableclass="clearfix"id="table_topping"style="page-break-inside: avoid; margin-top: 2rem;"><tbody><trid="row_heading_topping_heading"><tdcolspan="2"><h3class="clearfix">Topping - 7</h3></td></tr><trid="row_heading_topping_0"><th>Id</th><th>Type</th></tr><trid="row_topping_0"><td>5001</td><td>None</td></tr><trid="row_topping_1"><td>5002</td><td>Glazed</td></tr><trid="row_topping_2"><td>5005</td><td>Sugar</td></tr><trid="row_topping_3"><td>5007</td><td>Powdered Sugar</td></tr><trid="row_topping_4"><td>5006</td><td>Chocolate with Sprinkles</td></tr><trid="row_topping_5"><td>5003</td><td>Chocolate</td></tr><trid="row_topping_6"><td>5004</td><td>Maple</td></tr></tbody></table></body></html>ContributingPull requests are welcome. Open issues addressing pull requests.LicenseMIT
Package: json2img
json2imgA Python script for generating randomly colored images from Label Studio annotationsInstallation%pipinstalljson2imgUsageCommand line%python-mjson2imgbrick_annotation.jsonbricks.png
%python-mjson2imghand_annotation.jsonsign.jpg-vModule>>>fromjson2imgimport*>>>save_image('brick_annotation.json','bricks.png')>>>save_image('hand_annotation.json','sign.jpg',view=True)DependenciesCPython >= 3.7pygame >= 2.0.0
Package: json2latex
JSON to LaTeXjson2latexis a library for converting a nested Python structure to a format
accessible in LaTeX.InstallationJSON to LaTeX can be installed usingpipby runningpip install json2latex,UsageFull documentation of JSON to LaTeX is providedhere. The basic usage is as follows.The following Python code saves a file, `out.tex which includes the necessary
LaTeX commands to access the data in LaTeX.importjson2latexdata=dict(a="test",b=[1,2])withopen('out.tex','w')asf:json2latex.dump('data',data,f)The same result can be accomplished by running,json2latexexample.jsondataout.texwhereexample.json is a JSON file containing the same data is thedata` dictionary in the Python example.The code output by JSON to LaTeX can be used as follows. First the file needs to be imported in LaTeX using\input{out.tex}. Then, the following commands can be used to access the data:\datawill expand to the full JSON representation of the input,{"a": "test", "b": [1, 2]}.\data[a]will expand totest.\data[b]will expand to[1, 2].\data[b][0]will expand to1.\data[b][1]will expand to2.\data[b][2], and all other undefined values, will expand to??.
Package: json2netns
json2netnsJSON parsing Linux Network Namespace (netns) topology builder.InstallFrom PyPI:pip install json2netnsFrom GitHub:pip install git+git://github.com/cooperlees/json2netnsConceptsWhat is a Linux Namespace - aka NetNS?https://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/WHat is JSON?https://www.json.org/The script takes a JSON config file and drives namespace creation from that JSON toplogy file.
Lets look at the following simple two network namespace topology:We have two namespaces that have 1 direct connection via a veth. It also has a OOB (Out of Band)
set of interfaces that allow the main Linux Network Namespace to communicate with the netns directly.By default it even bridges with a physical interface to allow external packets to be routed into the netns if desired from a physical NIC.ConfigurationThe above topology is represented bysample.json. This config is also used by unittests to ensure correct functioning. We can add to it over time as users require more features.Small 1 NS Example JSON Config{"namespaces":{"left":{"id":1,"interfaces":{"left0":{"prefixes":["fd00::1/64","10.1.1.1/24"],"peer_name":"right0","type":"veth"},"lo":{"prefixes":["fd00:1::/64","10.6.9.1/32"],"type":"loopback"}},"oob":false,"routes":{"route1":{"dest_prefix":"10.6.9.6/32","next_hop_ip":"10.1.1.2","egress_if_name":""},"route2":{"dest_prefix":"fd00:6::/64","next_hop_ip":"fd00::2","egress_if_name":""}}}},"oob":{},"physical_int":""}UsageAfter installing just pointjson2netnsat a valid config file and run as
root(in the future we could make it capability aware too - PR Welcome!).usage: json2netns [-h] [-d] [--validate] [--workers WORKERS] config actionActionscreate: Create the interfaces and namespaces + bring interfaces upcheck: Print the interface addressing + v4/6 routing tables to stdoutdelete: Remove the namespaces and all interfacesDevelopmentThe code has attempted to be object oriented first. Please try to use inheritance
and keep new interface types sub classes of Interface etc. for all code additions.Development 'editable' Installpython3 -m venv [--upgrade-deps] /tmp/tj/tmp/tj/bin/pip install -r requirements_test.txt/tmp/tj/bin/pip install -e .Run TestsFor testing we useptr./tmp/tj/bin/ptr [-k] [--print-cov] [--debug]-k: keep venv ptr creates--print-cov: handy to see what coverage is on all files--debug: Handy to see all commands run so you can run a step manually
Package: json2obj
json2objAllows you to transform JSON data into an object whose members can be queried using the member access operator. Unlikejson.dumpsin the standard library that returns a dictionary object, this library returns a JSONObjectMapper object. The attributes of these objects are defined by the contents of the JSON data provided to itExamplesimportdatetimefromjson2objimportJSONObjectMapperperson=JSONObjectMapper("""{"name" : "trumpowen" ,"age" : 125}""")person.name=="trumpowen"# trueperson.age==125# true# replaces and overwritesperson.name={}person.name.first_name="Wilkins"person.name.last_name="Owen"person.name.other_names=["Trump"]# add new attribute. If this is not desired, you can initialize the object with readonly set to True. This will prevent the addition of new attributes and changing the values of existing attributesperson.dob=datetime(1900,12,6)json_data=str(person)# returns a string representationjson_as_dict=person.to_dict()# returns a dictionary representationDocumentationUsehelp(obj), where obj is an instance of JSONObjectMapper
Package: json2onnx
json2onnxConverts a JSON file to an ONNX file. Click here foronnx2json.https://github.com/PINTO0309/simple-onnx-processing-tools1. Setup1-1. HostPC### option$echoexportPATH="~/.local/bin:$PATH">>~/.bashrc\&&source~/.bashrc### run$pipinstall-Uonnxprotobuf\&&python3-mpipinstall-Uonnx_graphsurgeon--index-urlhttps://pypi.ngc.nvidia.com\&&pipinstall-Ujson2onnx1-2. Dockerhttps://github.com/PINTO0309/simple-onnx-processing-tools#docker2. CLI Usageusage:
  json2onnx [-h]
  --ij INPUT_JSON_PATH
  -of OUTPUT_ONNX_FILE_PATH

optional arguments:
  -h, --help
      show this help message and exit

  -ij INPUT_JSON_PATH, --input_json_path INPUT_JSON_PATH
      Input JSON file path (*.json)

  -of OUTPUT_ONNX_FILE_PATH, --output_onnx_file_path OUTPUT_ONNX_FILE_PATH
      Output ONNX model path (*.onnx)3. In-script Usage>>>fromjson2onnximportconvert>>>help(convert)Helponfunctionconvertinmodulejson2onnx.json2onnx:convert(input_json_path:Union[str,NoneType]='',json_dict:Union[dict,NoneType]=None,output_onnx_file_path:Union[str,NoneType]='')Parameters----------input_json_path:Optional[str]Inputonnxfilepath.Eitherinput_json_pathorjson_dictmustbespecified.Default:''json_dict:Optional[dict]onnx.ModelProto.Eitherinput_onnx_file_pathorjson_dictmustbespecified.json_dictIfspecified,ignoreinput_json_pathandprocessjson_dict.output_onnx_file_path:Optional[str]Outputonnxfilepath.Ifnotspecified,noONNXfileisoutput.Default:''Returns-------onnx_graph:onnx.ModelProtoConvertedONNX.4. CLI Execution$json2onnx\--input_json_pathNonMaxSuppression.json\--output_onnx_file_pathNonMaxSuppression.onnx5. In-script Executionfromjson2onnximportconvertonnx_graph=convert(input_json_path="NonMaxSuppression.json",output_onnx_file_path="NonMaxSuppression.onnx",)# oronnx_graph=convert(input_json_path="NonMaxSuppression.json",)# oronnx_graph=convert(json_dict=json_data,output_onnx_file_path="NonMaxSuppression.onnx",)# oronnx_graph=convert(json_dict=json_data,)6. Issueshttps://github.com/PINTO0309/simple-onnx-processing-tools/issues
Package: json2pdf
To create the content for the README.md file of your Python package, you can include the following information:PDF GeneratorA Python package for converting JSON data to HTML and generating PDFs.DescriptionThis package provides functionality to convert JSON data to HTML using a customizable template and then generate PDF files from the HTML content. It allows users to provide their own JSON data and template file to customize the output.FeaturesConvert JSON data to HTML - anyName.jsonSupport for custom HTML templates - template.htmlGenerate PDF files from HTML - output.htmlMerge multiple PDF files into a single PDF - merged_output.pdfInstallationYou can install the package using pip:pip install oneoneoneexample==0.6Note: Replace "version-number" with the recent version number of the package, ex: 0.6 -> latest.Usagefrompdf_generator.convertimportgenerate# Specify the paths and file names for JSON data, template, output HTML, and new PDF filejson_file='path/to/json/data.json'(completepathofjsonfile)template_directory='path/to/template/directory'(onlytemplatedirectory)output_html_path='path/to/save/output/html'(onlyoutputhtmldirectory)new_pdf_path='path/to/save/new/pdf'(onlypdfsavingdirectory)# Generate HTML and PDF filesgenerate(json_file,template_directory,output_html_path,new_pdf_path)Make sure to replace the placeholders with the actual paths and file names.DependenciesThis package relies on the following dependencies:pandasjinja2pdfkitPyPDF2Please make sure to install these dependencies before using the package. You can install them using the following command:pip install pandas jinja2 pdfkit PyPDF2Note: Thepdfkitlibrary requires an external tool called Wkhtmltopdf. This package will automatically add the path for Wkhtmltopdf still error of Wkhtmltopdf installation, add path to your system's PATH before using this package.LicenseThis package is licensed under theMIT License.
Package: json2pyclass
JSON Schema to Python Classes converter. I created this since it seems
the other projects either are abandoned, or they weren’t able to parse
K8s JSON Schema definitions.Furthermore this converter generates definitions thatmypycan
consume.Installpipinstalljson2pyclassUsageUsage: json2pyclass [OPTIONS] INPUT_FILE OUTPUT_NAME

Options:
  --mode TEXT                   Output mode [class|dict]. Dict is not yet
                                implemented.  [default: class]

  --optionals / --no-optionals  Disable Optional[] generation.  [default:
                                True]

  --help                        Show this message and exit.The--optionalsfrom the actual types can be disabled if the data
will be read, and you don’t want to always doifchecks. For example
in K8s most fields are optional, even namespace names, or metadata. When
reading these values are always present, so you might want to just be
able to access them as they are, without having toasserteach value
to makemypyhappy.In the future the plan is to implement also aDictwriter, that
doesn’t dump custom classes. The advantage will be that you could do
after thisjson.load_safeand just cast to the type.Currently this API was created for usage with eitheraddict, or the
kubeapi part ofadhesive, that returns types with the properties as
regular class “fields”.SampleAssuming we have a definition such as:{"definitions":{"io.k8s.api.admissionregistration.v1.MutatingWebhook":{"description":"MutatingWebhook describes an admission webhook and the resources and operations it applies to.","properties":{"admissionReviewVersions":{"description":"AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.","items":{"type":"string"},"type":"array",...We could call:json2pyclassmydefinitions.jsonmydefinitions.pyAnd this will yield a file with all the types defined in there:fromtypingimportOptional,Union,List,Dict,AnyclassMutatingWebhook:# io.k8s.api.admissionregistration.v1.MutatingWebhook"""
    MutatingWebhook describes an admission webhook and the resources and operations it applies to.
    """admissionReviewVersions:List[str]clientConfig:'WebhookClientConfig'failurePolicy:strmatchPolicy:str# ...
Package: json2pytocol
json2pytocolGenerates python 3.8 protocol typings for JSONInstallationpip install json2pytocolUsageFrom terminal type:json2pytocolYou can also pass parameters to avoid having to deal with terminal interactionjson2pytocol path_to_json_file file_name_to_saveThe file will be saved on the working directory of the terminal.Note that_protocolis appended to the file name you choose to save as
Package: json2rust
Turns a JSON document into a struct for rust-langInstallationFrom the project root directory:$ python setup.py installOr:$ pip install json2rustUsageSimply run it with the name of the root struct and the path to your JSON:$ json2rust MyStruct data.jsonUse –help/-h to view info on the arguments:$ json2rust --helpExampleTake your JSON doc:$ cat testdata/example.json
{
        "name": "Me",
        "age": 33,
        "children": [
                {
                        "name": "joe",
                        "age": 0.5,
                        "exists": false
                }
        ],
        "job": {
                "employer": "foo",
                "salary": 5000000,
                "coworker": null
        }
}Run json2rust:$ json2rust ExampleStruct testdata/example.json
pub struct ExampleStruct {
        pub job: Job,
        pub age: i32,
        pub name: String,
        pub children: Vec<Children>,
}
pub struct Job {
        pub salary: i32,
        pub coworker: Option<UNKNOWN_NULL>,
        pub employer: String,
}
pub struct Children {
        pub age: f32,
        pub name: String,
        pub exists: bool,
}Release Notes0.1.0:Project works0.0.1:Project created
Package: json2schema
json2schemaGet (Guess) jsonschema from one json sampleFeaturesjson to jsonschemaInstall$ pip install json2schemaUseSimple Usefromjson2schemaimportjson2schemafrompprintimportpprintdata={"first_name":"George","last_name":"Washington","birthday":"1732-02-22","address":{"street_address":"3200 Mount Vernon Memorial Highway","city":"Mount Vernon","state":"Virginia","country":"United States"}}schema=json2schema(data)pprint(schema)output{'$schema':'http://json-schema.org/schema','properties':{'address':{'properties':{'city':{'type':'string'},'country':{'type':'string'},'state':{'type':'string'},'street_address':{'type':'string'}},'required':['street_address','city','state','country'],'type':'object'},'birthday':{'type':'string'},'first_name':{'type':'string'},'last_name':{'type':'string'}},'required':['first_name','last_name','birthday','address'],'type':'object'}More argumentsYou can userequired_all=Trueto mark all properties or items as required
withschema = json2schema(data, required_all=True)you will get{'$schema':'http://json-schema.org/schema','properties':{'address':{'properties':{'city':{'type':'string'},'country':{'type':'string'},'state':{'type':'string'},'street_address':{'type':'string'}},'required':['street_address','city','state','country'],'type':'object'},'birthday':{'type':'string'},'first_name':{'type':'string'},'last_name':{'type':'string'}},'required':['first_name','last_name','birthday','address'],'type':'object'}or usecheck_value=Trueto mark all value exact the same with the sample data
withschema = json2schema(data, check_value=True), you will get{'$schema':'http://json-schema.org/schema','properties':{'address':{'properties':{'city':{'pattern':'^Mount Vernon$','type':'string'},'country':{'pattern':'^United ''States$','type':'string'},'state':{'pattern':'^Virginia$','type':'string'},'street_address':{'pattern':'^3200 ''Mount ''Vernon ''Memorial ''Highway$','type':'string'}},'required':['street_address','city','state','country'],'type':'object'},'birthday':{'pattern':'^1732-02-22$','type':'string'},'first_name':{'pattern':'^George$','type':'string'},'last_name':{'pattern':'^Washington$','type':'string'}},'required':['first_name','last_name','birthday','address'],'type':'object'}TODO:get jsonschema with multiple samplesmore args for json2schema
Package: json2swagger
$json2swagger--helpusage:json2swagger[-h][--nameNAME][--annotationsANNOTATIONS][--show-minimap][--logging{CRITICAL,NOTSET,DEBUG,WARN,INFO,ERROR,WARNING}][--emit{schema,info}][--dstDST]srcpositionalarguments:srcoptionalarguments:-h,--helpshowthishelpmessageandexit--nameNAME--annotationsANNOTATIONS--show-minimap--logging{CRITICAL,NOTSET,DEBUG,WARN,INFO,ERROR,WARNING}--emit{schema,info}--dstDSTexampledata.yaml# from: https://github.com/nfarina/homebridge/blob/master/config-sample.jsonbridge:name:Homebridgeusername:CC:22:3D:E3:CE:30port:51826pin:031-45-154description:This is an example configuration file with one fake accessory and onefake platform. You can use this as a template for creating your own configurationfile containing devices you actually own.accessories:-accessory:WeMoname:Coffee Makerplatforms:-platform:PhilipsHuename:Hue$json2swaggerexamples/readme/data.yaml>examples/readme/swagger.yamlswagger.yamldefinitions:bridge:type:objectproperties:name:type:stringexample:Homebridgeusername:type:stringexample:CC:22:3D:E3:CE:30port:type:integerexample:51826pin:type:stringexample:031-45-154required:-name-username-port-pinaccessoriesItem:type:objectproperties:accessory:type:stringexample:WeMoname:type:stringexample:Coffee Makerrequired:-accessory-nameaccessories:type:arrayitems:$ref:'#/definitions/accessoriesItem'platformsItem:type:objectproperties:platform:type:stringexample:PhilipsHuename:type:stringexample:Huerequired:-platform-nameplatforms:type:arrayitems:$ref:'#/definitions/platformsItem'top:type:objectproperties:bridge:$ref:'#/definitions/bridge'description:type:stringexample:This is an example configuration file with one fake accessory andone fake platform. You can use this as a template for creating your ownconfiguration file containing devices you actually own.accessories:$ref:'#/definitions/accessories'platforms:$ref:'#/definitions/platforms'required:-bridge-description-accessories-platforms
Package: json2tex
📝 json2tex - Convert JSON to LaTeXThis Python script can read multiple JSON files, merge them and outputs LaTeX-\newcommand-definitions to access all elements.Installation# from PyPIpipinstalljson2tex# or directly from GitLabpipinstallgit+https://gitlab.com/nobodyinperson/json2texUsageWith a JSON filevalues.jsonlike this:[{"_id":"5f1570db9d5aa0b6df3823f8","index":0,"guid":"0fdfb3c5-1f0a-4c2a-8fed-75861742b588","isActive":true,"balance":"$1,652.14","picture":"http://placehold.it/32x32","age":22,"eyeColor":"blue","name":{"first":"Harrington","last":"Emerson"},"company":"ISOSURE"}](generated withJSONGeneratorbtw.)You can then convert that JSON to TeX-definitions like this:json2tex-ivalues.json-ovalues.tex... which generates the followingvalues.texfile:\newcommand{\FirstId}{5f1570db9d5aa0b6df3823f8}\newcommand{\FirstIndex}{0}\newcommand{\FirstGuid}{0fdfb3c5-1f0a-4c2a-8fed-75861742b588}\newcommand{\FirstIsactive}{True}\newcommand{\FirstBalance}{\$1,652.14}\newcommand{\FirstPicture}{http://placehold.it/32x32}\newcommand{\FirstAge}{22}\newcommand{\FirstEyecolor}{blue}\newcommand{\FirstNameFirst}{Harrington}\newcommand{\FirstNameLast}{Emerson}\newcommand{\FirstCompany}{ISOSURE}
Package: json2tfvars
Aboutsimple tfvars (HCL) converterUsageusage: json2tfvars [-h] [--reverse] [--indent N] [FILE [FILE ...]]

positional arguments:
  FILE

optional arguments:
  -h, --help  show this help message and exit
  --reverse   expect tfvars (HCL) input
  --indent N  adjust identation levels$json2tfvars<<<'{"a":"b"}'|json2tfvars--reverse|jq-r'. + {"c":"d"}'|json2tfvarsa="b"c="d"
Package: json2toml
json2toml命令行工具(v2023.10.04)usage: 

## shell command toolkit :: convert json to toml
    
    json2toml (2023.10.08)

eg:
  [0] json2toml --help                                  ; show help
  [1] json2toml input.json output.toml                  ; json to tmol
  [2] json2toml input.toml output.json                  ; toml to json   
  [3] json2toml --stdin '{"name":"jsonfile"}'         ; stdin:json to stdout:toml
  [4] json2toml --stdin 'name = "jsonfile"' --mode=2    ; stdin:toml to stdout:json

options:
  -h, --help            show this help message and exit
  -v, --version         show versions
  -i, --stdin           stdin::text
  -d, --dry_run         debug only, 不运行，只打印调试参数
  --force_redo          force overwrite
  --indent INDENT       output json/toml file
  --mode MODE           0-auto; 1-json2toml; 2-toml2json;
  --input_file INPUT_FILE
                        input json/toml file
  --output_file OUTPUT_FILE
                        output json/toml file
Package: json2tsv
Convert json to tab-separated format. Read from STDIN and write to
STDOUT. E.g.$ echo '[{"id":"123", "user":{"name":"mary", "gender":"female"}}, {"id":"124", "user":{"name":"mark", "gender":"male"}}]' | json2tsv id user.name user.gender
123     mary    female
124     mark    maleFree software: BSD licenseDocumentation:http://json2tsv.rtfd.org.History0.1.2 (2016-09-28)Adds type decoding to tsv2jsonLight refactoring0.1.1 (2016-07-11)Bugfixes; unicode supportpy2 / py3 support0.1.0 (2014-01-11)First release on PyPI.
Package: json2txttree
json2txttreePython code that converts JSON data to tree-like output for documentation or pretty printingUsageimportjsonfromjson2txttreeimportjson2txttree# Load json datawithopen('sample.json','r')asf:jsonData=json.load(f)# Pretty print json hierarchy as a treeprint(json2txttree(jsonData))└─(object)├─"name"(string)├─"age"(number)├─"languages"(array)│└─(string)├─"subjects"(object)│├─"Math"(number)│└─"Science"(number)└─"ids"(array)└─(object)├─"name"(string)└─"number"(string)0.1.0 (2022-03-18)Initial release.