%PDF- %PDF-
Direktori : /lib/python3/dist-packages/netaddr/strategy/__pycache__/ |
Current File : //lib/python3/dist-packages/netaddr/strategy/__pycache__/ipv4.cpython-312.pyc |
� ӊ�^� � �� � d Z ddlZddlZddlmZ ej dv r ddl m ZmZ nddlm ZmZ ddl mZmZmZ ddlmZmZmZmZmZmZmZ ddl m!Z! d Z"d Z#dZ$dZ%eZ&d Z'dZ(dZ)de"z dz Z*e"e#z Z+de#z dz Z, e- e.de"dz � D � cg c] } | e*de"| z z dz z f�� c} � Z/ e- e.de"dz � D � cg c] } e*de"| z z dz z | f�� c} � Z0 e- e.de"dz � D � cg c] } | de"| z z dz f�� c} � Z1 e- e.de"dz � D � cg c] } de"| z z dz | f�� c} � Z2d"d�Z3d"d�Z4d#d�Z5d� Z6d� Z7d� Z8d� Zd� Z9d� Z:d� Zd� Zd#d�Zd� Zd� Zd � Zd!� Z;yc c} w c c} w c c} w c c} w )$zIPv4 address logic.� N)� inet_aton)�win32�cygwin)� inet_pton�AF_INET)�AddrFormatError�ZEROFILL� INET_PTON)�valid_words� valid_bits�bits_to_int�int_to_bits� valid_bin� int_to_bin� bin_to_int)� _str_type� � �%d�.�IPv4� � � � c �. � | dk( rt d� �d}|t z r:dj | j d� D �cg c] }dt |� z �� c}� } |t z rt t | � |S t | � |S c c}w # t $ r d}Y |S w xY w)aP :param addr: An IPv4 address in presentation (string) format. :param flags: decides which rules are applied to the interpretation of the addr value. Supported constants are INET_PTON and ZEROFILL. See the netaddr.core docs for details. :return: ``True`` if IPv4 address is valid, ``False`` otherwise. � z Empty strings are not supported!Tr r F) r r �join�split�intr � _inet_ptonr � _inet_aton� Exception)�addr�flags�validity�is �7/usr/lib/python3/dist-packages/netaddr/strategy/ipv4.py� valid_strr) Q s� � � �r�z��@�A�A��H��x���x�x�� � �3��@�1���A���@�A����9���w��%� �O� �t�� �O�� A�� � ����O��s �B �B �2B �B�Bc �n � |t z r:dj | j d� D �cg c] }dt |� z �� c}� } |t z r't j dt t | � � d S t j dt | � � d S c c}w # t $ r t | �d�� �w xY w)aP :param addr: An IPv4 dotted decimal address in string form. :param flags: decides which rules are applied to the interpretation of the addr value. Supported constants are INET_PTON and ZEROFILL. See the netaddr.core docs for details. :return: The equivalent unsigned integer for a given IPv4 address. r r �>Ir z$ is not a valid IPv4 address string!)r r r r r �_struct�unpackr! r r"