403Webshell
Server IP : 77.50.203.18  /  Your IP : 192.168.0.10
Web Server : Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.7 mpm-itk/2.4.7-04 PHP/8.4.23
System : Linux web2 5.14.0-722.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 6 09:07:51 UTC 2026 x86_64
User : warsnews.ru ( 1001)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.9/site-packages/dasbus/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.9/site-packages/dasbus/__pycache__/typing.cpython-39.pyc
a

�ic�/�@sFddlmZmZmZmZddlZe�dd�ddlmZm	Z	gd�Z
eZe
ZeZeZede�Zede�Zed	e�Zed
e�Zede�Zede�Zed
e�Zede�Zede�ZeeefZdd�Zdd�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$d d!�Z%Gd"d#�d#e&�Z'Gd$d%�d%e&�Z(Gd&d'�d'e(�Z)Gd(d)�d)e(�Z*dS)*�)�Tuple�Dict�List�NewTypeNZGLibz2.0)�Variant�VariantType)�Bool�Str�Double�Byte�Int�Int16�UInt16�Int32�UInt32�Int64�UInt64�UnixFD�ObjPathrrrrr�	Structure�
get_native�get_variant�get_variant_type�is_tuple_of_one�unwrap_variant�is_base_type�get_type_arguments�
get_dbus_type�VariantUnpacking�VariantUnpacker�VariantUnwrapperrr
rrrrrrrcCs
t�|�S)z�Return DBus representation of a type hint.

    :param type_hint: a type hint
    :return: a string with DBus representation
    ��DBusType�get_dbus_representation��	type_hint�r&�1/usr/lib/python3.9/site-packages/dasbus/typing.pyr\srcCs4t|�tkr|}nt|�}|dur*td��t||�S)a^Return a variant data type.

    The type of a variant is specified with
    a type hint.

    Example:

    .. code-block:: python

         v1 = get_variant(Bool, True)
         v2 = get_variant(List[Int], [1,2,3])

    :param type_hint: a type hint or a type string
    :param value: a value of the variant
    :return: an instance of Variant
    NzInvalid DBus value 'None'.)�type�strr�	TypeErrorr)r%�value�type_stringr&r&r'resrcCs$t|�tkr|}nt|�}t�|�S)z�Return a type of a variant data type.

    :param type_hint: a type hint or a type string
    :return: an instance of VariantType
    )r(r)rr�new)r%r,r&r&r'r�srcCst|�}|��o|��dkS)zyIs the type hint a tuple of one item?

    :param type_hint: a type hint or a type string
    :return: True or False
    �)rZis_tupleZn_items)r%Zvariant_typer&r&r'r�srcCsbt|t�r|��St|t�r*ttt|��St|t�rBttt|��St|t�r^dd�|��D�S|S)z�Decompose a DBus value into a native Python object.

    This function is useful for testing, when the DBus library
    doesn't decompose arguments and return values of DBus calls.

    :param value: a DBus value
    :return: a native Python object
    cSsi|]\}}|t|��qSr&)r)�.0�k�vr&r&r'�
<dictcomp>��zget_native.<locals>.<dictcomp>)	�
isinstancer�unpack�tuple�mapr�list�dict�items)r+r&r&r'r�s	



rcCs
t�|�S)aAUnwrap a variant data type.

    Unlike the unpack method of the Variant class, this function
    doesn't recursively unpacks all variants in the data structure.
    It will unpack only the topmost variant.

    The implementation is inspired by the unpack method.

    :param variant: a variant
    :return: a value
    )r �apply)�variantr&r&r'r�srcCs<t|d|�}||krdSzt||�WSty6Yn0dS)aKIs the given base type a base of the specified type hint?

    For example, List is a base of the type hint List[Int] and
    Int is a base of the type hint Int. A class is a base of
    itself and of every subclass of this class.

    :param type_hint: a type hint
    :param base_type: a base type
    :return: True or False
    �
__origin__TF)�getattr�
issubclassr*�r%Z	base_typer&r&r'r�srcCst|dd�S)z�Get the arguments of the type hint.

    For example, Str and Int are arguments of the type hint Tuple(Str, Int).

    :param type_hint: a type hint
    :return: a type arguments
    �__args__r&)r>r$r&r&r'r�srcCst|dt|��S)zkGet the name of the type hint.

    :param type_hint: a type hint
    :return: a name of the type hint
    �__name__)r>r)r$r&r&r'�
get_type_name�srCc@s�eZdZdZededededede	de
deded	e
d
ededed
ediZededediZedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zd S)!r"z0Class for transforming type hints to DBus types.�b�s�d�i�y�n�q�u�x�t�h�or1z(%s)za%sza{%s}cCs>t�|�rt�|�St�|�r(t�|�Std�t|����dS)z�Return a DBus representation of the given type hint.

        :param type_hint: a type hint
        :return str: a DBus representation of the type hint

        :raises ValueError: for unknown types
        zInvalid DBus type '{}'.N)r"�_is_basic_type�_get_basic_type�_is_container_type�_get_container_typer*�formatrCr$r&r&r'r#s




