id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
11,201
_ip_int_from_string
def _ip_int_from_string(cls, ip_str): """Turn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. ...
python
Lib/ipaddress.py
1,188
1,211
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,202
_parse_octet
def _parse_octet(cls, octet_str): """Convert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. """ ...
python
Lib/ipaddress.py
1,214
1,247
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,203
_string_from_ip_int
def _string_from_ip_int(cls, ip_int): """Turns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. """ return '.'.join(map(str, ip_int.to_bytes(4, 'big'...
python
Lib/ipaddress.py
1,250
1,260
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,204
_reverse_pointer
def _reverse_pointer(self): """Return the reverse DNS pointer name for the IPv4 address. This implements the method described in RFC1035 3.5. """ reverse_octets = str(self).split('.')[::-1] return '.'.join(reverse_octets) + '.in-addr.arpa'
python
Lib/ipaddress.py
1,262
1,269
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,205
max_prefixlen
def max_prefixlen(self): return self._max_prefixlen
python
Lib/ipaddress.py
1,272
1,273
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,206
version
def version(self): return self._version
python
Lib/ipaddress.py
1,276
1,277
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,207
__init__
def __init__(self, address): """ Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('19...
python
Lib/ipaddress.py
1,286
1,319
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,208
packed
def packed(self): """The binary representation of this address.""" return v4_int_to_packed(self._ip)
python
Lib/ipaddress.py
1,322
1,324
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,209
is_reserved
def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. """ return self in self._constants._reserved_network
python
Lib/ipaddress.py
1,327
1,335
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,210
is_private
def is_private(self): """``True`` if the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions: * ``is_private`` is ``False`` for ``100.64.0.0/10`` * For IPv4-mapped IPv6-add...
python
Lib/ipaddress.py
1,339
1,357
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,211
is_global
def is_global(self): """``True`` if the address is defined as globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exception: For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semanti...
python
Lib/ipaddress.py
1,361
1,375
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,212
is_multicast
def is_multicast(self): """Test if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. """ return self in self._constants._multicast_network
python
Lib/ipaddress.py
1,378
1,386
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,213
is_unspecified
def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. """ return self == self._constants._unspecified_address
python
Lib/ipaddress.py
1,389
1,397
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,214
is_loopback
def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. """ return self in self._constants._loopback_network
python
Lib/ipaddress.py
1,400
1,407
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,215
is_link_local
def is_link_local(self): """Test if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. """ return self in self._constants._linklocal_network
python
Lib/ipaddress.py
1,410
1,417
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,216
ipv6_mapped
def ipv6_mapped(self): """Return the IPv4-mapped IPv6 address. Returns: The IPv4-mapped IPv6 address per RFC 4291. """ return IPv6Address(f'::ffff:{self}')
python
Lib/ipaddress.py
1,420
1,427
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,217
__init__
def __init__(self, address): addr, mask = self._split_addr_prefix(address) IPv4Address.__init__(self, addr) self.network = IPv4Network((addr, mask), strict=False) self.netmask = self.network.netmask self._prefixlen = self.network._prefixlen
python
Lib/ipaddress.py
1,432
1,438
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,218
hostmask
def hostmask(self): return self.network.hostmask
python
Lib/ipaddress.py
1,441
1,442
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,219
__str__
def __str__(self): return '%s/%d' % (self._string_from_ip_int(self._ip), self._prefixlen)
python
Lib/ipaddress.py
1,444
1,446
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,220
__eq__
def __eq__(self, other): address_equal = IPv4Address.__eq__(self, other) if address_equal is NotImplemented or not address_equal: return address_equal try: return self.network == other.network except AttributeError: # An interface with an associated ne...
python
Lib/ipaddress.py
1,448
1,458
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,221
__lt__
def __lt__(self, other): address_less = IPv4Address.__lt__(self, other) if address_less is NotImplemented: return NotImplemented try: return (self.network < other.network or self.network == other.network and address_less) except AttributeError:...
python
Lib/ipaddress.py
1,460
1,470
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,222
__hash__
def __hash__(self): return hash((self._ip, self._prefixlen, int(self.network.network_address)))
python
Lib/ipaddress.py
1,472
1,473
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,223
ip
def ip(self): return IPv4Address(self._ip)
python
Lib/ipaddress.py
1,478
1,479
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,224
with_prefixlen
def with_prefixlen(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self._prefixlen)
python
Lib/ipaddress.py
1,482
1,484
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,225
with_netmask
def with_netmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.netmask)
python
Lib/ipaddress.py
1,487
1,489
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,226
with_hostmask
def with_hostmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.hostmask)
python
Lib/ipaddress.py
1,492
1,494
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,227
__init__
def __init__(self, address, strict=True): """Instantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.0.2.0/24' '192.0.2.0/255.255.255.0' '192.0.2.0/0.0.0.255' are all functionally...
python
Lib/ipaddress.py
1,512
1,562
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,228
is_global
def is_global(self): """Test if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry. """ return (not (self.network_address in IPv4Network('100.64.0.0/10') and s...
python
Lib/ipaddress.py
1,566
1,576
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,229
_make_netmask
def _make_netmask(cls, arg): """Make a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") """ ...
python
Lib/ipaddress.py
1,642
1,659
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,230
_ip_int_from_string
def _ip_int_from_string(cls, ip_str): """Turn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. """ if not ip_...
python
Lib/ipaddress.py
1,662
1,763
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,231
_parse_hextet
def _parse_hextet(cls, hextet_str): """Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from ...
python
Lib/ipaddress.py
1,766
1,789
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,232
_compress_hextets
def _compress_hextets(cls, hextets): """Compresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(...
python
Lib/ipaddress.py
1,792
1,837
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,233
_string_from_ip_int
def _string_from_ip_int(cls, ip_int=None): """Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger th...
python
Lib/ipaddress.py
1,840
1,863
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,234
_explode_shorthand_ip_string
def _explode_shorthand_ip_string(self): """Expand a shortened IPv6 address. Returns: A string, the expanded IPv6 address. """ if isinstance(self, IPv6Network): ip_str = str(self.network_address) elif isinstance(self, IPv6Interface): ip_str = ...
python
Lib/ipaddress.py
1,865
1,884
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,235
_reverse_pointer
def _reverse_pointer(self): """Return the reverse DNS pointer name for the IPv6 address. This implements the method described in RFC3596 2.5. """ reverse_chars = self.exploded[::-1].replace(':', '') return '.'.join(reverse_chars) + '.ip6.arpa'
python
Lib/ipaddress.py
1,886
1,893
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,236
_split_scope_id
def _split_scope_id(ip_str): """Helper function to parse IPv6 string address with scope id. See RFC 4007 for details. Args: ip_str: A string, the IPv6 address. Returns: (addr, scope_id) tuple. """ addr, sep, scope_id = ip_str.partition('%') ...
python
Lib/ipaddress.py
1,896
1,913
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,237
max_prefixlen
def max_prefixlen(self): return self._max_prefixlen
python
Lib/ipaddress.py
1,916
1,917
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,238
version
def version(self): return self._version
python
Lib/ipaddress.py
1,920
1,921
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,239
__init__
def __init__(self, address): """Instantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(425407664112825928569039849516538265...
python
Lib/ipaddress.py
1,930
1,968
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,240
_explode_shorthand_ip_string
def _explode_shorthand_ip_string(self): ipv4_mapped = self.ipv4_mapped if ipv4_mapped is None: long_form = super()._explode_shorthand_ip_string() else: prefix_len = 30 raw_exploded_str = super()._explode_shorthand_ip_string() long_form = "%s%s" % (...
python
Lib/ipaddress.py
1,970
1,978
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,241
_ipv4_mapped_ipv6_to_str
def _ipv4_mapped_ipv6_to_str(self): """Return convenient text representation of IPv4-mapped IPv6 address See RFC 4291 2.5.5.2, 2.2 p.3 for details. Returns: A string, 'x:x:x:x:x:x:d.d.d.d', where the 'x's are the hexadecimal values of the six high-order 16-bit pieces of...
python
Lib/ipaddress.py
1,980
1,996
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,242
__str__
def __str__(self): ipv4_mapped = self.ipv4_mapped if ipv4_mapped is None: ip_str = super().__str__() else: ip_str = self._ipv4_mapped_ipv6_to_str() return ip_str + '%' + self._scope_id if self._scope_id else ip_str
python
Lib/ipaddress.py
1,998
2,004
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,243
__hash__
def __hash__(self): return hash((self._ip, self._scope_id))
python
Lib/ipaddress.py
2,006
2,007
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,244
__eq__
def __eq__(self, other): address_equal = super().__eq__(other) if address_equal is NotImplemented: return NotImplemented if not address_equal: return False return self._scope_id == getattr(other, '_scope_id', None)
python
Lib/ipaddress.py
2,009
2,015
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,245
__reduce__
def __reduce__(self): return (self.__class__, (str(self),))
python
Lib/ipaddress.py
2,017
2,018
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,246
scope_id
def scope_id(self): """Identifier of a particular zone of the address's scope. See RFC 4007 for details. Returns: A string identifying the zone of the address if specified, else None. """ return self._scope_id
python
Lib/ipaddress.py
2,021
2,030
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,247
packed
def packed(self): """The binary representation of this address.""" return v6_int_to_packed(self._ip)
python
Lib/ipaddress.py
2,033
2,035
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,248
is_multicast
def is_multicast(self): """Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. """ return self in self._constants._multicast_network
python
Lib/ipaddress.py
2,038
2,046
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,249
is_reserved
def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. """ return any(self in x for x in self._constants._reserved_networks)
python
Lib/ipaddress.py
2,049
2,057
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,250
is_link_local
def is_link_local(self): """Test if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. """ return self in self._constants._linklocal_network
python
Lib/ipaddress.py
2,060
2,067
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,251
is_site_local
def is_site_local(self): """Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A bo...
python
Lib/ipaddress.py
2,070
2,081
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,252
is_private
def is_private(self): """``True`` if the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions: * ``is_private`` is ``False`` for ``100.64.0.0/10`` * For IPv4-mapped IPv6-add...
python
Lib/ipaddress.py
2,085
2,106
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,253
is_global
def is_global(self): """``True`` if the address is defined as globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exception: For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semanti...
python
Lib/ipaddress.py
2,109
2,123
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,254
is_unspecified
def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. """ return self._ip == 0
python
Lib/ipaddress.py
2,126
2,134
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,255
is_loopback
def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. """ ipv4_mapped = self.ipv4_mapped if ipv4_mapped is not None: return ipv4_mapped...
python
Lib/ipaddress.py
2,137
2,148
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,256
ipv4_mapped
def ipv4_mapped(self): """Return the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. """ if (self._ip >> 32) != 0xFFFF: return None return IPv4Address(self._ip &...
python
Lib/ipaddress.py
2,151
2,161
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,257
teredo
def teredo(self): """Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) """ if (self._ip >> 96) != 0x20010000: return None ...
python
Lib/ipaddress.py
2,164
2,176
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,258
sixtofour
def sixtofour(self): """Return the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. """ if (self._ip >> 112) != 0x2002: return None return...
python
Lib/ipaddress.py
2,179
2,189
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,259
__init__
def __init__(self, address): addr, mask = self._split_addr_prefix(address) IPv6Address.__init__(self, addr) self.network = IPv6Network((addr, mask), strict=False) self.netmask = self.network.netmask self._prefixlen = self.network._prefixlen
python
Lib/ipaddress.py
2,194
2,200
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,260
hostmask
def hostmask(self): return self.network.hostmask
python
Lib/ipaddress.py
2,203
2,204
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,261
__str__
def __str__(self): return '%s/%d' % (super().__str__(), self._prefixlen)
python
Lib/ipaddress.py
2,206
2,208
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,262
__eq__
def __eq__(self, other): address_equal = IPv6Address.__eq__(self, other) if address_equal is NotImplemented or not address_equal: return address_equal try: return self.network == other.network except AttributeError: # An interface with an associated ne...
python
Lib/ipaddress.py
2,210
2,220
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,263
__lt__
def __lt__(self, other): address_less = IPv6Address.__lt__(self, other) if address_less is NotImplemented: return address_less try: return (self.network < other.network or self.network == other.network and address_less) except AttributeError: ...
python
Lib/ipaddress.py
2,222
2,232
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,264
__hash__
def __hash__(self): return hash((self._ip, self._prefixlen, int(self.network.network_address)))
python
Lib/ipaddress.py
2,234
2,235
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,265
ip
def ip(self): return IPv6Address(self._ip)
python
Lib/ipaddress.py
2,240
2,241
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,266
with_prefixlen
def with_prefixlen(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self._prefixlen)
python
Lib/ipaddress.py
2,244
2,246
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,267
with_netmask
def with_netmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.netmask)
python
Lib/ipaddress.py
2,249
2,251
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,268
with_hostmask
def with_hostmask(self): return '%s/%s' % (self._string_from_ip_int(self._ip), self.hostmask)
python
Lib/ipaddress.py
2,254
2,256
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,269
is_unspecified
def is_unspecified(self): return self._ip == 0 and self.network.is_unspecified
python
Lib/ipaddress.py
2,259
2,260
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,270
is_loopback
def is_loopback(self): return super().is_loopback and self.network.is_loopback
python
Lib/ipaddress.py
2,263
2,264
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,271
__init__
def __init__(self, address, strict=True): """Instantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:db8::/128' '2001:db8:0000:0000:0000:0000:0000:0000/128' ...
python
Lib/ipaddress.py
2,283
2,329
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,272
hosts
def hosts(self): """Generate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the Subnet-Router anycast address. """ network = int(self.network_address) broadcast = int(self.broadcast_address) for x in range(network + 1...
python
Lib/ipaddress.py
2,331
2,341
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,273
is_site_local
def is_site_local(self): """Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A bo...
python
Lib/ipaddress.py
2,344
2,356
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,274
__init__
def __init__(self, modules=None, dirs=None): self._mods = set() if not modules else set(modules) self._dirs = [] if not dirs else [os.path.normpath(d) for d in dirs] self._ignore = { '<string>': 1 }
python
Lib/trace.py
70
74
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,275
names
def names(self, filename, modulename): if modulename in self._ignore: return self._ignore[modulename] # haven't seen this one before, so see if the module name is # on the ignore list. if modulename in self._mods: # Identical names, so ignore self._ignore[module...
python
Lib/trace.py
76
117
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,276
_modname
def _modname(path): """Return a plausible module name for the path.""" base = os.path.basename(path) filename, ext = os.path.splitext(base) return filename
python
Lib/trace.py
119
124
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,277
_fullmodname
def _fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the p...
python
Lib/trace.py
126
152
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,278
__init__
def __init__(self, counts=None, calledfuncs=None, infile=None, callers=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs ...
python
Lib/trace.py
155
179
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,279
is_ignored_filename
def is_ignored_filename(self, filename): """Return True if the filename does not refer to a file we want to have reported. """ return filename.startswith('<') and filename.endswith('>')
python
Lib/trace.py
181
185
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,280
update
def update(self, other): """Merge in the data from another CoverageResults""" counts = self.counts calledfuncs = self.calledfuncs callers = self.callers other_counts = other.counts other_calledfuncs = other.calledfuncs other_callers = other.callers for ke...
python
Lib/trace.py
187
203
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,281
write_results
def write_results(self, show_missing=True, summary=False, coverdir=None, *, ignore_missing_files=False): """ Write the coverage results. :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. :param coverdir: ...
python
Lib/trace.py
205
300
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,282
write_results_file
def write_results_file(self, path, lines, lnotab, lines_hit, encoding=None): """Return a coverage results file in path.""" # ``lnotab`` is a dict of executable lines, or a line number "table" try: outfile = open(path, "w", encoding=encoding) except OSError as err: ...
python
Lib/trace.py
302
332
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,283
_find_lines_from_code
def _find_lines_from_code(code, strs): """Return dict where keys are lines in the line number table.""" linenos = {} for _, lineno in dis.findlinestarts(code): if lineno not in strs: linenos[lineno] = 1 return linenos
python
Lib/trace.py
334
342
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,284
_find_lines
def _find_lines(code, strs): """Return lineno dict for all code objects reachable from code.""" # get all of the lineno information from the code of this scope level linenos = _find_lines_from_code(code, strs) # and check the constants for references to other code objects for c in code.co_consts: ...
python
Lib/trace.py
344
354
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,285
_find_strings
def _find_strings(filename, encoding=None): """Return a dict of possible docstring positions. The dict maps line numbers to strings. There is an entry for line that contains only a string or a part of a triple-quoted string. """ d = {} # If the first token is a string, then it's the module...
python
Lib/trace.py
356
377
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,286
_find_executable_linenos
def _find_executable_linenos(filename): """Return dict where keys are line numbers in the line number table.""" try: with tokenize.open(filename) as f: prog = f.read() encoding = f.encoding except OSError as err: print(("Not printing coverage data for %r: %s" ...
python
Lib/trace.py
379
391
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,287
__init__
def __init__(self, count=1, trace=1, countfuncs=0, countcallers=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None, timing=False): """ @param count true iff it should count number of times each line is executed @param trace true iff ...
python
Lib/trace.py
394
442
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,288
run
def run(self, cmd): import __main__ dict = __main__.__dict__ self.runctx(cmd, dict, dict)
python
Lib/trace.py
444
447
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,289
runctx
def runctx(self, cmd, globals=None, locals=None): if globals is None: globals = {} if locals is None: locals = {} if not self.donothing: threading.settrace(self.globaltrace) sys.settrace(self.globaltrace) try: exec(cmd, globals, locals) finally...
python
Lib/trace.py
449
460
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,290
runfunc
def runfunc(self, func, /, *args, **kw): result = None if not self.donothing: sys.settrace(self.globaltrace) try: result = func(*args, **kw) finally: if not self.donothing: sys.settrace(None) return result
python
Lib/trace.py
462
471
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,291
file_module_function_of
def file_module_function_of(self, frame): code = frame.f_code filename = code.co_filename if filename: modulename = _modname(filename) else: modulename = None funcname = code.co_name clsname = None if code in self._caller_cache: ...
python
Lib/trace.py
473
512
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,292
globaltrace_trackcallers
def globaltrace_trackcallers(self, frame, why, arg): """Handler for call events. Adds information about who called who to the self._callers dict. """ if why == 'call': # XXX Should do a better job of identifying methods this_func = self.file_module_function_of(fr...
python
Lib/trace.py
514
523
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,293
globaltrace_countfuncs
def globaltrace_countfuncs(self, frame, why, arg): """Handler for call events. Adds (filename, modulename, funcname) to the self._calledfuncs dict. """ if why == 'call': this_func = self.file_module_function_of(frame) self._calledfuncs[this_func] = 1
python
Lib/trace.py
525
532
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,294
globaltrace_lt
def globaltrace_lt(self, frame, why, arg): """Handler for call events. If the code block being entered is to be ignored, returns `None', else returns self.localtrace. """ if why == 'call': code = frame.f_code filename = frame.f_globals.get('__file__', Non...
python
Lib/trace.py
534
555
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,295
localtrace_trace_and_count
def localtrace_trace_and_count(self, frame, why, arg): if why == "line": # record the file name and line number of every trace filename = frame.f_code.co_filename lineno = frame.f_lineno key = filename, lineno self.counts[key] = self.counts.get(key, 0)...
python
Lib/trace.py
557
574
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,296
localtrace_trace
def localtrace_trace(self, frame, why, arg): if why == "line": # record the file name and line number of every trace filename = frame.f_code.co_filename lineno = frame.f_lineno if self.start_time: print('%.2f' % (_time() - self.start_time), end=' ...
python
Lib/trace.py
576
591
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,297
localtrace_count
def localtrace_count(self, frame, why, arg): if why == "line": filename = frame.f_code.co_filename lineno = frame.f_lineno key = filename, lineno self.counts[key] = self.counts.get(key, 0) + 1 return self.localtrace
python
Lib/trace.py
593
599
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,298
results
def results(self): return CoverageResults(self.counts, infile=self.infile, outfile=self.outfile, calledfuncs=self._calledfuncs, callers=self._callers)
python
Lib/trace.py
601
605
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,299
main
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--version', action='version', version='trace 2.0') grp = parser.add_argument_group('Main options', 'One of these (or --report) must be given') grp.add_argument('-c', '--count', action='store_true', ...
python
Lib/trace.py
607
751
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
11,300
parse_ignore_dir
def parse_ignore_dir(s): s = os.path.expanduser(os.path.expandvars(s)) s = s.replace('$prefix', _prefix).replace('$exec_prefix', _exec_prefix) return os.path.normpath(s)
python
Lib/trace.py
682
685
{ "name": "PublicHealthInformationTechnology/cpython", "url": "https://github.com/PublicHealthInformationTechnology/cpython.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }