
pVc           @  s7  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l m
 Z
 d  d l m Z d  d l m Z d  d l m Z d  d l m Z m Z m Z m Z d  d l m Z d  d	 l m Z d  d
 l m Z m Z d  d l m Z m  Z  m! Z! d  d l" m# Z# m$ Z$ d  d l% m& Z& d  d l' m( Z( d  d l) m* Z+ d  d l, m- Z- d  d l. m/ Z/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 m6 Z6 d  d l7 m Z d  d l8 m9 Z9 d  d l: m; Z; m< Z< m= Z= d f  d     YZ> d   Z? d   Z@ d   ZA d   ZB d   ZC eD eD d  ZE d eF f d     YZG d eF f d     YZH d  eI f d!     YZJ d" ZK d# ZL d$ ZM d% ZN d& ZO d' eF f d(     YZP d) eP f d*     YZQ d+ eP f d,     YZR d- eP f d.     YZS d/ eS f d0     YZT d1 eS f d2     YZU d3 eS f d4     YZV d5 eS f d6     YZW d7 eP f d8     YZX d9 eS f d:     YZY d; eP f d<     YZZ d= eP f d>     YZ[ d? eP f d@     YZ\ dA eP f dB     YZ] dC eP f dD     YZ^ dE eP f dF     YZ_ dG eP f dH     YZ` dI eP f dJ     YZa dK ea f dL     YZb dM ea f dN     YZ dO eP f dP     YZc dQ ec f dR     YZ dS eP f dT     YZd dU eP f dV     YZe dW eP f dX     YZf dY eP f dZ     YZg d[ eP f d\     YZh d] eP f d^     YZi d_ eP f d`     YZj da eP f db     YZk d S(c   i(   t   unicode_literalsN(   t   OrderedDict(   t   settings(   t   ValidationError(   t   ObjectDoesNotExist(   t   EmailValidatort   RegexValidatort   URLValidatort   ip_address_validators(   t   FilePathField(   t
   ImageField(   t   sixt   timezone(   t
   parse_datet   parse_datetimet
   parse_time(   t   is_protected_typet
   smart_text(   t   cached_property(   t   clean_ipv6_address(   t   ugettext_lazy(   t   ISO_8601(   t   MaxLengthValidatort   MaxValueValidatort   MinLengthValidatort   MinValueValidatort   duration_stringt   parse_durationt   unicode_reprt   unicode_to_repr(   t   api_settings(   t   htmlt   humanize_datetimet   representationt   emptyc           B  s   e  Z d  Z RS(   u   
    This class is used to represent no data being provided for a given input
    or output value.

    It is required because `None` may be a valid input or output value.
    (   t   __name__t
   __module__t   __doc__(    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR"   '   s   c         C  s   t  j |   } t  j |   } | p' | s. t St  j |   \ } } } } | r[ t |  n t |  d } | r} t |  n d } | | k S(   uC   
    True if the object is a callable that takes no arguments.
    i   i    (   t   inspectt
   isfunctiont   ismethodt   Falset
   getargspect   len(   t   objt   functiont   methodt   argst   _t   defaultst   len_argst   len_defaults(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   is_simple_callable1   s    "c         C  s   x | D] } |  d k r d Sy2 t |  t j  r? |  | }  n t |  |  }  Wn t k
 rc d SXt |   r y |    }  Wq t t f k
 r } t	 d j
 | |    q Xq q W|  S(   u   
    Similar to Python's built in `getattr(instance, attr)`,
    but takes a list of nested attributes, instead of a single attribute.

    Also accepts either attribute lookup on objects or dictionary lookups.
    uI   Exception raised in callable attribute "{0}"; original exception was: {1}N(   t   Nonet
   isinstancet   collectionst   Mappingt   getattrR   R4   t   AttributeErrort   KeyErrort
   ValueErrort   format(   t   instancet   attrst   attrt   exc(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   get_attributeA   s    #c         C  sa   | s |  j  |  d Sx5 | d  D]) } | |  k rA i  |  | <n  |  | }  q" W| |  | d <d S(   u1  
    Similar to Python's built in `dictionary[key] = value`,
    but takes a list of nested keys instead of a single key.

    set_value({'a': 1}, [], {'b': 2}) -> {'a': 1, 'b': 2}
    set_value({'a': 1}, ['x'], 2) -> {'a': 1, 'x': 2}
    set_value({'a': 1}, ['x', 'y'], 2) -> {'a': 1, 'x': {'y': 2}}
    Ni(   t   update(   t
   dictionaryt   keyst   valuet   key(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt	   set_value_   s    	c         C  s~   t    } xn |  D]f } t | t t f  s8 | | | <q | \ } } t | t t f  rl t |  | | <q | | | <q W| S(   u   
    Convert choices into key/value dicts.

    pairwise_choices([1]) -> {1: 1}
    pairwise_choices([(1, '1st'), (2, '2nd')]) -> {1: '1st', 2: '2nd'}
    pairwise_choices([('Group', ((1, '1st'), 2))]) -> {'Group': {1: '1st', 2: '2nd'}}
    (   R   R6   t   listt   tuplet   to_choices_dict(   t   choicest   rett   choiceRG   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRK   t   s    	c         C  sm   t    } x] |  j   D]O \ } } t | t  r[ x1 | j   D] \ } } | | | <q> Wq | | | <q W| S(   u   
    Convert a group choices dict into a flat dict of choices.

    flatten_choices({1: '1st', 2: '2nd'}) -> {1: '1st', 2: '2nd'}
    flatten_choices({'Group': {1: '1st', 2: '2nd'}}) -> {1: '1st', 2: '2nd'}
    (   R   t   itemsR6   t   dict(   RL   RM   RG   RF   t   sub_keyt	   sub_value(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   flatten_choices_dict   s    	c      	   c  s]  d t  f d     Y} d t  f d     Y} d t  f d     Y} d } x |  j   D] \ } } | rw | | k rw Pn  t | t  r | d |  VxN | j   D]@ \ }	 }
 | r | | k r Pn  | d	 |	 d
 |
  V| d 7} q W|   VqU | d	 | d
 |  V| d 7} qU W| rY| | k rY| rY| j d |  } | d	 d d
 | d t  Vn  d S(   uE   
    Helper function for options and option groups in templates.
    t   StartOptionGroupc           B  s   e  Z e Z e Z d    Z RS(   c         S  s   | |  _  d  S(   N(   t   label(   t   selfRU   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   __init__   s    (   R#   R$   t   Truet   start_option_groupR)   t   end_option_groupRW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRT      s   t   EndOptionGroupc           B  s   e  Z e Z e Z RS(    (   R#   R$   R)   RY   RX   RZ   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR[      s   t   Optionc           B  s    e  Z e Z e Z e d   Z RS(   c         S  s   | |  _  | |  _ | |  _ d  S(   N(   RF   t   display_textt   disabled(   RV   RF   R]   R^   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW      s    		(   R#   R$   R)   RY   RZ   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR\      s   i    RU   RF   R]   i   t   countu   n/aR^   N(   t   objectRO   R6   RP   R=   RX   (   t   grouped_choicest   cutofft   cutoff_textRT   R[   R\   R_   RG   RF   RQ   RR   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   iter_options   s(    	t   CreateOnlyDefaultc           B  s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   u   
    This class may be used to provide default values that are only used
    for create operations, but that do not return any value for update
    operations.
    c         C  s   | |  _  d  S(   N(   t   default(   RV   Rf   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW      s    c         C  sW   | j  j d  k	 |  _ t |  j  rS t |  j d  rS |  j rS |  j j |  n  d  S(   Nu   set_context(   t   parentR>   R5   t	   is_updatet   callableRf   t   hasattrt   set_context(   RV   t   serializer_field(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRk      s    +c         C  s5   |  j  r t    n  t |  j  r. |  j   S|  j S(   N(   Rh   t	   SkipFieldRi   Rf   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   __call__   s
    	
c         C  s#   t  d |  j j t |  j  f  S(   Nu   %s(%s)(   R   t	   __class__R#   R   Rf   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   __repr__   s    (   R#   R$   R%   RW   Rk   Rn   Rp   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRe      s
   			t   CurrentUserDefaultc           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  s   | j  d j |  _ d  S(   Nu   request(   t   contextt   user(   RV   Rl   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRk      s    c         C  s   |  j  S(   N(   Rs   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRn      s    c         C  s   t  d |  j j  S(   Nu   %s()(   R   Ro   R#   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRp      s    (   R#   R$   Rk   Rn   Rp   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRq      s   		Rm   c           B  s   e  Z RS(    (   R#   R$   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRm      s   u-   May not set both `read_only` and `write_only`u+   May not set both `read_only` and `required`u)   May not set both `required` and `default`u-   Field(read_only=True) should be ReadOnlyFieldur   ValidationError raised by `{class_name}`, but error key `{key}` does not exist in the `error_messages` dictionary.t   Fieldc           B  s6  e  Z d  Z i e d  d 6e d  d 6Z g  Z e Z d Z	 e
 e
 d e e d d d d d d e
 d  Z d   Z e d    Z e j d    Z d	   Z d
   Z d   Z d   Z d   Z d   Z e d  Z d   Z d   Z d   Z d   Z e d    Z e d    Z d   Z d   Z d   Z  RS(   i    u   This field is required.u   requiredu   This field may not be null.u   nullc         C  s  t  j |  _ t  j d 7_ | d  k r= | t k o7 | } n  | oF | sV t t   | o_ | so t t   | o~ | t k	 s t t   | o |  j t  k s t t	   | |  _
 | |  _ | |  _ | |  _ | |  _ | t k r |  j n | |  _ | |  _ | |  _ |	 d  k ri  n |	 |  _ | |  _ |  j t k	 r[| t k	 r[| |  _ q[n  | d  k	 rt| |  _ n  d  |  _ d  |  _ i  } x3 t |  j j  D] } | j t | d i    qW| j |
 pi   | |  _ d  S(   Ni   u   default_error_messages(   Rt   t   _creation_counterR5   R"   t   AssertionErrort   NOT_READ_ONLY_WRITE_ONLYt   NOT_READ_ONLY_REQUIREDt   NOT_REQUIRED_DEFAULTRo   t   USE_READONLYFIELDt	   read_onlyt
   write_onlyt   requiredRf   t   sourcet   initialRU   t	   help_textt   stylet
   allow_nullt   default_empty_htmlt
   validatorst
   field_nameRg   t   reversedt   __mro__RC   R9   t   error_messages(   RV   R{   R|   R}   Rf   R   R~   RU   R   R   R   R   R   t   messagest   cls(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s<    "										c         C  s   |  j  | k s4 t d | |  j j | j j f   | |  _ | |  _ |  j d k rs | j d d  j	   |  _ n  |  j  d k r | |  _  n  |  j  d k r g  |  _
 n |  j  j d  |  _
 d S(   u   
        Initializes the field name and parent for the field instance.
        Called when a field is added to the parent serializer instance.
        u   It is redundant to specify `source='%s'` on field '%s' in serializer '%s', because it is the same as the field name. Remove the `source` keyword argument.u   _u    u   *u   .N(   R~   Rv   Ro   R#   R   Rg   RU   R5   t   replacet
   capitalizet   source_attrst   split(   RV   R   Rg   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   bind?  s    			c         C  s(   t  |  d  s! |  j   |  _ n  |  j S(   Nu   _validators(   Rj   t   get_validatorst   _validators(   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   c  s    c         C  s   | |  _  d  S(   N(   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   i  s    c         C  s   |  j  S(   N(   t   default_validators(   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   m  s    c         C  s   |  j  S(   u   
        Return a value to use when the field is being returned as a primitive
        value, without any object instance.
        (   R   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   get_initialp  s    c         C  s   t  j |  r |  j | k r> t |  j d t  r7 t S|  j S| |  j } | d k rz |  j rz t |  d t  rv d Sd S| d k r |  j
 r t |  d t  r d St S| S| j |  j t  S(   u   
        Given the *incoming* primitive data, return the value for this field
        that should be validated and transformed to a native value.
        u   partialu    u   allow_blankN(   R   t   is_html_inputR   R9   t   rootR)   R"   R   R   R5   R}   t   get(   RV   RD   RM   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt	   get_valuew  s    c         C  s   y t  | |  j  SWn t t f k
 r } |  j rQ |  j t k rQ t    n  d j d t	 |  j
 d |  j d |  j j j
 d | j j
 d |  } t	 |  |   n Xd S(   u~   
        Given the *outgoing* object instance, return the primitive value
        that should be used for this field.
        u   Got {exc_type} when attempting to get a value for field `{field}` on serializer `{serializer}`.
The serializer field might be named incorrectly and not match any attribute or key on the `{instance}` instance.
Original exception text was: {exc}.t   exc_typet   fieldt
   serializerR>   RA   N(   RB   R   R;   R:   R}   Rf   R"   Rm   R=   t   typeR#   R   Rg   Ro   (   RV   R>   RA   t   msg(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRB     s    			c         C  s`   |  j  t k r t    n  t |  j   rY t |  j  d  rO |  j  j |   n  |  j    S|  j  S(   u/  
        Return the default value to use when validating data if no input
        is provided for this field.

        If a default has not been set for this field then this will simply
        return `empty`, indicating that no value should be set in the
        validated data for this field.
        u   set_context(   Rf   R"   Rm   Ri   Rj   Rk   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   get_default  s    	
c         C  s   |  j  r t |  j   f S| t k ro t |  j d t  rF t    n  |  j r_ |  j	 d  n  t |  j   f S| d k r |  j s |  j	 d  n  t d f St | f S(   u  
        Validate empty values, and either:

        * Raise `ValidationError`, indicating invalid data.
        * Raise `SkipField`, indicating that the field should be ignored.
        * Return (True, data), indicating an empty value that should be
          returned without any further validation being applied.
        * Return (False, data), indicating a non-empty value, that should
          have validation applied as normal.
        u   partialu   requiredu   nullN(   R{   RX   R   R"   R9   R   R)   Rm   R}   t   failR5   R   (   RV   t   data(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   validate_empty_values  s    			
c         C  s?   |  j  |  \ } } | r | S|  j |  } |  j |  | S(   u  
        Validate a simple representation and return the internal value.

        The provided data may be `empty` if no representation was included
        in the input.

        May raise `SkipField` if the field should not be included in the
        validated data.
        (   R   t   to_internal_valuet   run_validators(   RV   R   t   is_empty_valueRF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   run_validation  s    
c         C  s   g  } x |  j  D] } t | d  r5 | j |   n  y | |  Wq t k
 r } t | j t  rm   n  | j | j  q t k
 r } | j | j	  q Xq W| r t |   n  d S(   u   
        Test the given value against all the validators on the field,
        and either raise a `ValidationError` or simply return.
        u   set_contextN(
   R   Rj   Rk   R   R6   t   detailRP   t   extendt   DjangoValidationErrorR   (   RV   RF   t   errorst	   validatorRA   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s"   t  d j d |  j j    d S(   uN   
        Transform the *incoming* primitive data into a native value.
        u.   {cls}.to_internal_value() must be implemented.R   N(   t   NotImplementedErrorR=   Ro   R#   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    	c         C  s+   t  d j d |  j j d |  j    d S(   uL   
        Transform the *outgoing* native value into primitive data.
        u   {cls}.to_representation() must be implemented for field {field_name}. If you do not need to support write operations you probably want to subclass `ReadOnlyField` instead.R   R   N(   R   R=   Ro   R#   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   to_representation  s    	c         K  st   y |  j  | } WnA t k
 rT |  j j } t j d | d |  } t |   n X| j |   } t |   d S(   uH   
        A helper method that simply raises a validation error.
        t
   class_nameRG   N(   R   R;   Ro   R#   t   MISSING_ERROR_MESSAGER=   Rv   R   (   RV   RG   t   kwargsR   R   t   message_string(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s)   |  } x | j  d k	 r$ | j  } q	 W| S(   uB   
        Returns the top-level serializer for this field.
        N(   Rg   R5   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   "  s    c         C  s   t  |  j d i   S(   uY   
        Returns the context as passed to the root serializer on initialization.
        u   _context(   R9   R   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRr   ,  s    c         O  s.   t  t |   j |   } | | _ | | _ | S(   u   
        When a field is instantiated, we store the arguments that were used,
        so that we can present a helpful representation of the object.
        (   t   superRt   t   __new__t   _argst   _kwargs(   R   R/   R   R>   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   3  s    		c         C  sk   t  j |  j  } t |  j  } | j d d  } t  j |  } | d k	 r[ | | d <n  |  j | |   S(   u   
        When cloning fields we instantiate using the arguments it was
        originally created with, rather than copying the complete state.
        u
   validatorsN(   t   copyt   deepcopyR   RP   R   t   popR5   Ro   (   RV   t   memoR/   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   __deepcopy__=  s    c         C  s   t  t j |    S(   u   
        Fields are represented using their initial calling arguments.
        This allows us to create descriptive representations for serializer
        instances that show all the declared fields on the serializer.
        (   R   R!   t
   field_repr(   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRp   N  s    N(!   R#   R$   Ru   R0   t   default_error_messagesR   R"   R   R5   R   R)   RW   R   t   propertyR   t   setterR   R   R   RB   R   R   R   R   R   R   R   R   R   Rr   R   R   Rp   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRt     s<   	+	$								
		
	
	t   BooleanFieldc        	   B  s   e  Z i e d   d 6Z e Z e Z d d d d d d d e h Z d	 d
 d d d d d d e h	 Z	 d   Z
 d   Z d   Z RS(   u!   "{input}" is not a valid boolean.u   invalidu   tu   Tu   trueu   Trueu   TRUEu   1i   u   fu   Fu   falseu   Falseu   FALSEu   0i    g        c         K  s2   d | k s t  d   t t |   j |   d  S(   Nu
   allow_nulluC   `allow_null` is not a valid option. Use `NullBooleanField` instead.(   Rv   R   R   RW   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   b  s    c         C  sU   y* | |  j  k r t S| |  j k r) t SWn t k
 r= n X|  j d d | d  S(   Nu   invalidt   input(   t   TRUE_VALUESRX   t   FALSE_VALUESR)   t	   TypeErrorR   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   f  s    c         C  s0   | |  j  k r t S| |  j k r& t St |  S(   N(   R   RX   R   R)   t   bool(   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   p  s
    (   R#   R$   R0   R   R)   R   R   RX   R   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   Y  s   !		
t   NullBooleanFieldc        	   B  s   e  Z i e d   d 6Z d Z d d d d d d d e h Z d	 d
 d d d d d d e h	 Z	 d d d d d d d h Z
 d   Z d   Z d   Z RS(   u!   "{input}" is not a valid boolean.u   invalidu   tu   Tu   trueu   Trueu   TRUEu   1i   u   fu   Fu   falseu   Falseu   FALSEu   0i    g        u   nu   Nu   nullu   Nullu   NULLu    c         K  s<   d | k s t  d   t | d <t t |   j |   d  S(   Nu
   allow_nullu#   `allow_null` is not a valid option.(   Rv   RX   R   R   RW   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    
c         C  sP   | |  j  k r t S| |  j k r& t S| |  j k r9 d  S|  j d d | d  S(   Nu   invalidR   (   R   RX   R   R)   t   NULL_VALUESR5   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  sC   | |  j  k r d  S| |  j k r& t S| |  j k r9 t St |  S(   N(   R   R5   R   RX   R   R)   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    N(   R#   R$   R0   R   R5   R   RX   R   R)   R   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   x  s   !			t	   CharFieldc           B  sb   e  Z i e d   d 6e d  d 6e d  d 6Z d Z d   Z e d  Z d	   Z d
   Z	 RS(   u   This field may not be blank.u   blanku;   Ensure this field has no more than {max_length} characters.u
   max_lengthu7   Ensure this field has at least {min_length} characters.u
   min_lengthu    c         K  s  | j  d t  |  _ | j  d t  |  _ | j  d d   |  _ | j  d d   |  _ t t	 |   j
 |   |  j d  k	 r |  j d j d |  j  } |  j j t |  j d |  n  |  j d  k	 r|  j d j d |  j  } |  j j t |  j d |  n  d  S(   Nu   allow_blanku   trim_whitespaceu
   max_lengthu
   min_lengtht
   max_lengtht   messaget
   min_length(   R   R)   t   allow_blankRX   t   trim_whitespaceR5   R   R   R   R   RW   R   R=   R   t   appendR   R   (   RV   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    "c         C  sc   | d k s0 |  j  rM t j |  j   d k rM |  j sI |  j d  n  d St t |   j |  S(   Nu    u   blank(	   R   R   t	   text_typet   stripR   R   R   R   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s
    0	c         C  s&   t  j |  } |  j r" | j   S| S(   N(   R   R   R   R   (   RV   R   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s   t  j |  S(   N(   R   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (
   R#   R$   R0   R   R   RW   R"   R   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   	
	t
   EmailFieldc           B  s$   e  Z i e d   d 6Z d   Z RS(   u   Enter a valid email address.u   invalidc         K  s@   t  t |   j |   t d |  j d  } |  j j |  d  S(   NR   u   invalid(   R   R   RW   R   R   R   R   (   RV   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    (   R#   R$   R0   R   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   t
   RegexFieldc           B  s$   e  Z i e d   d 6Z d   Z RS(   u/   This value does not match the required pattern.u   invalidc         K  sC   t  t |   j |   t | d |  j d } |  j j |  d  S(   NR   u   invalid(   R   R   RW   R   R   R   R   (   RV   t   regexR   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    (   R#   R$   R0   R   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   t	   SlugFieldc           B  s$   e  Z i e d   d 6Z d   Z RS(   uL   Enter a valid "slug" consisting of letters, numbers, underscores or hyphens.u   invalidc         K  sR   t  t |   j |   t j d  } t | d |  j d } |  j j |  d  S(   Nu   ^[-a-zA-Z0-9_]+$R   u   invalid(	   R   R   RW   t   ret   compileR   R   R   R   (   RV   R   t
   slug_regexR   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    (   R#   R$   R0   R   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   t   URLFieldc           B  s$   e  Z i e d   d 6Z d   Z RS(   u   Enter a valid URL.u   invalidc         K  s@   t  t |   j |   t d |  j d  } |  j j |  d  S(   NR   u   invalid(   R   R   RW   R   R   R   R   (   RV   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    (   R#   R$   R0   R   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   t	   UUIDFieldc           B  s<   e  Z d	 Z i e d  d 6Z d   Z d   Z d   Z RS(
   u   hex_verboseu   hexu   intu   urnu   "{value}" is not a valid UUID.u   invalidc         K  se   | j  d d  |  _ |  j |  j k rK t d j d j |  j     n  t t |   j |   d  S(   Nu   formatu   hex_verboseu<   Invalid format for uuid representation. Must be one of "{0}"u   ", "(	   R   t   uuid_formatt   valid_formatsR<   R=   t   joinR   R   RW   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  s   t  | t j  s y[ t  | t j  r7 t j d |  St  | t j  rY t j d |  S|  j d d | Wq t k
 r |  j d d | q Xn  | S(   Nt   intt   hexu   invalidRF   (   R6   t   uuidt   UUIDR   t   integer_typest   string_typesR   R<   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s-   |  j  d k r t |  St | |  j   Sd  S(   Nu   hex_verbose(   R   t   strR9   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    
(   u   hex_verboseu   hexu   intu   urn(   R#   R$   R   R0   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s   			t   IPAddressFieldc           B  s6   e  Z d  Z i e d  d 6Z d d  Z d   Z RS(   u5   Support both IPAddressField and GenericIPAddressFieldu#   Enter a valid IPv4 or IPv6 address.u   invalidu   bothc         K  sc   | j    |  _ |  j d k |  _ t t |   j |   t | |  j  \ } } |  j j |  d  S(   Nu   both(	   t   lowert   protocolt   unpack_ipv4R   R   RW   R   R   R   (   RV   R   R   R   t   error_message(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s
    c         C  su   | r_ d | k r_ y# |  j  d k r4 t | |  j  SWq_ t k
 r[ |  j d d | q_ Xn  t t |   j |  S(   Nu   :u   bothu   ipv6u   invalidRF   (   u   bothu   ipv6(   R   R   R   R   R   R   R   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   !  s    (   R#   R$   R%   R0   R   RW   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s
   t   IntegerFieldc           B  sr   e  Z i e d   d 6e d  d 6e d  d 6e d  d 6Z d Z e j d	  Z d
   Z d   Z	 d   Z
 RS(   u   A valid integer is required.u   invalidu7   Ensure this value is less than or equal to {max_value}.u	   max_valueu:   Ensure this value is greater than or equal to {min_value}.u	   min_valueu   String value too large.u   max_string_lengthi  u   \.0*\s*$c         K  s   | j  d d   |  _ | j  d d   |  _ t t |   j |   |  j d  k	 r |  j d j d |  j  } |  j	 j
 t |  j d |  n  |  j d  k	 r |  j d j d |  j  } |  j	 j
 t |  j d |  n  d  S(   Nu	   max_valueu	   min_valuet	   max_valueR   t	   min_value(   R   R5   R   R   R   R   RW   R   R=   R   R   R   R   (   RV   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   8  s    "c         C  s   t  | t j  r7 t |  |  j k r7 |  j d  n  y% t |  j j d t	 |    } Wn$ t
 t f k
 r |  j d  n X| S(   Nu   max_string_lengthu    u   invalid(   R6   R   R   R+   t   MAX_STRING_LENGTHR   R   t
   re_decimalt   subR   R<   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   C  s    '%c         C  s
   t  |  S(   N(   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   M  s    (   R#   R$   R0   R   R   R   R   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   .  s   		
t
   FloatFieldc           B  sc   e  Z i e d   d 6e d  d 6e d  d 6e d  d 6Z d Z d	   Z d
   Z d   Z RS(   u   A valid number is required.u   invalidu7   Ensure this value is less than or equal to {max_value}.u	   max_valueu:   Ensure this value is greater than or equal to {min_value}.u	   min_valueu   String value too large.u   max_string_lengthi  c         K  s   | j  d d   |  _ | j  d d   |  _ t t |   j |   |  j d  k	 r |  j d j d |  j  } |  j	 j
 t |  j d |  n  |  j d  k	 r |  j d j d |  j  } |  j	 j
 t |  j d |  n  d  S(   Nu	   max_valueu	   min_valueR   R   R   (   R   R5   R   R   R   R   RW   R   R=   R   R   R   R   (   RV   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   Z  s    "c         C  sp   t  | t j  r7 t |  |  j k r7 |  j d  n  y t |  SWn$ t t f k
 rk |  j d  n Xd  S(   Nu   max_string_lengthu   invalid(	   R6   R   R   R+   R   R   t   floatR   R<   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   e  s    'c         C  s
   t  |  S(   N(   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   n  s    (   R#   R$   R0   R   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   Q  s   			t   DecimalFieldc           B  s   e  Z i e d   d 6e d  d 6e d  d 6e d  d 6e d  d	 6e d
  d 6e d  d 6Z d Z d d d d  Z d   Z d   Z d   Z	 d   Z
 RS(   u   A valid number is required.u   invalidu7   Ensure this value is less than or equal to {max_value}.u	   max_valueu:   Ensure this value is greater than or equal to {min_value}.u	   min_valueu@   Ensure that there are no more than {max_digits} digits in total.u
   max_digitsuG   Ensure that there are no more than {max_decimal_places} decimal places.u   max_decimal_placesuV   Ensure that there are no more than {max_whole_digits} digits before the decimal point.u   max_whole_digitsu   String value too large.u   max_string_lengthi  c         K  s-  | |  _  | |  _ | d  k	 r* | |  _ n  | |  _ | |  _ |  j  d  k	 rp |  j d  k	 rp |  j  |  j |  _ n	 d  |  _ t t |   j	 |   |  j d  k	 r |  j
 d j d |  j  } |  j j t |  j d |  n  |  j d  k	 r)|  j
 d j d |  j  } |  j j t |  j d |  n  d  S(   Nu	   max_valueR   R   u	   min_valueR   (   t
   max_digitst   decimal_placesR5   t   coerce_to_stringR   R   t   max_whole_digitsR   R   RW   R   R=   R   R   R   R   (   RV   R   R   R   R   R   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   ~  s     					"c         C  s   t  |  j   } t |  |  j k r7 |  j d  n  y t j |  } Wn! t j k
 rm |  j d  n X| | k r |  j d  n  | t j d  t j d  f k r |  j d  n  |  j |  S(   ud   
        Validate that the input is a decimal number and return a Decimal
        instance.
        u   max_string_lengthu   invalidu   Infu   -Inf(	   R   R   R+   R   R   t   decimalt   Decimalt   DecimalExceptiont   validate_precision(   RV   R   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    $c         C  sD  | j    \ } } } | d k r@ t |  | } | } d } n[ t |  t |  k r t |  } | t |  } t |  } n t |  } d } | } |  j d k	 r | |  j k r |  j d d |  j n  |  j d k	 r	| |  j k r	|  j d d |  j n  |  j d k	 r@| |  j k r@|  j d d |  j n  | S(	   u  
        Ensure that there are no more than max_digits in the number, and no
        more than decimal_places digits after the decimal point.

        Override this method to disable the precision validation for input
        values or to enhance it in any way you need to.
        i    u
   max_digitsR   u   max_decimal_placest   max_decimal_placesu   max_whole_digitsR   N(   t   as_tupleR+   t   absR   R5   R   R   R   (   RV   RF   t   signt
   digittuplet   exponentt   total_digitst   whole_digitsR   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s&    	c         C  sn   t  |  d t j  } t | t j  sH t j t j |  j    } n  |  j	 |  } | sa | Sd j
 |  S(   Nu   coerce_to_stringu   {0:f}(   R9   R   t   COERCE_DECIMAL_TO_STRINGR6   R   R   R   R   R   t   quantizeR=   (   RV   RF   R   t	   quantized(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    !c         C  sA   t  j   j   } |  j | _ | j t  j d  |  j d | S(   uI   
        Quantize the decimal value to the configured precision.
        u   .1Rr   (   R   t
   getcontextR   R   t   precR   R   R   (   RV   RF   Rr   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s
    N(   R#   R$   R0   R   R   R5   RW   R   R   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   r  s   		#	t   DateTimeFieldc           B  sj   e  Z i e d   d 6e d  d 6Z e j j Z e d	 d	 d  Z	 d   Z
 d   Z d   Z d   Z RS(
   uF   Datetime has wrong format. Use one of these formats instead: {format}.u   invalidu#   Expected a datetime but got a date.u   datec         O  se   | t  k	 r | |  _ n  | d  k	 r0 | |  _ n  | d  k	 rH | |  _ n  t t |   j | |   d  S(   N(   R"   R=   R5   t   input_formatsR   R   R  RW   (   RV   R=   R  t   default_timezoneR/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  sy   t  |  d |  j    } | d k	 rD t j |  rD t j | |  S| d k ru t j |  ru t j | t j    S| S(   u   
        When `self.default_timezone` is `None`, always return naive datetimes.
        When `self.default_timezone` is not `None`, always return aware datetimes.
        u   timezoneN(   R9   R  R5   R   t   is_awaret
   make_awaret
   make_naivet   UTC(   RV   RF   t   field_timezone(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   enforce_timezone  s    c         C  s   t  j r t j   Sd  S(   N(   R   t   USE_TZR   t   get_default_timezoneR5   (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR    s    c         C  s5  t  |  d t j  } t | t j  rJ t | t j  rJ |  j d  n  t | t j  ri |  j |  Sx | D] } | j   t	 k r y t
 |  } Wn t t f k
 r qX| d  k	 r|  j |  Sqp y |  j | |  } Wn t t f k
 r qp X|  j |  Sqp Wt j |  } |  j d d | d  S(   Nu   input_formatsu   dateu   invalidR=   (   R9   R   t   DATETIME_INPUT_FORMATSR6   t   datetimet   dateR   R  R   R   R   R<   R   R5   t   datetime_parserR    t   datetime_formats(   RV   RF   R  t   input_formatt   parsedt   humanized_format(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   
  s(    %c         C  st   t  |  d t j  } | d  k r% | S| j   t k rg | j   } | j d  rc | d  d } n  | S| j |  S(   Nu   formatu   +00:00iu   Z(	   R9   R   t   DATETIME_FORMATR5   R   R   t	   isoformatt   endswitht   strftime(   RV   RF   t   output_format(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   '  s    N(   R#   R$   R0   R   R  t   strptimeR  R"   R5   RW   R  R  R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR    s   				t	   DateFieldc           B  sU   e  Z i e d   d 6e d  d 6Z e j j Z e d d  Z	 d   Z
 d   Z RS(   uB   Date has wrong format. Use one of these formats instead: {format}.u   invalidu#   Expected a date but got a datetime.u   datetimec         O  sM   | t  k	 r | |  _ n  | d  k	 r0 | |  _ n  t t |   j | |   d  S(   N(   R"   R=   R5   R  R   R  RW   (   RV   R=   R  R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   <  s
    c         C  s  t  |  d t j  } t | t j  r7 |  j d  n  t | t j  rM | Sx | D] } | j   t k r y t	 |  } Wn t
 t f k
 r q X| d  k	 r | SqT y |  j | |  } Wn t
 t f k
 r qT X| j   SqT Wt j |  } |  j d d | d  S(   Nu   input_formatsu   datetimeu   invalidR=   (   R9   R   t   DATE_INPUT_FORMATSR6   R  R   R  R   R   R   R<   R   R5   R  R    t   date_formats(   RV   RF   R  R  R  R  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   C  s(    c         C  s   t  |  d t j  } | s d  S| d  k r/ | St | t j  sN t d   | j   t k r t | t	  r t j j
 | d  j   } n  | j   S| j |  S(   Nu   formatu   Expected a `date`, but got a `datetime`. Refusing to coerce, as this may mean losing timezone information. Use a custom read-only field and deal with timezone issues explicitly.u   %Y-%m-%d(   R9   R   t   DATE_FORMATR5   R6   R  Rv   R   R   R   R  R  R  R  (   RV   RF   R  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   `  s    	
N(   R#   R$   R0   R   R  R  R  R"   R5   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR  5  s   	t	   TimeFieldc           B  sH   e  Z i e d   d 6Z e j j Z e d d  Z	 d   Z
 d   Z RS(   uB   Time has wrong format. Use one of these formats instead: {format}.u   invalidc         O  sM   | t  k	 r | |  _ n  | d  k	 r0 | |  _ n  t t |   j | |   d  S(   N(   R"   R=   R5   R  R   R!  RW   (   RV   R=   R  R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s
    c         C  s   t  |  d t j  } t | t j  r+ | Sx | D] } | j   t k r y t |  } Wn t	 t
 f k
 rs q X| d  k	 r | Sq2 y |  j | |  } Wn t	 t
 f k
 r q2 X| j   Sq2 Wt j |  } |  j d d | d  S(   Nu   input_formatsu   invalidR=   (   R9   R   t   TIME_INPUT_FORMATSR6   R  t   timeR   R   R   R<   R   R5   R  R    t   time_formatsR   (   RV   RF   R  R  R  R  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s$    c         C  sm   t  |  d t j  } | d  k r% | St | t j  sD t d   | j   t k r` | j	   S| j
 |  S(   Nu   formatu   Expected a `time`, but got a `datetime`. Refusing to coerce, as this may mean losing timezone information. Use a custom read-only field and deal with timezone issues explicitly.(   R9   R   t   TIME_FORMATR5   R6   R  Rv   R   R   R  R  (   RV   RF   R  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    	
N(   R#   R$   R0   R   R  R  R  R"   R5   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR!  z  s   	t   DurationFieldc           B  s6   e  Z i e d   d 6Z d   Z d   Z d   Z RS(   uF   Duration has wrong format. Use one of these formats instead: {format}.u   invalidc         O  s4   t  d  k r t d   n  t t |   j | |   S(   Nu<   DurationField not supported for django versions prior to 1.8(   R   R5   R   R   R&  RW   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  sR   t  | t j  r | St t j |   } | d  k	 r; | S|  j d d d d  S(   Nu   invalidR=   u   [DD] [HH:[MM:]]ss[.uuuuuu](   R6   R  t	   timedeltaR   R   R   R5   R   (   RV   RF   R  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s
   t  |  S(   N(   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (   R#   R$   R0   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR&    s
   		t   ChoiceFieldc           B  sQ   e  Z i e d   d 6Z d Z e d  Z d   Z d   Z d   Z	 d   Z
 RS(   u    "{input}" is not a valid choice.u   invalid_choiceu   More than {count} items...c         K  s   t  |  |  _ t |  j  |  _ | j d |  j  |  _ | j d |  j  |  _ d   |  j j   D |  _ | j d t	  |  _
 t t |   j |   d  S(   Nu   html_cutoffu   html_cutoff_textc         S  s"   i  |  ] } | t  j |   q S(    (   R   R   (   t   .0RG   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pys
   <dictcomp>  s   	 u   allow_blank(   RK   Ra   RS   RL   R   t   html_cutofft   html_cutoff_textRE   t   choice_strings_to_valuesR)   R   R   R(  RW   (   RV   RL   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  s\   | d k r |  j  r d Sy |  j t j |  SWn$ t k
 rW |  j d d | n Xd  S(   Nu    u   invalid_choiceR   (   R   R,  R   R   R;   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s,   | d k r | S|  j j t j |  |  S(   Nu    (   u    N(   R5   R,  R   R   R   (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s   t  |  j d |  j d |  j S(   uP   
        Helper method for use with templates rendering select widgets.
        Rb   Rc   (   Rd   Ra   R*  R+  (   RV   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRd     s    		N(   R#   R$   R0   R   R5   R*  R+  RW   R   R   Rd   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR(    s   				t   MultipleChoiceFieldc           B  s_   e  Z i e d   d 6e d  d 6e d  d 6Z g  Z d   Z d   Z d   Z d	   Z RS(
   u    "{input}" is not a valid choice.u   invalid_choiceu5   Expected a list of items but got type "{input_type}".u
   not_a_listu    This selection may not be empty.u   emptyc         O  s2   | j  d t  |  _ t t |   j | |   d  S(   Nu   allow_empty(   R   RX   t   allow_emptyR   R-  RW   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  s]   |  j  | k r+ t |  j d t  r+ t Sn  t j |  rJ | j |  j   S| j |  j  t  S(   Nu   partial(	   R   R9   R   R)   R"   R   R   t   getlistR   (   RV   RD   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c           s   t  | t d   s% t | d  rD   j d d t |  j n    j rp t |  d k rp   j d  n    f d   | D S(   Nu    u   __iter__u
   not_a_listt
   input_typei    u   emptyc           s(   h  |  ] } t  t    j |   q S(    (   R   R-  R   (   R)  t   item(   RV   (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pys	   <setcomp>  s   	(   R6   R   Rj   R   R#   R.  R+   (   RV   R   (    (   RV   so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    %c           s     f d   | D S(   Nc           s.   h  |  ]$ }   j  j t j |  |   q S(    (   R,  R   R   R   (   R)  R1  (   RV   (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pys	   <setcomp>"  s   	 (    (   RV   RF   (    (   RV   so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR      s    (	   R#   R$   R0   R   R   RW   R   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR-    s   		
	R	   c           B  s3   e  Z i e d   d 6Z d e e e d d  Z RS(   u%   "{input}" is not a valid path choice.u   invalid_choicec   	      K  sQ   t  | d | d | d | d | d | } | j | d <t t |   j |   d  S(   Nt   matcht	   recursivet   allow_filest   allow_foldersR}   u   choices(   t   DjangoFilePathFieldRL   R   R	   RW   (	   RV   t   pathR2  R3  R4  R5  R}   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   +  s
    N(   R#   R$   R0   R   R5   R)   RX   RW   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR	   &  s   	t	   FileFieldc           B  sj   e  Z i e d   d 6e d  d 6e d  d 6e d  d 6e d  d	 6Z d
   Z d   Z d   Z RS(   u   No file was submitted.u   requireduG   The submitted data was not a file. Check the encoding type on the form.u   invalidu    No filename could be determined.u   no_nameu   The submitted file is empty.u   emptyuK   Ensure this filename has at most {max_length} characters (it has {length}).u
   max_lengthc         O  sh   | j  d d   |  _ | j  d t  |  _ d | k rK | j  d  |  _ n  t t |   j | |   d  S(   Nu
   max_lengthu   allow_empty_fileu   use_url(	   R   R5   R   R)   t   allow_empty_filet   use_urlR   R8  RW   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   B  s
    c      	   C  s   y | j  } | j } Wn t k
 r6 |  j d  n X| sM |  j d  n  |  j rn | rn |  j d  n  |  j r t |  |  j k r |  j d d |  j d t |  n  | S(   Nu   invalidu   no_nameu   emptyu
   max_lengthR   t   length(   t   namet   sizeR:   R   R9  R   R+   (   RV   R   t	   file_namet	   file_size(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   I  s    	%c         C  s}   t  |  d t j  } | s d  S| rv t  | d d   s; d  S| j } |  j j d d   } | d  k	 rr | j |  S| S| j S(   Nu   use_urlu   urlu   request(	   R9   R   t   UPLOADED_FILES_USE_URLR5   t   urlRr   R   t   build_absolute_uriR<  (   RV   RF   R:  RA  t   request(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   Z  s    	(   R#   R$   R0   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR8  9  s   		R
   c           B  s-   e  Z i e d   d 6Z d   Z d   Z RS(   uY   Upload a valid image. The file you uploaded was either not an image or a corrupted image.u   invalid_imagec         O  s2   | j  d t  |  _ t t |   j | |   d  S(   Nu   _DjangoImageField(   R   t   DjangoImageFieldt   _DjangoImageFieldR   R
   RW   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   s  s    c         C  sA   t  t |   j |  } |  j   } |  j | _ | j |  | S(   N(   R   R
   R   RE  R   t	   to_python(   RV   R   t   file_objectt   django_field(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   w  s
    (   R#   R$   R0   R   RW   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR
   l  s
   	t   _UnvalidatedFieldc           B  s#   e  Z d    Z d   Z d   Z RS(   c         O  s/   t  t |   j | |   t |  _ t |  _ d  S(   N(   R   RI  RW   RX   R   R   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    	c         C  s   | S(   N(    (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s   | S(   N(    (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (   R#   R$   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRI    s   		t	   ListFieldc           B  s[   e  Z e   Z g  Z i e d   d 6e d  d 6Z d   Z d   Z d   Z	 d   Z
 RS(   u5   Expected a list of items but got type "{input_type}".u
   not_a_listu   This list may not be empty.u   emptyc         O  s   | j  d t j |  j   |  _ | j  d t  |  _ t j |  j  sU t d   |  j j	 d  k ss t d   t t |   j | |   |  j j d d d |   d  S(   Nu   childu   allow_emptyu"   `child` has not been instantiated.uv   The `source` argument is not meaningful when applied to a `child=` field. Remove `source=` from the field declaration.R   u    Rg   (   R   R   R   t   childRX   R.  R&   t   isclassRv   R~   R5   R   RJ  RW   R   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    !	c         C  s   |  j  | k r+ t |  j d t  r+ t Sn  t j |  r{ | j |  j  g   } t |  d k re | St j	 | d |  j  S| j
 |  j  t  S(   Nu   partiali    t   prefix(   R   R9   R   R)   R"   R   R   R/  R+   t   parse_html_listR   (   RV   RD   t   val(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s   t  j |  r! t  j |  } n  t | t d   sX t | t j  sX t | d  rw |  j d d t |  j	 n  |  j
 r t |  d k r |  j d  n  g  | D] } |  j j |  ^ q S(   uY   
        List of dicts of native values <- List of dicts of primitive datatypes.
        u    u   __iter__u
   not_a_listR0  i    u   empty(   R   R   RN  R6   R   R7   R8   Rj   R   R#   R.  R+   RK  R   (   RV   R   R1  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    7c         C  s#   g  | D] } |  j  j |  ^ q S(   uS   
        List of object instances -> List of dicts of primitive datatypes.
        (   RK  R   (   RV   R   R1  (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (   R#   R$   RI  RK  R   R0   R   RW   R   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRJ    s   				t	   DictFieldc           B  sN   e  Z e   Z i  Z i e d   d 6Z d   Z d   Z d   Z	 d   Z
 RS(   u;   Expected a dictionary of items but got type "{input_type}".u
   not_a_dictc         O  s   | j  d t j |  j   |  _ t j |  j  s@ t d   |  j j d  k s^ t d   t	 t
 |   j | |   |  j j d d d |   d  S(   Nu   childu"   `child` has not been instantiated.uv   The `source` argument is not meaningful when applied to a `child=` field. Remove `source=` from the field declaration.R   u    Rg   (   R   R   R   RK  R&   RL  Rv   R~   R5   R   RP  RW   R   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    !	c         C  s8   t  j |  r% t  j | d |  j S| j |  j t  S(   NRM  (   R   R   t   parse_html_dictR   R   R"   (   RV   RD   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c           si   t  j |  r! t  j |  } n  t | t  sO   j d d t |  j n    f d   | j   D S(   uI   
        Dicts of native values <- Dicts of primitive datatypes.
        u
   not_a_dictR0  c           s4   i  |  ]* \ } }   j  j |  t j |   q S(    (   RK  R   R   R   (   R)  RG   RF   (   RV   (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pys
   <dictcomp>  s   	(	   R   R   RQ  R6   RP   R   R   R#   RO   (   RV   R   (    (   RV   so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c           s     f d   | j    D S(   uS   
        List of object instances -> List of dicts of primitive datatypes.
        c           s4   i  |  ]* \ } }   j  j |  t j |   q S(    (   RK  R   R   R   (   R)  RG   RO  (   RV   (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pys
   <dictcomp>  s   	(   RO   (   RV   RF   (    (   RV   so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (   R#   R$   RI  RK  R   R0   R   RW   R   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRP    s   				t	   JSONFieldc           B  s6   e  Z i e d   d 6Z d   Z d   Z d   Z RS(   u   Value must be valid JSON.u   invalidc         O  s2   | j  d t  |  _ t t |   j | |   d  S(   Nu   binary(   R   R)   t   binaryR   RR  RW   (   RV   R/   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW     s    c         C  sv   yK |  j  r= t | t j  r0 | j d  } n  t j |  St j |  Wn$ t t	 f k
 rq |  j
 d  n X| S(   Nu   utf-8u   invalid(   RS  R6   R   t   binary_typet   decodet   jsont   loadst   dumpsR   R<   R   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    	c         C  sI   |  j  rE t j |  } t | t j  rE t | j d   } qE n  | S(   Nu   utf-8(   RS  RV  RX  R6   R   R   t   bytest   encode(   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s
    	(   R#   R$   R0   R   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRR    s
   		t   ReadOnlyFieldc           B  s    e  Z d  Z d   Z d   Z RS(   ux  
    A read-only field that simply returns the field value.

    If the field is a method with no parameters, the method will be called
    and it's return value used as the representation.

    For example, the following would call `get_expiry_date()` on the object:

    class ExampleSerializer(Serializer):
        expiry_date = ReadOnlyField(source='get_expiry_date')
    c         K  s$   t  | d <t t |   j |   d  S(   Nu	   read_only(   RX   R   R[  RW   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   &  s    
c         C  s   | S(   N(    (   RV   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   *  s    (   R#   R$   R%   RW   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR[    s   	t   HiddenFieldc           B  s)   e  Z d  Z d   Z d   Z d   Z RS(   uL  
    A hidden field does not take input from the user, or present any output,
    but it does populate a field in `validated_data`, based on its default
    value. This is particularly useful when we have a `unique_for_date`
    constraint on a pair of fields, as we need some way to include the date in
    the validated data.
    c         K  s<   d | k s t  d   t | d <t t |   j |   d  S(   Nu   defaultu   default is a required argument.u
   write_only(   Rv   RX   R   R\  RW   (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   6  s    
c         C  s   t  S(   N(   R"   (   RV   RD   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   ;  s    c         C  s   | S(   N(    (   RV   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   @  s    (   R#   R$   R%   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR\  .  s   		t   SerializerMethodFieldc           B  s,   e  Z d  Z d d  Z d   Z d   Z RS(   u  
    A read-only field that get its representation from calling a method on the
    parent serializer class. The method called will be of the form
    "get_{field_name}", and should take a single argument, which is the
    object being serialized.

    For example:

    class ExampleSerializer(self):
        extra_info = SerializerMethodField()

        def get_extra_info(self, obj):
            return ...  # Calculate some data to return.
    c         K  s7   | |  _  d | d <t | d <t t |   j |   d  S(   Nu   *u   sourceu	   read_only(   t   method_nameRX   R   R]  RW   (   RV   R^  R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   S  s    	

c         C  s{   d j  d |  } |  j | k sC t d |  j | | j j f   |  j d  k r^ | |  _ n  t t |   j | |  d  S(   Nu   get_{field_name}R   u   It is redundant to specify `%s` on SerializerMethodField '%s' in serializer '%s', because it is the same as the default method name. Remove the `method_name` argument.(	   R=   R^  Rv   Ro   R#   R5   R   R]  R   (   RV   R   Rg   t   default_method_name(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   Y  s    c         C  s   t  |  j |  j  } | |  S(   N(   R9   Rg   R^  (   RV   RF   R.   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR   k  s    N(   R#   R$   R%   R5   RW   R   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR]  D  s   	t
   ModelFieldc           B  sE   e  Z d  Z i e d  d 6Z d   Z d   Z d   Z d   Z RS(   u   
    A generic field that can be used against an arbitrary model field.

    This is used by `ModelSerializer` when dealing with custom model fields,
    that do not have a serializer field to be mapped to.
    u;   Ensure this field has no more than {max_length} characters.u
   max_lengthc         K  sy   | |  _  | j d d   } t t |   j |   | d  k	 ru |  j d j d |  } |  j j	 t
 | d |  n  d  S(   Nu
   max_lengthR   R   (   t   model_fieldR   R5   R   R`  RW   R   R=   R   R   R   (   RV   Ra  R   R   R   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRW   {  s    	c         C  sP   t  |  j d d   } | d  k	 r@ | j j j | j  j |  S|  j j |  S(   Nu   rel(   R9   Ra  R5   t   tot   _metat	   get_fieldR   RF  (   RV   R   t   rel(    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    c         C  s   | S(   N(    (   RV   R,   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyRB     s    c         C  s2   |  j  j |  } t |  r" | S|  j  j |  S(   N(   Ra  t   _get_val_from_objR   t   value_to_string(   RV   R,   RF   (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR     s    (	   R#   R$   R%   R0   R   RW   R   RB   R   (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyR`  p  s   	
		(l   t
   __future__R    R7   R   R  R   R&   RV  R   R   R   t   django.confR   t   django.core.exceptionsR   R   R   t   django.core.validatorsR   R   R   R   t   django.formsR	   R6  R
   RD  t   django.utilsR   R   t   django.utils.dateparseR   R   R   t   django.utils.encodingR   R   t   django.utils.functionalR   t   django.utils.ipv6R   t   django.utils.translationR   R0   t   rest_frameworkR   t   rest_framework.compatR   R   R   R   R   R   R   R   t   rest_framework.exceptionst   rest_framework.settingsR   t   rest_framework.utilsR   R    R!   R"   R4   RB   RH   RK   RS   R5   Rd   R`   Re   Rq   t	   ExceptionRm   Rw   Rx   Ry   Rz   R   Rt   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R!  R&  R(  R-  R8  RI  RJ  RP  RR  R[  R\  R]  R`  (    (    (    so   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/fields.pyt   <module>   s   ":
					/ T#'$#!xKE;1'361!,