File manager - Edit - /usr/lib/python3/dist-packages/landscape/lib/__pycache__/schema.cpython-310.pyc
Back
o y)�]� � @ 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 s || j krtd|| j f ��|S )Nz%r != %r)r r 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 � t |t�std|f ��|S )Nz%r is not a bool)� isinstance�boolr r r r r r - � zBool.coerceN�r r r r r r r r r r + � 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 5 s z Int.coerceNr! r r r r r# 3 r"