Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/landscape/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/landscape/lib/__pycache__/schema.cpython-310.pyc
o

���c9�@s�dZddlmZmZmZGdd�de�ZGdd�de�ZGdd�de�Z	Gd	d
�d
e�Z
Gdd�de�ZGd
d�de�ZGdd�de�Z
Gdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z"A schema system. Yes. Another one!�)�	iteritems�unicode�longc@seZdZdZdS)�InvalidErrorz&Raised when invalid input is received.N)�__name__�
__module__�__qualname__�__doc__�r
r
�6/usr/lib/python3/dist-packages/landscape/lib/schema.pyrsrc@� eZdZdZdd�Zdd�ZdS)�Constantz1Something that must be equal to a constant value.cC�
||_dS�N)�value��selfrr
r
r�__init__�
zConstant.__init__cCsVt|jt�rt|t�rz|��}Wn	tyYnw||jkr)td||jf��|S)Nz%r != %r)�
isinstancer�str�bytes�decode�UnicodeDecodeErrorrrr
r
r�coerces�
zConstant.coerceN�rrrr	rrr
r
r
rr

sr
c@r)�AnyzsSomething which must apply to any of a number of different schemas.

    @param schemas: Other schema objects.
    cGrr)�schemas)rrr
r
rr rzAny.__init__c	Cs@|jD]}z|�|�WStyYqwtd||jf��)z�
        The result of the first schema which doesn't raise
        L{InvalidError} from its C{coerce} method will be returned.
        z!%r did not match any schema in %s)rrr)rr�schemar
r
rr#s
��z
Any.coerceNrr
r
r
rr�rc@�eZdZdZdd�ZdS)�Boolz!Something that must be a C{bool}.cCst|t�std|f��|S)Nz%r is not a bool)r�boolrrr
r
rr3s
zBool.coerceN�rrrr	rr
r
r
rr!1�r!c@r )�Intz,Something that must be an C{int} or C{long}.cCs t|ttf�std|f��|S)Nz%r isn't an int or long)r�intrrrr
r
rr;sz
Int.coerceNr#r
r
r
rr%9r$r%c@r )�Floatz7Something that must be an C{int}, C{long}, or C{float}.cCs"t|tttf�std|f��|S)Nz%r isn't a float)rr&r�floatrrr
r
rrCszFloat.coerceNr#r
r
r
rr'Ar$r'c@r )�BytesziA binary string.

    If the value is a Python3 str (unicode), it will be automatically
    encoded.
    cCs,t|t�r|St|t�r|��Std|��)Nz%r isn't a bytestring)rrr�encoderrr
r
rrOs


zBytes.coerceNr#r
r
r
rr)Isr)c@s"eZdZdZddd�Zdd�ZdS)	�Unicodez�Something that must be a C{unicode}.

    If the value is a C{str}, it will automatically be decoded.

    @param encoding: The encoding to automatically decode C{str}s with.
    �utf-8cCrr)�encoding)rr-r
r
rrarzUnicode.__init__c
Csdt|t�r$z|�|j�}Wnty#}z
td|t|�f��d}~wwt|t�s0td|f��|S)Nz%r can't be decoded: %sz%r isn't a unicode)rrrr-rrrr)rr�er
r
rrds
��
zUnicode.coerceN)r,rr
r
r
rr+Ys
r+c@r)�ListznSomething which must be a C{list}.

    @param schema: The schema that all values of the list must match.
    cCrr�r�rrr
r
rrtrz
List.__init__cCsvt|t�std|f��t|�}t|�D]$\}}z
|j�|�||<Wqty8}z
td||j|f��d}~ww|S)Nz%r is not a listz%r could not coerce with %s: %s)r�listr�	enumeraterr)rr�new_list�i�subvaluer.r
r
rrws

����zList.coerceNrr
r
r
rr/orr/c@r)�Tuplez�Something which must be a fixed-length tuple.

    @param schema: A sequence of schemas, which will be applied to
        each value in the tuple respectively.
    cGrrr0r1r
r
rr�rzTuple.__init__cCsxt|t�std|f��t|�t|j�kr#tdt|j�t|�|f��g}t|j|�D]\}}|�|�|��q+t|�S)Nz%r is not a tuplezNeed %s items, got %s in %r)r�tupler�lenr�zip�appendr)rr�	new_valuerr
r
rr�s
�zTuple.coerceNrr
r
r
rr7�sr7c@s"eZdZdZddd�Zdd�ZdS)�KeyDictz�Something which must be a C{dict} with defined keys.

    The keys must be constant and the values must match a per-key schema.

    @param schema: A dict mapping keys to schemas that the values of those
        keys must match.
    NcCs |durg}t|�|_||_dSr)�set�optionalr)rrr?r
r
rr�s

zKeyDict.__init__c	Cs�i}t|t�std|f��t|�D]7\}}||jvr$td||jf��z|j|�|�||<WqtyI}z
td|||j||f��d}~wwt|���}t|j���|j}||}|rgtd|f��|S)N�%r is not a dict.z%r is not a valid key as per %rz7Value of %r key of dict %r could not coerce with %s: %szMissing keys %s)	r�dictrrrrr>�keysr?)	rr�new_dict�k�vr.�new_keys�
required_keys�missingr
r
rr�s0

�����zKeyDict.coercerrr
r
r
rr=�s
r=c@r)�Dictz�Something which must be a C{dict} with arbitrary keys.

    @param key_schema: The schema that keys must match.
    @param value_schema: The schema that values must match.
    cCs||_||_dSr)�
key_schema�value_schema)rrJrKr
r
rr�s
z
Dict.__init__cCsJt|t�std|f��i}|��D]\}}|j�|�||j�|�<q|S)Nr@)rrAr�itemsrKrrJ)rrrCrDrEr
r
rr�s
zDict.coerceNrr
r
r
rrI�srIN)r	�twisted.python.compatrrr�	Exceptionr�objectr
rr!r%r'r)r+r/r7r=rIr
r
r
r�<module>s$

Spamworldpro Mini