403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/josepy/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/josepy/__pycache__/interfaces.cpython-314.pyc
+
fH\io���Rt^RIt^RIt^RIHtHt^RIHtHtH	t	H
t
^RIHt]	!RRR7t
!RR]PR	7tR#)
zJOSE interfaces.N)�Mapping�Sequence)�Any�Type�TypeVar�Union)�errors�GenericJSONDeSerializable�JSONDeSerializable)�boundc�a�]tRt^
toRt]PV3RlRl4tV3RlRlt]	]PV3RlRl44t
]	V3RlR	l4tV3R
lRltV3RlR
lt
]	V3RlRl4tRtVtR#)r
a�Interface for (de)serializable JSON objects.

Please recall, that standard Python library implements
:class:`json.JSONEncoder` and :class:`json.JSONDecoder` that perform
translations based on respective :ref:`conversion tables
<conversion-table>` that look pretty much like the one below (for
complete tables see relevant Python documentation):

.. _conversion-table:

======  ======
 JSON   Python
======  ======
object  dict
...     ...
======  ======

While the above **conversion table** is about translation of JSON
documents to/from the basic Python types only,
:class:`JSONDeSerializable` introduces the following two concepts:

  serialization
    Turning an arbitrary Python object into Python object that can
    be encoded into a JSON document. **Full serialization** produces
    a Python object composed of only basic types as required by the
    :ref:`conversion table <conversion-table>`. **Partial
    serialization** (accomplished by :meth:`to_partial_json`)
    produces a Python object that might also be built from other
    :class:`JSONDeSerializable` objects.

  deserialization
    Turning a decoded Python object (necessarily one of the basic
    types as required by the :ref:`conversion table
    <conversion-table>`) into an arbitrary Python object.

Serialization produces **serialized object** ("partially serialized
object" or "fully serialized object" for partial and full
serialization respectively) and deserialization produces
**deserialized object**, both usually denoted in the source code as
``jobj``.

Wording in the official Python documentation might be confusing
after reading the above, but in the light of those definitions, one
can view :meth:`json.JSONDecoder.decode` as decoder and
deserializer of basic types, :meth:`json.JSONEncoder.default` as
serializer of basic types, :meth:`json.JSONEncoder.encode`  as
serializer and encoder of basic types.

One could extend :mod:`json` to support arbitrary object
(de)serialization either by:

  - overriding :meth:`json.JSONDecoder.decode` and
    :meth:`json.JSONEncoder.default` in subclasses

  - or passing ``object_hook`` argument (or ``object_hook_pairs``)
    to :func:`json.load`/:func:`json.loads` or ``default`` argument
    for :func:`json.dump`/:func:`json.dumps`.

Interestingly, ``default`` is required to perform only partial
serialization, as :func:`json.dumps` applies ``default``
recursively. This is the idea behind making :meth:`to_partial_json`
produce only partial serialization, while providing custom
:meth:`json_dumps` that dumps with ``default`` set to
:meth:`json_dump_default`.

To make further documentation a bit more concrete, please, consider
the following imaginatory implementation example::

  class Foo(JSONDeSerializable):
      def to_partial_json(self):
          return 'foo'

      @classmethod
      def from_json(cls, jobj):
          return Foo()

  class Bar(JSONDeSerializable):
      def to_partial_json(self):
          return [Foo(), Foo()]

      @classmethod
      def from_json(cls, jobj):
          return Bar()

c� <�V^8�dQhRS[/#���return�r)�format�
__classdict__s"��3/usr/lib/python3/dist-packages/josepy/interfaces.py�__annotate__�JSONDeSerializable.__annotate__es���$�$��$�c��\4h)a�Partially serialize.

Following the example, **partial serialization** means the following::

  assert isinstance(Bar().to_partial_json()[0], Foo)
  assert isinstance(Bar().to_partial_json()[1], Foo)

  # in particular...
  assert Bar().to_partial_json() != ['foo', 'foo']

:raises josepy.errors.SerializationError:
    in case of any serialization error.
:returns: Partially serializable object.

)�NotImplementedError��selfs&r�to_partial_json�"JSONDeSerializable.to_partial_jsonds
��""�#�#rc� <�V^8�dQhRS[/#rr)rrs"�rrrws��� � �� rc�&a�RV3RlloS!V4#)aFully serialize.

Again, following the example from before, **full serialization**
means the following::

  assert Bar().to_json() == ['foo', 'foo']

:raises josepy.errors.SerializationError:
    in case of any serialization error.
:returns: Fully serialized object.

c�0�V^8�dQhR\R\/#)r�objrr)rs"rr�0JSONDeSerializable.to_json.<locals>.__annotate__�s��	�	�C�	�C�	rc� <�\V\4'dS!VP44#\V\4'dV#\V\4'dVUu.uFpS!V4NK
	up#\V\
