관리-도구
편집 파일: addresses.cpython-39.pyc
a �)g� � @ s� d dl mZmZmZ eZd dlZd dlmZm Z dZ dZdZdj ed�Zd j e d�Zd j ed�Ze�dej�e�dej�e�d j ed�ejejB �e�d� e�ejejB �e�dj ed�ejejB ejB �d�Zddd�ZdS )� )�absolute_import�division�print_functionN)�AnsibleParserError�AnsibleErrorz� \[ (?:[0-9]+:[0-9]+) # numeric begin:end (?::[0-9]+)? # numeric :step (optional) \] z� \[ (?:[0-9a-f]+:[0-9a-f]+) # hexadecimal begin:end (?::[0-9]+)? # numeric :step (optional) \] z� \[ (?: [a-z]:[a-z]| # one-char alphabetic range [0-9]+:[0-9]+ # ...or a numeric one ) (?::[0-9]+)? # numeric :step (optional) \] z~ (?: [0-9a-f]{{1,4}}| # 0..ffff {range} # or a numeric range ) )�rangez� (?: [01]?[0-9]{{1,2}}| # 0..199 2[0-4][0-9]| # 200..249 25[0-5]| # 250..255 {range} # or a numeric range ) z� (?:[\w]|{range}) # Starts with an alphanumeric or a range (?:[\w_-]|{range})* # Then zero or more of the same or [_-] (?<![_-]) # ...as long as it didn't end with [_-] z�^ \[(.+)\] # [host identifier] :([0-9]+) # :port number $ a� ^ ((?: # We want to match: [^:\[\]] # (a non-range character | # ...or... \[[^\]]*\] # a complete bracketed expression) )*) # repeated as many times as possible :([0-9]+) # followed by a port number $ zh^ (?:{i4}\.){{3}}{i4} # Three parts followed by dots plus one $ )Zi4a ^ (?:{0}:){{7}}{0}| # uncompressed: 1:2:3:4:5:6:7:8 (?:{0}:){{1,6}}:| # compressed variants, which are all (?:{0}:)(?::{0}){{1,6}}| # a::b for various lengths of a,b (?:{0}:){{2}}(?::{0}){{1,5}}| (?:{0}:){{3}}(?::{0}){{1,4}}| (?:{0}:){{4}}(?::{0}){{1,3}}| (?:{0}:){{5}}(?::{0}){{1,2}}| (?:{0}:){{6}}(?::{0})| # ...all with 2 <= a+b <= 7 :(?::{0}){{1,6}}| # ::ffff(:ffff...) {0}?::| # ffff::, :: # ipv4-in-ipv6 variants (?:0:){{6}}(?:{0}\.){{3}}{0}| ::(?:ffff:)?(?:{0}\.){{3}}{0}| (?:0:){{5}}ffff:(?:{0}\.){{3}}{0} $ z�^ {label} # We must have at least one label (?:\.{label})* # Followed by zero or more .labels $ )�label)�bracketed_hostport�hostport�ipv4�ipv6�hostnameFc C s� d}dD ],}t | �| �}|r|�� \} }t|�}qqd}dD ]}t | �| �}|r>| }q>q>|sltd| ��|s�d|v r�td��||fS )a� Takes a string and returns a (host, port) tuple. If the host is None, then the string could not be parsed as a host identifier with an optional port specification. If the port is None, then no port was specified. The host identifier may be a hostname (qualified or not), an IPv4 address, or an IPv6 address. If allow_ranges is True, then any of those may contain [x:y] range specifications, e.g. foo[1:3] or foo[0:5]-bar[x-z]. The port number is an optional :NN suffix on an IPv4 address or host name, or a mandatory :NN suffix on any square-bracketed expression: IPv6 address, IPv4 address, or host name. (This means the only way to specify a port for an IPv6 address is to enclose it in square brackets.) N)r r )r r r z Not a valid network hostname: %s�[z5Detected range in host but was asked to ignore ranges)�patterns�match�groups�intr r )�addressZallow_ranges�portZmatching�m�host� r �C/usr/lib/python3.9/site-packages/ansible/parsing/utils/addresses.py� parse_address� s$ r )F)Z __future__r r r �typeZ __metaclass__�reZansible.errorsr r Z numeric_rangeZhexadecimal_rangeZalphanumeric_range�formatZipv6_componentZipv4_componentr �compile�X�I�UNICODEr r r r r r �<module> sV ��� ��� �� ����W