github.com/goplus/llgo@v0.8.3/py/json/gen.go (about)

     1  package json
     2  
     3  import (
     4  	_ "unsafe"
     5  
     6  	"github.com/goplus/llgo/py"
     7  )
     8  
     9  const LLGoPackage = "py.json"
    10  
    11  // Serialize “obj“ as a JSON formatted stream to “fp“ (a
    12  //
    13  //	``.write()``-supporting file-like object).
    14  //
    15  //	If ``skipkeys`` is true then ``dict`` keys that are not basic types
    16  //	(``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
    17  //	instead of raising a ``TypeError``.
    18  //
    19  //	If ``ensure_ascii`` is false, then the strings written to ``fp`` can
    20  //	contain non-ASCII characters if they appear in strings contained in
    21  //	``obj``. Otherwise, all such characters are escaped in JSON strings.
    22  //
    23  //	If ``check_circular`` is false, then the circular reference check
    24  //	for container types will be skipped and a circular reference will
    25  //	result in an ``RecursionError`` (or worse).
    26  //
    27  //	If ``allow_nan`` is false, then it will be a ``ValueError`` to
    28  //	serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
    29  //	in strict compliance of the JSON specification, instead of using the
    30  //	JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
    31  //
    32  //	If ``indent`` is a non-negative integer, then JSON array elements and
    33  //	object members will be pretty-printed with that indent level. An indent
    34  //	level of 0 will only insert newlines. ``None`` is the most compact
    35  //	representation.
    36  //
    37  //	If specified, ``separators`` should be an ``(item_separator, key_separator)``
    38  //	tuple.  The default is ``(', ', ': ')`` if *indent* is ``None`` and
    39  //	``(',', ': ')`` otherwise.  To get the most compact JSON representation,
    40  //	you should specify ``(',', ':')`` to eliminate whitespace.
    41  //
    42  //	``default(obj)`` is a function that should return a serializable version
    43  //	of obj or raise TypeError. The default simply raises TypeError.
    44  //
    45  //	If *sort_keys* is true (default: ``False``), then the output of
    46  //	dictionaries will be sorted by key.
    47  //
    48  //	To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
    49  //	``.default()`` method to serialize additional types), specify it with
    50  //	the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
    51  //
    52  //go:linkname Dump py.dump
    53  func Dump(obj *py.Object, fp *py.Object) *py.Object
    54  
    55  // Serialize “obj“ to a JSON formatted “str“.
    56  //
    57  //	If ``skipkeys`` is true then ``dict`` keys that are not basic types
    58  //	(``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
    59  //	instead of raising a ``TypeError``.
    60  //
    61  //	If ``ensure_ascii`` is false, then the return value can contain non-ASCII
    62  //	characters if they appear in strings contained in ``obj``. Otherwise, all
    63  //	such characters are escaped in JSON strings.
    64  //
    65  //	If ``check_circular`` is false, then the circular reference check
    66  //	for container types will be skipped and a circular reference will
    67  //	result in an ``RecursionError`` (or worse).
    68  //
    69  //	If ``allow_nan`` is false, then it will be a ``ValueError`` to
    70  //	serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
    71  //	strict compliance of the JSON specification, instead of using the
    72  //	JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
    73  //
    74  //	If ``indent`` is a non-negative integer, then JSON array elements and
    75  //	object members will be pretty-printed with that indent level. An indent
    76  //	level of 0 will only insert newlines. ``None`` is the most compact
    77  //	representation.
    78  //
    79  //	If specified, ``separators`` should be an ``(item_separator, key_separator)``
    80  //	tuple.  The default is ``(', ', ': ')`` if *indent* is ``None`` and
    81  //	``(',', ': ')`` otherwise.  To get the most compact JSON representation,
    82  //	you should specify ``(',', ':')`` to eliminate whitespace.
    83  //
    84  //	``default(obj)`` is a function that should return a serializable version
    85  //	of obj or raise TypeError. The default simply raises TypeError.
    86  //
    87  //	If *sort_keys* is true (default: ``False``), then the output of
    88  //	dictionaries will be sorted by key.
    89  //
    90  //	To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
    91  //	``.default()`` method to serialize additional types), specify it with
    92  //	the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
    93  //
    94  //go:linkname Dumps py.dumps
    95  func Dumps(obj *py.Object) *py.Object
    96  
    97  // Deserialize “fp“ (a “.read()“-supporting file-like object containing
    98  //
    99  //	a JSON document) to a Python object.
   100  //
   101  //	``object_hook`` is an optional function that will be called with the
   102  //	result of any object literal decode (a ``dict``). The return value of
   103  //	``object_hook`` will be used instead of the ``dict``. This feature
   104  //	can be used to implement custom decoders (e.g. JSON-RPC class hinting).
   105  //
   106  //	``object_pairs_hook`` is an optional function that will be called with the
   107  //	result of any object literal decoded with an ordered list of pairs.  The
   108  //	return value of ``object_pairs_hook`` will be used instead of the ``dict``.
   109  //	This feature can be used to implement custom decoders.  If ``object_hook``
   110  //	is also defined, the ``object_pairs_hook`` takes priority.
   111  //
   112  //	To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
   113  //	kwarg; otherwise ``JSONDecoder`` is used.
   114  //
   115  //go:linkname Load py.load
   116  func Load(fp *py.Object) *py.Object
   117  
   118  // Deserialize “s“ (a “str“, “bytes“ or “bytearray“ instance
   119  //
   120  //	containing a JSON document) to a Python object.
   121  //
   122  //	``object_hook`` is an optional function that will be called with the
   123  //	result of any object literal decode (a ``dict``). The return value of
   124  //	``object_hook`` will be used instead of the ``dict``. This feature
   125  //	can be used to implement custom decoders (e.g. JSON-RPC class hinting).
   126  //
   127  //	``object_pairs_hook`` is an optional function that will be called with the
   128  //	result of any object literal decoded with an ordered list of pairs.  The
   129  //	return value of ``object_pairs_hook`` will be used instead of the ``dict``.
   130  //	This feature can be used to implement custom decoders.  If ``object_hook``
   131  //	is also defined, the ``object_pairs_hook`` takes priority.
   132  //
   133  //	``parse_float``, if specified, will be called with the string
   134  //	of every JSON float to be decoded. By default this is equivalent to
   135  //	float(num_str). This can be used to use another datatype or parser
   136  //	for JSON floats (e.g. decimal.Decimal).
   137  //
   138  //	``parse_int``, if specified, will be called with the string
   139  //	of every JSON int to be decoded. By default this is equivalent to
   140  //	int(num_str). This can be used to use another datatype or parser
   141  //	for JSON integers (e.g. float).
   142  //
   143  //	``parse_constant``, if specified, will be called with one of the
   144  //	following strings: -Infinity, Infinity, NaN.
   145  //	This can be used to raise an exception if invalid JSON numbers
   146  //	are encountered.
   147  //
   148  //	To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
   149  //	kwarg; otherwise ``JSONDecoder`` is used.
   150  //
   151  //go:linkname Loads py.loads
   152  func Loads(s *py.Object) *py.Object