4'd3\;QJd.V3RlV4FNK	5#!V3RlV44#\V\4'd2VP4UUu/uFwr#S!V4S!V4bK	upp#V#uupiuuppi)c3�4<"�TF
pS!V4x�K	R#5i)N�)�.0�subobj�
_serializes& �r�	<genexpr>�AJSONDeSerializable.to_json.<locals>._serialize.<locals>.<genexpr>�s����B�c�F�Z��/�/�c�s�)	�
isinstancer
r�str�listr�tupler�items)r!r'�key�valuer(s&   �rr(�.JSONDeSerializable.to_json.<locals>._serialize�s�����#�1�2�2�!�#�"5�"5�"7�8�8��#�s�#�#��
��C��&�&�9<�=��v�
�6�*��=�=��C��*�*��u�B�c�B�u�B�u�B�c�B�B�B��C��)�)�MP�Y�Y�[�Y�[�z�s�
�3���E�):�:�[�Y�Y��
��>��Zs� D�%D
r%)rr(s&@r�to_json�JSONDeSerializable.to_jsonws���	�	� �$��rc�<<�V^8�dQhRS[S[,RS[RS[/#)r�cls�jobjr)rr	r)rrs"�rrr�s)�����t�5�6��c��F_�rc��V!4#)a�Deserialize a decoded JSON document.

:param jobj: Python object, composed of only other basic data
    types, as decoded from JSON document. Not necessarily
    :class:`dict` (as decoded from "JSON object" document).

:raises josepy.errors.DeserializationError:
    if decoding was unsuccessful, e.g. in case of unparseable
    X509 certificate, or wrong padding in JOSE base64 encoded
    string, etc.

r%)r6r7s&&r�	from_json�JSONDeSerializable.from_json�s��"�u�rc�R<�V^8�dQhRS[S[,RS[S[S[3,RS[/#)rr6�json_stringr)rr	rr,�bytes)rrs"�rrr�s4���$�$�
�+�
,�$�;@��e��;L�$�	"�$rc��\P!V4pTPT4# \dp\P!T4hRp?ii;i)z&Deserialize from JSON document string.N)�json�loads�
ValueErrorr�DeserializationErrorr9)r6r<r@�errors&&  r�
json_loads�JSONDeSerializable.json_loads�sI��
	5��J�J�{�+�E��}�}�U�#�#���	5��-�-�e�4�4��	5�s�)�A�A
�
Ac�&<�V^8�dQhRS[RS[/#)r�kwargsr)rr,)rrs"�rrr�s���J�J�3�J�3�Jrc�H�\P!V3RVP/VB#)z[Dump to JSON string using proper serializer.

:returns: JSON document string.
:rtype: str

�default)r?�dumps�json_dump_default)rrGs&,r�
json_dumps�JSONDeSerializable.json_dumps�s#���z�z�$�I��(>�(>�I�&�I�Irc� <�V^8�dQhRS[/#r)r,)rrs"�rrr�s���Q�Q�3�Qrc�*�VPR^RR7#)z>Dump the object to pretty JSON document string.

:rtype: str

T)�	sort_keys�indent�
separators)�,z: )rLrs&r�json_dumps_pretty�$JSONDeSerializable.json_dumps_pretty�s������a�K��P�Prc�$<�V^8�dQhRRRS[/#)r�
python_objectr
rr)rrs"�rrr�s ���O�O�.B�O�s�Orc��\V\4'dVP4#\\	V4R,4h)auSerialize Python object.

This function is meant to be passed as ``default`` to
:func:`json.dump` or :func:`json.dumps`. They call
``default(python_object)`` only for non-basic Python types, so
this function necessarily raises :class:`TypeError` if
``python_object`` is not an instance of
:class:`IJSONSerializable`.

Please read the class docstring for more information.

z is not JSON serializable)r+r
r�	TypeError�repr)r6rWs&&rrK�$JSONDeSerializable.json_dump_default�s7���m�%7�8�8� �0�0�2�2��D��/�2M�M�N�Nrr%N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__�abc�abstractmethodrr3�classmethodr9rDrLrTrK�__static_attributes__�__classdictcell__)rs@rr
r

s�����T�l	���$��$�$ � �@��������"�$��$�J�J�Q�Q��O��Or)�	metaclass)r`rar?�collections.abcrr�typingrrrr�josepyrr	�ABCMetar
r%rr�<module>rks=���
��-�,�,��#�$?�G[�\��JO�3�;�;�JOr

Youez - 2016 - github.com/yon3zu
LinuXploit