From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- third_party/python/json-e/MANIFEST.in | 3 + third_party/python/json-e/PKG-INFO | 11 + third_party/python/json-e/README.md | 730 +++++++++++++++++++++ third_party/python/json-e/json_e.egg-info/PKG-INFO | 11 + .../python/json-e/json_e.egg-info/SOURCES.txt | 17 + .../json-e/json_e.egg-info/dependency_links.txt | 1 + .../python/json-e/json_e.egg-info/requires.txt | 3 + .../python/json-e/json_e.egg-info/top_level.txt | 1 + third_party/python/json-e/jsone/__init__.py | 21 + third_party/python/json-e/jsone/builtins.py | 121 ++++ third_party/python/json-e/jsone/interpreter.py | 289 ++++++++ third_party/python/json-e/jsone/prattparser.py | 191 ++++++ third_party/python/json-e/jsone/render.py | 354 ++++++++++ third_party/python/json-e/jsone/shared.py | 131 ++++ third_party/python/json-e/jsone/six.py | 23 + third_party/python/json-e/package.json | 35 + third_party/python/json-e/setup.cfg | 8 + third_party/python/json-e/setup.py | 31 + 18 files changed, 1981 insertions(+) create mode 100644 third_party/python/json-e/MANIFEST.in create mode 100644 third_party/python/json-e/PKG-INFO create mode 100644 third_party/python/json-e/README.md create mode 100644 third_party/python/json-e/json_e.egg-info/PKG-INFO create mode 100644 third_party/python/json-e/json_e.egg-info/SOURCES.txt create mode 100644 third_party/python/json-e/json_e.egg-info/dependency_links.txt create mode 100644 third_party/python/json-e/json_e.egg-info/requires.txt create mode 100644 third_party/python/json-e/json_e.egg-info/top_level.txt create mode 100644 third_party/python/json-e/jsone/__init__.py create mode 100644 third_party/python/json-e/jsone/builtins.py create mode 100644 third_party/python/json-e/jsone/interpreter.py create mode 100644 third_party/python/json-e/jsone/prattparser.py create mode 100644 third_party/python/json-e/jsone/render.py create mode 100644 third_party/python/json-e/jsone/shared.py create mode 100644 third_party/python/json-e/jsone/six.py create mode 100644 third_party/python/json-e/package.json create mode 100644 third_party/python/json-e/setup.cfg create mode 100644 third_party/python/json-e/setup.py (limited to 'third_party/python/json-e') diff --git a/third_party/python/json-e/MANIFEST.in b/third_party/python/json-e/MANIFEST.in new file mode 100644 index 0000000000..a6995977cb --- /dev/null +++ b/third_party/python/json-e/MANIFEST.in @@ -0,0 +1,3 @@ +include jsone *.py +include package.json +recursive-exclude test * diff --git a/third_party/python/json-e/PKG-INFO b/third_party/python/json-e/PKG-INFO new file mode 100644 index 0000000000..bf41f82167 --- /dev/null +++ b/third_party/python/json-e/PKG-INFO @@ -0,0 +1,11 @@ +Metadata-Version: 2.1 +Name: json-e +Version: 2.7.0 +Summary: A data-structure parameterization system written for embedding context in JSON objects +Home-page: https://taskcluster.github.io/json-e/ +Author: Dustin J. Mitchell +Author-email: dustin@mozilla.com +License: MPL2 +Description: UNKNOWN +Platform: UNKNOWN +Provides-Extra: release diff --git a/third_party/python/json-e/README.md b/third_party/python/json-e/README.md new file mode 100644 index 0000000000..155b2e6ded --- /dev/null +++ b/third_party/python/json-e/README.md @@ -0,0 +1,730 @@ +* [Full documentation](https://taskcluster.github.io/json-e) + +# JSON-e + +JSON-e is a data-structure parameterization system for embedding context in +JSON objects. + +The central idea is to treat a data structure as a "template" and transform it, +using another data structure as context, to produce an output data structure. + +There are countless libraries to do this with strings, such as +[mustache](https://mustache.github.io/). What makes JSON-e unique is that it +operates on data structures, not on their textual representation. This allows +input to be written in a number of formats (JSON, YAML, etc.) or even generated +dynamically. It also means that the output cannot be "invalid", even when +including large chunks of contextual data. + +JSON-e is also designed to be safe for use on untrusted data. It never uses +`eval` or any other function that might result in arbitrary code execution. It +also disallows unbounded iteration, so any JSON-e rendering operation will +finish in finite time. + +## Changes + +See +[CHANGELOG.rst](https://github.com/taskcluster/json-e/blob/master/CHANGELOG.rst) +for the changes in each version of this library. + +# Interface + +## JavaScript + +The JS module is installed with either of + +```shell +npm install --save json-e +yarn add json-e +``` + +The module exposes following interface: + +```javascript +import jsone from 'json-e'; + +var template = {a: {$eval: "foo.bar"}}; +var context = {foo: {bar: "zoo"}}; +console.log(jsone(template, context)); +// -> { a: 'zoo' } +``` + +Note that the context can contain functions, and those functions can be called +from the template: + +```javascript +var template = {$eval: "foo(1)"}; +var context = {"foo": function(x) { return x + 2; }}; +console.log(jsone(template, context)); // -> 3 +``` + +*NOTE*: Context functions are called synchronously. Any complex asynchronous +operations should be handled before rendering the template. + +*NOTE*: If the template is untrusted, it can pass arbitrary data to functions +in the context, which must guard against such behavior. + +### Browser + +JSON-e is distributed as a CommonJS package is not designed to be included +directly in a browser with `