File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/uritemplate/__pycache__/variable.cpython-310.pyc
Back
o �hF2 � @ s d Z ddlZddlZddlZejee e ef Zejej e ejeef ejeef ef Zejeef ZG dd� d�Zdejdejeejej ejeef f fdd�Zdejdefd d �Zdejdefdd�Zddejdedefdd�Zdejdedefdd�ZdS )z� uritemplate.variable ==================== This module contains the URIVariable class which powers the URITemplate class. What treasures await you: - URIVariable class You see a hammer in front of you. What do you do? > � Nc @ s$ e Zd ZdZdZdZdefdd�Zdefdd �Zdefd d�Z d d d�Z d dd�Zdedede deje deje f dd�Zdedede deje deje f dd�Zdedede deje deje f dd�Zdedede deje deje f dd�Z d!deje dejeef fdd�ZdS )"�URIVariablea This object validates everything inside the URITemplate object. It validates template expansions and will truncate length as decided by the template. Please note that just like the :class:`URITemplate <URITemplate>`, this object's ``__str__`` and ``__repr__`` methods do not return the same information. Calling ``str(var)`` will return the original variable. This object does the majority of the heavy lifting. The ``URITemplate`` object finds the variables in the URI and then creates ``URIVariable`` objects. Expansions of the URI are handled by each ``URIVariable`` object. ``URIVariable.expand()`` returns a dictionary of the original variable and the expanded value. Check that method's documentation for more information. ) �+�#�.�/�;�?�&�|�!�@z:/?#[]@!$&'()*+,;=�varc C s8 || _ d| _d| _g | _g | _i | _| �� | �� d S )N� )�original�operator�safe� variables�variable_names�defaults�parse� post_parse)�selfr � r �J/usr/local/CyberPanel/lib/python3.10/site-packages/uritemplate/variable.py�__init__6 s �zURIVariable.__init__�returnc C s d| S )NzURIVariable(%s)r �r r r r �__repr__I s zURIVariable.__repr__c C s | j S �N)r r r r r �__str__L s zURIVariable.__str__Nc C s | j }| j d tjv r| j d | _| j dd� }| jtjdd� v r&tj| _|�d�}|D ]I}d}|}d|v rAt|�dd��\}}d}|�d�rPd }|dd � }d}d|v rdt|�dd��\}}t |�}|rk|| j |<