a )g @sddlmZmZmZeZddlZddlmZm Z dZ dZ dZ dj e dZd j e dZd j e dZed ejed ejed j edejejBed eejejBedj edejejBejBdZdddZdS))absolute_importdivisionprint_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 [_-] (?|}q>q>|sltd||sd|vrtd||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)patternsmatchgroupsintrr)addressZ allow_rangesportZmatchingmhostrC/usr/lib/python3.9/site-packages/ansible/parsing/utils/addresses.py parse_addresss$   r)F)Z __future__rrrtypeZ __metaclass__reZansible.errorsrrZ numeric_rangeZhexadecimal_rangeZalphanumeric_rangeformatZipv6_componentZipv4_componentrcompileXIUNICODErrrrrrsV    W