HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/__pycache__/pattern.cpython-310.pyc
o

�h6�@s�dZddlmZddlmZddlmZmZedZedefZGdd	�d	�Z	Gd
d�de	�Z
Gdd�de	�ZGd
d�d�ZGdd�d�Z
Gdd�de
�ZGdd�de
�ZdS)z-Pattern matching for principal and host names�)�fnmatch)�Union�)�	IPAddress�
ip_network)�WildcardHostPattern�CIDRHostPattern�WildcardPatternc@s0eZdZdZdefdd�Zdedefdd�Zd	S)
�_BaseWildcardPatternz/A base class for matching '*' and '?' wildcards�patterncCsd�dd�|D��|_dS)N�css,�|]}|dkr
dn|dkrdn|VqdS)�[z[[]�]z[]]N�)�.0�chrr�C/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/pattern.py�	<genexpr>'s��
�z0_BaseWildcardPattern.__init__.<locals>.<genexpr>)�join�_pattern��selfrrrr�__init__$s
�z_BaseWildcardPattern.__init__�value�returncCst||j�S�z2Return whether a wild card pattern matches a value)rr�rrrrr�_matches+�z_BaseWildcardPattern._matchesN)�__name__�
__module__�__qualname__�__doc__�strr�boolrrrrrr
!sr
cs*eZdZdZdedef�fdd�Z�ZS)r	z+A pattern matcher for '*' and '?' wildcardsrrcst��|�Sr)�superrr��	__class__rr�matches4rzWildcardPattern.matches)rr r!r"r#r$r(�
__classcell__rrr&rr	1scs2eZdZdZdedededef�fdd�Z�ZS)rz7Match a host name or address against a wildcard pattern�host�addr�_iprcs(t|�r
t��|�pt|�ot��|�S)zAReturn whether a host or address matches a wild card host pattern)r$r%r)rr*r+r,r&rrr(=s�zWildcardHostPattern.matches)	rr r!r"r#rr$r(r)rrr&rr:s&rc@s8eZdZdZdefdd�Zdedededefd	d
�ZdS)rz7Match IPv4/v6 address against CIDR-style subnet patternrcCst|�|_dS�N)r�_networkrrrrrGszCIDRHostPattern.__init__�_host�_addr�iprcCst|�o||jvS)z;Return whether an IP address matches a CIDR address pattern)r$r.)rr/r0r1rrrr(JszCIDRHostPattern.matchesN)	rr r!r"r#rrr$r(rrrrrDsrc@s>eZdZdZdefdd�Zdedefdd�Zdefd	d
�Z	dS)�_PatternListaMatch against a list of comma-separated positive and negative patterns

       This class is a base class for building a pattern matcher that
       takes a set of comma-separated positive and negative patterns,
       returning `True` if one or more positive patterns match and
       no negative ones do.

       The pattern matching is done by objects returned by the
       build_pattern method. The arguments passed in when a match
       is performed will vary depending on what class build_pattern
       returns.

    �patternscCshg|_g|_|�d�D]&}|�d�rd}|dd�}nd}|�|�}|r+|j�|�q|j�|�qdS)N�,�!TrF)�
_pos_patterns�
_neg_patterns�split�
startswith�
build_pattern�append)rr3r�negate�matcherrrrr_s

�z_PatternList.__init__rrcCst�)z)Abstract method to build a pattern object)�NotImplementedErrorrrrrr:qsz_PatternList.build_patterncs:t�fdd�|jD��}t�fdd�|jD��}|o|S)z?Match a set of values against positive & negative pattern listsc3��|]}|j��VqdSr-�r(�r�p��argsrrry��z'_PatternList.matches.<locals>.<genexpr>c3r?r-r@rArCrrrzrE)�anyr6r7)rrD�	pos_match�	neg_matchrrCrr(vs
z_PatternList.matchesN)
rr r!r"r#r�_AnyPatternr:r$r(rrrrr2Ps
r2c@�"eZdZdZdedefdd�ZdS)�WildcardPatternListz%Match names against wildcard patternsrrcCst|�S)zBuild a wild card pattern)r	rrrrr:�sz!WildcardPatternList.build_patternN)rr r!r"r#r	r:rrrrrK�rKc@rJ)�HostPatternListz?Match host names & addresses against wildcard and CIDR patternsrrcCs&zt|�WStyt|�YSw)z.Build a CIDR address or wild card host pattern)r�
ValueErrorrrrrrr:�s

�zHostPatternList.build_patternN)rr r!r"r#�_HostPatternr:rrrrrM�rLrMN)r"r�typingr�miscrrrOrIr
r	rrr2rKrMrrrr�<module>s	
/