Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/__pycache__/scp.cpython-39.pyc
Ðазад
a t�hyW � @ sb d Z dZddlZddlZddlZddlmZ dZe e fZzddlZW n e yZ dZY n0 eejf7 Zzeef7 ZW n ey� Y n0 zTddlmZmZmZmZmZmZmZmZ er�ddlZddlZejZee e ef ZW n e y� Y n0 e�d�jZdd � Z d d� Z!dd � Z"e!ej#j$�Z%dd� Z&G dd� de'�Z(G dd� de)�Z*ddd�Z+ddd�Z,dS )z? Utilities for sending files over ssh using the scp1 protocol. z0.15.0� N)�timeouts scp)�IO� TYPE_CHECKING�AnyStr�Callable�Iterable�Optional�Tuple�Unions [^\w@%+=:,./~-]c C s, | sdS t | �du r| S d| �dd� d S )z1Return a shell-escaped version of the string `s`.� N� 's '"'"')�_find_unsafe�replace��s� r �s/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/scp.py� _sh_quote1 s r c C s4 t | t�r| S tr&t | tj�r&t| �S | �d�S dS )z=Turns unicode into bytes, if needed. Assumes UTF-8. �utf-8N)� isinstance�bytes�pathlib�PurePath�encoder r r r �asbytes? s r c C s t | t�r| �dd�S | S dS )z:Turns bytes into unicode, if needed. Uses UTF-8. r r N)r r �decoder r r r � asunicodeL s r c C s t | t�r| �t�� �S | S dS )z)Turns bytes into unicode, if needed. N)r r r �locale�getpreferredencodingr r r r � asunicode_win^ s r c @ s� e Zd ZdZddddedfdd�Zdd� Zd d � Zd7d d�Zd8dd�Z d9dd�Z dd� Zdd� Zdd� Z dd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� ZdS ):� SCPClienta� An scp1 implementation, compatible with openssh scp. Raises SCPException for all transport related errors. Local filesystem and OS errors pass through. Main public methods are .put and .get The get method is controlled by the remote scp instance, and behaves accordingly. This means that symlinks are resolved, and the transfer is halted after too many levels of symlinks are detected. The put method uses os.walk for recursion, and sends files accordingly. Since scp doesn't support symlinks, we send file symlinks as the file (matching scp behaviour), but we make no attempt at symlinked directories. i @ g $@Nc s� || _ || _|| _d| _d| _� dur8|dur8td��n.|durH|| _n� dur`� fdd�| _nd| _d| _d| _d| _ d| _ |du r�dd� | _n|| _i | _| j � � | _t| _|r�| jd | 7 _dS ) a� Create an scp1 client. @param transport: an existing paramiko L{Transport} @type transport: L{Transport} @param buff_size: size of the scp send buffer. @type buff_size: int @param socket_timeout: channel socket timeout in seconds @type socket_timeout: float @param progress: callback - called with (filename, size, sent) during transfers @param progress4: callback - called with (filename, size, sent, peername) during transfers. peername is a tuple contains (IP, PORT) @param sanitize: function - called with filename, should return safe or escaped string. Uses _sh_quote by default. Set to ``False`` to disable. @type progress: function(string, int, int, tuple) @limit_bw: limits the bandwidth used on the connection in Kbps. Must be integer positive. the default value None does not limit the bandwidth. @type limit_bw: Optional[int] NFz+You may only set one of progress, progress4c s � | d d� � S )N� r )�a��progressr r �<lambda>� r z$SCPClient.__init__.<locals>.<lambda>r r c S s | S �Nr )�xr r r r% � r s -l %d)� transport� buff_size�socket_timeout�channel�preserve_times� TypeError� _progress� _recv_dir�_depth�_rename�_utime�sanitize� _dirtimes�getpeername�peername�SCP_COMMAND�scp_command)�selfr( r) r* r$ Z progress4r3 Zlimit_bwr r# r �__init__u s0 zSCPClient.__init__c C s | � � | _| S r&