File: //lib/python3/dist-packages/landscape/lib/__pycache__/schema.cpython-310.pyc
o
���c9 � @ s� d Z ddlmZmZmZ G dd� de�ZG dd� de�ZG dd� de�Z G d d
� d
e�Z
G dd� de�ZG d
d� de�ZG dd� de�Z
G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZdS )z"A schema system. Yes. Another one!� )� iteritems�unicode�longc @ s e Zd ZdZdS )�InvalidErrorz&Raised when invalid input is received.N)�__name__�
__module__�__qualname__�__doc__� r
r
�6/usr/lib/python3/dist-packages/landscape/lib/schema.pyr s r c @ � e Zd ZdZdd� Zdd� ZdS )�Constantz1Something that must be equal to a constant value.c C �
|| _ d S �N)�value��selfr r
r
r �__init__ �
zConstant.__init__c C sV t | jt�rt |t�rz|�� }W n ty Y nw || jkr)td|| jf ��|S )Nz%r != %r)�
isinstancer �str�bytes�decode�UnicodeDecodeErrorr r r
r
r �coerce s �
zConstant.coerceN�r r r r r r r
r
r
r r
s r
c @ r )�AnyzsSomething which must apply to any of a number of different schemas.
@param schemas: Other schema objects.
c G r r )�schemas)r r r
r
r r r zAny.__init__c C s@ | j D ]}z|�|�W S ty Y qw td|| j f ��)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)r r r )r r �schemar
r
r r # s
��z
Any.coerceNr r
r
r
r r � r c @ � e Zd ZdZdd� ZdS )�Boolz!Something that must be a C{bool}.c C s t |t�std|f ��|S )Nz%r is not a bool)r �boolr r r
r
r r 3 s
zBool.coerceN�r r r r r r
r
r
r r! 1 � r! c @ r )�Intz,Something that must be an C{int} or C{long}.c C s t |ttf�std|f ��|S )Nz%r isn't an int or long)r �intr r r r
r
r r ; s z
Int.coerceNr# r
r
r
r r% 9 r$ r% c @ r )�Floatz7Something that must be an C{int}, C{long}, or C{float}.c C s"