��z DBusType.get_dbus_representationcCs
|tjvS)zIs it a basic type?�r"�_basic_type_mappingr$r&r&r'rP&szDBusType._is_basic_typecCs
tj|S)zReturn a basic type.rUr$r&r&r'rQ+szDBusType._get_basic_typecCst�|�duS)zIs it a container type?N)r"�_get_container_base_typer$r&r&r'rR0szDBusType._is_container_typecCs"tjD]}t||�r|SqdS)zReturn a container base type.N)r"�_container_type_mappingrr@r&r&r'rW5s


z!DBusType._get_container_base_typecCsJt�|�}t|�}|tkr$t�|�tj|}dd�|D�}|d�|�S)zReturn a container type.cSsg|]}t�|��qSr&r!)r/�argr&r&r'�
<listcomp>Nr3z0DBusType._get_container_type.<locals>.<listcomp>�)r"rWrr�_check_if_valid_dictionaryrX�join)r%Zbasetype�args�	containerr:r&r&r'rS@s


zDBusType._get_container_typecCs4t|�\}}t�|�s|tkr0td�t|����dS)zVCheck the type of a dictionary.

        :raises ValueError: for invalid type
        z)Invalid DBus type of dictionary key: '{}'N)rr"rRrr*rTrC)r%�key�_r&r&r'r\Qs��z#DBusType._check_if_valid_dictionaryN)rB�
__module__�__qualname__�__doc__rr	r
rrr
rrrrrrrrrVrrrrX�staticmethodr#rPrQrRrWrSr\r&r&r&r'r"�sD��






r"c@sXeZdZdZedd��Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
dS)rz�Set of functions of unpacking a variant.

    This class is doing the same as the unpack method
    of the Variant class, but it allows to reuse the code
    for other variant modifications.
    cGs�|��}|�d�r$|j|g|�R�S|�d�r@|j|g|�R�S|�d�r\|j|g|�R�S|�d�rx|j|g|�R�S|j|g|�R�S)zProcess a variant.�(za{�ar1)Zget_type_string�
startswith�
_handle_tuple�_handle_dictionary�
_handle_array�_handle_variant�
_handle_value)�clsr<�extrasr,r&r&r'�_process_varianths



z!VariantUnpacking._process_variantcs"t���fdd�t����D��S)zHandle a tuple.c3s&|]}�j��|�g��R�VqdS�N�rp�get_child_value�r/rG�rnror<r&r'�	<genexpr>~s�z1VariantUnpacking._handle_tuple.<locals>.<genexpr>)r6�range�
n_children�rnr<ror&rur'ri{s
�zVariantUnpacking._handle_tuplecGs\i}t|���D]F}|�|�}|j|�d�g|�R�}|j|�d�g|�R�}|||<q|S)zHandle a dictionary.rr.)rwrxrsrp)rnr<ro�resultrG�entryr`r+r&r&r'rj�s

z#VariantUnpacking._handle_dictionarycs"t���fdd�t����D��S)zHandle an array.c3s&|]}�j��|�g��R�VqdSrqrrrtrur&r'rv�s�z1VariantUnpacking._handle_array.<locals>.<genexpr>)r8rwrxryr&rur'rk�s
�zVariantUnpacking._handle_arraycGs|j|��g|�R�S)zHandle a variant.)rprryr&r&r'rl�sz VariantUnpacking._handle_variantcGs|��S)zHandle a basic value.)r5ryr&r&r'rm�szVariantUnpacking._handle_valueN)rBrbrcrd�classmethodrprirjrkrlrmr&r&r&r'r`s




rc@seZdZdZedd��ZdS)rzClass for unpacking variants.cCs
|�|�S)zvUnpack the specified variant.

        :param variant: a variant to unpack
        :return: an unpacked value
        �rp�rnr<r&r&r'r;�szVariantUnpacker.applyN)rBrbrcrdr|r;r&r&r&r'r�src@s(eZdZdZedd��Zedd��ZdS)r zClass for unwrapping variants.cCs
|�|�S)zvUnwrap the specified variant.

        :param variant: a variant to unwrap
        :return: a unwrapped value
        r}r~r&r&r'r;�szVariantUnwrapper.applycGs|��S)zsHandle a variant.

        Don't recursively unpack all variants.
        Unpack only the topmost variant.
        )rryr&r&r'rl�sz VariantUnwrapper._handle_variantN)rBrbrcrdr|r;rlr&r&r&r'r �s

r )+�typingrrrrZgiZrequire_versionZgi.repository.GLibrr�__all__�boolr�floatr
r)r	�intrrr
rrrrrrrrrrrrrrrrrC�objectr"rrr r&r&r&r'�<module>s>"








	
	tC

Youez - 2016 - github.com/yon3zu
LinuXploit