�
*bH �
� � d Z ddlZddlZddlZddlmZmZmZmZm Z m
Z
mZmZ ddl
mZ ddlmZmZmZmZ ej e� � Z d+deded ed
eegef deegef defd
�Z G d� d� � Z G d� de� � Z G d� dej � � Z edd�� � Z G d� dej ej e�� � Z!de"defd�Z#d,dede
e$ dede"fd�Z%de"defd�Z&d,dede
e$ dede"fd �Z'd!ej( defd"�Z)d#edej( fd$�Z*d%ej( defd&�Z+d#edej( fd'�Z, ed(d)�� � Z- G d*� d)e!� � Z.dS )-z�JSON (de)serialization framework.
The framework presented here is somewhat based on `Go's "json" package`_
(especially the ``omitempty`` functionality).
.. _`Go's "json" package`: http://golang.org/pkg/encoding/json/
� N)�Any�Callable�Dict�List�Mapping�Optional�Type�TypeVar)�crypto)�b64�errors�
interfaces�utilF� json_name�default� omitempty�decoder�encoder�returnc �* � t | ||||�� � S )a4 Convenient function to declare a :class:`Field` with proper type annotations.
This function allows to write the following code:
import josepy
class JSON(josepy.JSONObjectWithFields):
typ: str = josepy.field('type')
def other_type(self) -> str:
return self.typ
�r r r r r )�_TypedFieldr s �2/usr/lib/python3/dist-packages/josepy/json_util.py�fieldr s& |