a
    5ñ»jí  ã                   @   sF   d dl mZ d dlmZ d dlmZ G dd„ dƒZG dd„ deƒZdS )	é    )ÚDict)ÚDesiredCapabilities)Ú
ArgOptionsc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú_SafariOptionsDescriptora!  _SafariOptionsDescriptor is an implementation of Descriptor protocol:

    : Any look-up or assignment to the below attributes in `Options` class will be intercepted
    by `__get__` and `__set__` method respectively.

    - `automatic_inspection`
    - `automatic_profiling`
    - `use_technology_preview`

    : When an attribute lookup happens,
    Example:
        `self.automatic_inspection`
        `__get__` method does a dictionary look up in the dictionary `_caps` of `Options` class
        and returns the value of key `safari:automaticInspection`
    : When an attribute assignment happens,
    Example:
        `self.automatic_inspection` = True
        `__set__` method sets/updates the value of the key `safari:automaticInspection` in `_caps`
        dictionary in `Options` class.
    c                 C   s   || _ || _d S ©N)ÚnameÚexpected_type)Úselfr   r   © r
   úGE:\soccer\ml_env\Lib\site-packages\selenium/webdriver/safari/options.pyÚ__init__-   s    z!_SafariOptionsDescriptor.__init__c                 C   s*   | j dkr|j d¡| j kS |j | j ¡S )NúSafari Technology PreviewÚbrowserName)r   Ú_capsÚget)r	   ÚobjÚclsr
   r
   r   Ú__get__1   s    
z _SafariOptionsDescriptor.__get__c                 C   sR   t || jƒs"t| j› d| j› �ƒ‚| jdkrB|r6| jnd|jd< n||j| j< d S )Nz must be of type r   Zsafarir   )Ú
isinstancer   Ú	TypeErrorr   r   )r	   r   Úvaluer
   r
   r   Ú__set__6   s
    
z _SafariOptionsDescriptor.__set__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r
   r
   r
   r   r      s   r   c                   @   sP   e Zd ZdZdZdZeeeƒZeeeƒZ	eeeƒZ
eeeef dœdd„ƒZdS )ÚOptionszsafari:automaticInspectionzsafari:automaticProfilingr   )Úreturnc                 C   s
   t j ¡ S r   )r   ZSAFARIÚcopy)r	   r
   r
   r   Údefault_capabilitiesq   s    zOptions.default_capabilitiesN)r   r   r   ZAUTOMATIC_INSPECTIONZAUTOMATIC_PROFILINGZSAFARI_TECH_PREVIEWr   ÚboolZautomatic_inspectionZautomatic_profilingZuse_technology_previewÚpropertyr   Ústrr   r
   r
   r
   r   r   ?   s   


r   N)Útypingr   Z.selenium.webdriver.common.desired_capabilitiesr   Z!selenium.webdriver.common.optionsr   r   r   r
   r
   r
   r   Ú<module>   s   (