id int64 0 1.29M | original_id stringlengths 32 32 | swhid stringlengths 100 170 | sha1 stringlengths 40 40 | repo_name stringlengths 2 45 | repo_group stringclasses 12
values | filepath stringlengths 5 153 | name stringlengths 1 14.9k | type stringclasses 3
values | code stringlengths 7 2.12M |
|---|---|---|---|---|---|---|---|---|---|
3,400 | 890106254f1ab5943e40b653e2f6b20b | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=966-972/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::subtract_set(self, other) | function | def subtract_set(self, other):
"""Remove all IP addresses in OTHER from this.
OTHER should be an ip_set object.
"""
self.subtract_list(other.__set) |
3,401 | fb1808c066f404162f473a626c37f75b | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1025-1036/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::subtract_range(self, lo_ip, hi_ip) | function | def subtract_range(self, lo_ip, hi_ip):
"""Subtract the range of IPs specified by LO_IP and HI_IP from this.
LO_IP and HI_IP should be ipaddr objects. They specify a
range of IP addresses. Both LO_IP and HI_IP are included in the
range.
"""
assert lo_ip.intrep != None
assert hi_ip.intrep != None
assert lo_i... |
3,402 | 9f778c53bdd6a518c7721f2008993aeb | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=489-565/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::__init__(self, mask, demand = DEMAND_NONE) | function | def __init__(self, mask, demand = DEMAND_NONE):
"""Create a netmask from MASK (a string, tuple or number) and DEMAND.
The empty string or None may be given; it is handled as the
empty netmask.
See class network for a description of the DEMAND parameter.
"""
(minbits, maxbits) = self.DEMANDS[demand]
self.deman... |
3,403 | f7cb51eae8dbcbc8ccf9a94eacdf7321 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=716-720/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::broadcast_str(self) | function | def broadcast_str(self):
if self.__broadcast_str == None:
self.__broadcast_str = intrep_to_dotted_decimal(
self.broadcast_intrep)
return self.__broadcast_str |
3,404 | 72c33730b6b3bc3a8e4b6a7865a63057 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=567-568/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::netmask_str(self) | function | def netmask_str(self):
return str(self) |
3,405 | 23619a40084b68ac344aaabc0960fda9 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=722-726/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::host_part_str(self) | function | def host_part_str(self):
if self.__host_part_str == None:
self.__host_part_str = intrep_to_dotted_decimal(
self.host_part_intrep)
return self.__host_part_str |
3,406 | 3c093b69603b6583831baba8b7047890 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=821-832/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::is_same_set(self, nwip) | function | def is_same_set(self, nwip):
"""Return true if NWIP contains the same set as this network.
NWIP must be a network object or an ipaddr object.
"""
if isinstance(nwip, ipaddr):
return (self.mask.netmask_bits == 32
and self.ip.intrep == nwip.intrep)
else:
return (self.mask.netmask_bits == nwip.mask.... |
3,407 | 140ac022be2dc91189cc7d6fd59ebe50 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1101-1106/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::add_network(self, nw) | function | def add_network(self, nw):
"""Add NW to this.
NW should be a network object.
"""
self.add_list([[nw.network_intrep, nw.broadcast_intrep]]) |
3,408 | 7e60d4c71a7c2a77f1a80dcd978c8b10 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1357-1365/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::size(self) | function | def size(self):
"""Return the total number of addresses in the network.
"""
size = 0
for (low, high) in self.__set:
size = size + high - low + 1
return size |
3,409 | 206c6b912541e62d9c06a6e4fceebede | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=834-862/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::subtract(self, nwip) | function | def subtract(self, nwip):
"""Create a list of new network objects by subtracting NWIP from self.
The result consists of networks that together span all
IP addresses that are present in self, except those that are
present in NWIP. (The result may be empty or contain several
disjoint network objects.)
Don't use ... |
3,410 | bec2a660ea33f834375093eb253135a6 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1108-1119/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::add_range(self, lo_ip, hi_ip) | function | def add_range(self, lo_ip, hi_ip):
"""Add the range of IP addresses specified by LO_IP and HI_IP to this.
LO_IP and HI_IP should be ipaddr objects. They specify a
range of IP addresses. Both LO_IP and HI_IP are included in the
range.
"""
assert lo_ip.intrep != None
assert hi_ip.intrep != None
assert lo_ip.i... |
3,411 | bf16f6191f2354b08fc7d494312ddefa | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1367-1391/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::random_ip(self) | function | def random_ip(self):
"""Return a random IP address contained in ip_set.
This method may only be called if the set is non-empty. You
can use the is_empty method to test for emptiness.
This picks an IP address from the set using the random module
and returns it as an ipaddr object.
"""
assert not self.i... |
3,412 | 78bdb45cbd71e1c4dfb698995c9a81aa | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=912-913/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::prefix_str(self) | function | def prefix_str(self):
return '%s/%d' % (self.ip_str(), self.mask.netmask_bits) |
3,413 | 30e027ef6788367a3ed78c7909bbf102 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=937-938/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::__ne__(self, other) | function | def __ne__(self, other):
return not self == other |
3,414 | 297ea0ff9d530d6bcece292d8b9fde81 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=915-917/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::network_prefix_str(self) | function | def network_prefix_str(self):
return '%s/%d' % (intrep_to_dotted_decimal(self.network_intrep),
self.mask.netmask_bits) |
3,415 | 14654e9d7fa3cd1c3f300aa45ff2ae1a | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=940-945/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::__cmp__(self, other) | function | def __cmp__(self, other):
if not isinstance(other, network):
return NotImplemented
# Note that largest netmask is smallest net
return (cmp(other.mask.netmask_bits, self.mask.netmask_bits)
or cmp(self.ip.intrep, other.ip.intrep)) |
3,416 | 0b302c9a2cd0e1c2c6128d17f2018bc1 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1421-1427/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set_from_list(lst) | function | def ip_set_from_list(lst):
"""Create an ip_set containing a list of addresses/networks.
"""
set = ip_set()
for l in lst:
set.append(l)
return set |
3,417 | 9f90a320f20d1da732d1484e77a09b50 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=404-420/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ipaddr::__eq__(self, other) | function | def __eq__(self, other):
"""Compare self with other.
Both the IP address represented by this object and the
return value of user_input() must be equal.
"""
if not isinstance(other, ipaddr):
return NotImplemented
if self.__user_input is None and other.... |
3,418 | 30e027ef6788367a3ed78c7909bbf102 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=422-423/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ipaddr::__ne__(self, other) | function | def __ne__(self, other):
return not self == other |
3,419 | 5f382fa26072b035ab462fee6dcd9f26 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=570-574/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::user_input(self) | function | def user_input(self):
if self.__user_input == None:
# Generate a string.
self.__user_input = self.netmask_str()
return self.__user_input |
3,420 | 8e3b132b89e48f9c758074533cdaa936 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=919-922/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::size(self) | function | def size(self):
"""Return the total number of addresses in the network.
"""
return self.broadcast_intrep - self.network_intrep + 1 |
3,421 | e05388882c79b52db5b5f536c2b23fd6 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1393-1401/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::__str__(self) | function | def __str__(self):
res = []
for rng in self.__set:
if rng[0] == rng[1]:
res.append(intrep_to_dotted_decimal(rng[0]))
else:
res.append('%s-%s' % (intrep_to_dotted_decimal(rng[0]),
intrep_to_dotted_decimal(rng[1])))
return ', '.join(res) |
3,422 | adee650574aae5117b9e28ac21b4696d | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=359-360/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ipaddr::ip_str(self) | function | def ip_str(self):
return str(self) |
3,423 | 756adb8a9a6b50a42e4f380aee44214b | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=461-468/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::__check_range(self, bits, minbits, maxbits) | function | def __check_range(self, bits, minbits, maxbits):
if bits < minbits:
if minbits == 1:
raise NeedOneBit()
else:
raise NeedMoreBits(minbits)
elif bits > maxbits:
raise NeedLessBits(maxbits) |
3,424 | 8114f4656384b7c14c93f2ccdd3e901f | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=576-579/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::__str__(self) | function | def __str__(self):
if self.__netmask_str == None:
self.__netmask_str = intrep_to_dotted_decimal(self.intrep)
return self.__netmask_str |
3,425 | 4a78b0bda1c5c67aab1f874b76876930 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=924-925/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::__str__(self) | function | def __str__(self):
return "%s/%d" % (self.ip_str(), self.mask.netmask_bits) |
3,426 | 6553ff258669d6a87acc68aaba61b5a4 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1403-1407/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::__eq__(self, other) | function | def __eq__(self, other):
if not isinstance(other, ip_set):
return NotImplemented
return self.__set == other.__set |
3,427 | 30e027ef6788367a3ed78c7909bbf102 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=601-602/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::__ne__(self, other) | function | def __ne__(self, other):
return not self == other |
3,428 | 06f355c05832c8f596d5cc3b244210e6 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=974-1007/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::subtract_list(self, other) | function | def subtract_list(self, other):
# Don't use this method directly, unless you are the test suite.
ix = 0
iy = 0
while ix < len(self.__set) and iy < len(other):
if self.__set[ix][1] < other[iy][0]:
# The entire range survived.
ix = ix + 1
elif self.__set[ix][0] > other[iy][1]:
# The entire other range... |
3,429 | dafb1aaaebbf6e6b9682d1c72afe1be0 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=604-608/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask::__cmp__(self, other) | function | def __cmp__(self, other):
if not isinstance(other, netmask):
return NotImplemented
# Note that largest netmask is smallest net
return cmp(other.netmask_bits, self.netmask_bits) |
3,430 | 7b696fb655eca07948a29e1dca536d9d | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1009-1016/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::subtract_ips(self, ips) | function | def subtract_ips(self, ips):
"""Remove all IP addresses in IPS from this.
IPS should be a list of ipaddr objects.
"""
for ip in ips:
self.subtract_list([[ip.intrep, ip.intrep]]) |
3,431 | f7c91d7ddb00490e667f7f8a63a9dbe3 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1081-1090/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::append(self, nwip) | function | def append(self, nwip):
"""Add NWIP to this.
NWIP should be a network object or ipaddr object.
"""
if isinstance(nwip, network):
self.add_network(nwip)
else:
self.add_ipaddr(nwip) |
3,432 | 89397b173ec2a12a22305bc237d4405f | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=197-205/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | bits_to_intrep(bits) | function | def bits_to_intrep(bits):
"""Convert BITS to the internal representation.
BITS should be a number in the range 0-32 (inclusive).
"""
assert 0 <= bits and bits <= 32
return pow(2L, 32) - pow(2L, 32-bits) |
3,433 | 0e9566dd5163c1187d4277663c7ece24 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=425-426/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ipaddr::__hash__(self) | function | def __hash__(self):
return hash((self.__class__, self.intrep)) |
3,434 | a4fc40cae8ef295927d65b93b2a47495 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=208-219/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | intrep_with_bit_set(bit) | function | def intrep_with_bit_set(bit):
"""Return an internal representation with bit BIT set.
BIT should be a number in the range 1-32, where bit 1 is the
leftmost. Examples:
intrep_with_bit_set(1) --> the internal representation of 128.0.0.0
intrep_with_bit_set(32) --> the internal representation of ... |
3,435 | 3b7af1ee879da50bdbd680d6935b370d | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1092-1099/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::add_ipaddr(self, ip) | function | def add_ipaddr(self, ip):
"""Add IP to this.
IP should be an ipaddr object.
"""
assert ip.intrep != None
self.add_list([[ip.intrep, ip.intrep]]) |
3,436 | 02b3baa57bcdc68d2009cfea7421ff8e | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=118-121/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | _(s) | function | # The error messages are marked with a call to this function, so that
# they can easily be found and translated.
def _(s):
return s |
3,437 | 6dced1c4e3f006cf08851b66e7ef17bd | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1121-1137/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::complement(self) | function | def complement(self):
"""Return everything not contained in this ip_set.
The return value is a new ip_set. This is not modified.
"""
pre = -1L
lst = []
for [lo, hi] in self.__set:
if lo != 0:
lst.append([pre+1, lo-1])
pre = hi
if pre < pow(2L, 32) - 1:
lst.append([pre+1, pow(2L, 32) - 1])
re... |
3,438 | 250ba3a16628ac1cee0aefa3af41233a | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1272-1282/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::as_str_range(self) | function | def as_str_range(self):
"""Return the set as a string, such as "1.2.3.4-1.2.3.8".
The returned value always has the form a.b.c.d-e.f.g.h.
Raises SetNotRepresentable if the set cannot be represented as a
single interval, or if it is the empty set.
"""
if len(self.__set) != 1:
raise SetNotRepresentable()
ret... |
3,439 | 7fee21bbdc676fcf9b1b1e20d18ded7f | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=927-929/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::__repr__(self) | function | def __repr__(self):
return "ipaddr.network('%s', %d, %d)" % \
(self.ip_str(), self.mask.netmask_bits, self.mask.demand) |
3,440 | b9f7a5aa63fc06f2072bb1f460bfca19 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1335-1339/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::is_empty(self) | function | def is_empty(self):
"""Return true if this ip_set is empty.
"""
return len(self.__set) == 0 |
3,441 | 30e027ef6788367a3ed78c7909bbf102 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1409-1410/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::__ne__(self, other) | function | def __ne__(self, other):
return not self == other |
3,442 | 34a60cd48968c7fb339ad84ee7f54aa3 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=931-935/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network::__eq__(self, other) | function | def __eq__(self, other):
if not isinstance(other, network):
return NotImplemented
return self.ip == other.ip and self.mask == other.mask |
3,443 | ba18288ce883c9977c24feb9464b3ebd | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1139-1196/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::intersection(self, other) | function | def intersection(self, other):
"""Return the intersection of this and OTHER.
The return value is a new ip_set. This is not modified.
OTHER should be an ip_set, network or ipaddr object.
"""
res = []
ix = 0
iy = 0
x = copy.deepcopy(self.__set)
if isinstance(other, ip_set):
y = copy.deepcopy(other.__set... |
3,444 | 117844cde4ef9915e0517c2e437d1de2 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1284-1296/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::contains(self, ip) | function | def contains(self, ip):
"""Return true if IP is contained in the set.
IP should be an ipaddr object. The empty ipaddr is never contained.
"""
if ip.intrep == None:
return False
for [lo, hi] in self.__set:
if lo <= ip.intrep <= hi:
return True
return False |
3,445 | d6b2e8f4f6e4ed79c46a06615b2aab99 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1341-1355/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::any_ip(self) | function | def any_ip(self):
"""Return one of the IP addresses contained in ip_set.
This method may only be called if the set is non-empty. You
can use the is_empty method to test for emptiness.
This picks an IP address from the set and returns it as an
ipaddr object. Given the same set of IP addresses, this
method will... |
3,446 | 1d37510543aa56d4c58ef2265a7d2fdb | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=1412-1413/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set::__hash__(self) | function | def __hash__(self):
return hash((self.__class__, tuple(map(tuple, self.__set)))) |
3,447 | 0a21fd06f1cf6475a10d9e2d73cd9b40 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=143-144/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BrokenNetmask | type | class BrokenNetmask(IpError):
format = _("Malformed netmask") |
3,448 | d8593c14e3388d6d71e3da25aa2ba9ce | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=169-171/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | NetworkAddressClash | type | class NetworkAddressClash(BrokenNetwork):
format = _("The IP address clashes with the network address with "
"this setting of the netmask") |
3,449 | 4e592dc287ffb7ec9f6afcf2fe6ee510 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=146-147/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | NeedOneBit | type | class NeedOneBit(BrokenNetmask):
format = _("At least one bit must be non-zero") |
3,450 | 6d8f4bf07746c6612ab22c025b15eb51 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=173-175/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BroadcastAddressClash | type | class BroadcastAddressClash(BrokenNetwork):
format = _("The IP address clashes with the broadcast address with "
"this setting of the netmask") |
3,451 | 9bb51a4e1c2ace155cabe3ac0d7c7801 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=130-132/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | SetNotRepresentable | type | class SetNotRepresentable(IpError):
format = _("The set of IP addresses cannot be represented "
"as a single network range") |
3,452 | ffef6b0212d408128f8154623a814e15 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=162-163/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | EmptyNetmask | type | class EmptyNetmask(BrokenNetwork):
format = _("Netmask not entered") |
3,453 | 51eb605dc7b920b60e2d14711571e107 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=282-426/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ipaddr | type | class ipaddr(object):
"""Handle IP addresses.
Sample use:
ip1 = ipaddr('12.3.5.1')
ip2 = ipaddr(201524481L)
print ip1.ip_str()
>>> '12.3.5.1'
print ip1.intrep
>>> 201524481L
print ip2.ip_str()
>>> '12.3.5.1'
print ip2.intrep
>>> 201524481L
An ipaddr object can have two states: empty or g... |
3,454 | a7930cfd764ad131a90728ae8780dbea | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=951-1418/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | ip_set | type | class ip_set(object):
def __init__(self, nwip=None):
"""Create an ip_set.
If the optional argument NWIP is supplied, the set is
initialized to it, otherwise the created set will be empty.
NWIP must be a network or ipaddr object.
"""
# [[0L, 3L], [5L, 7L]] means 0.0.0.0/29 \ 0.0.0.4/32
self.__set = []
if ... |
3,455 | 4097aacef288359bb76cb92c488582a5 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=134-135/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BrokenIpAddress | type | class BrokenIpAddress(IpError):
format = _("Malformed IP address") |
3,456 | 6a2d0bad3567a970945d7ede126169ab | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=165-167/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BrokenNetworkAddress | type | class BrokenNetworkAddress(BrokenNetwork):
format = _("%s is a malformed network address with the given netmask; "
"did you intend to write %s?") |
3,457 | 4ea8e78848db05aa4ffd0f0015d6e84f | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=429-611/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | netmask | type | class netmask(object):
"""Handle netmasks.
Sample use:
# Five ways to initialize a netmask.
nm1 = netmask('255.255.128.0', DEMAND_NONE)
nm2 = netmask([255, 255, 128, 0], DEMAND_NONE)
nm3 = netmask('17', DEMAND_NONE)
nm4 = netmask(17, DEMAND_NONE)
nm5 = netmask(4294967040L, DEMAND_NONE)
print nm1... |
3,458 | 903b8edaf8b74b2b25f2bc5a6bfaef0b | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=123-128/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | IpError | type | # The exception hierarchy.
class IpError(Exception):
"""Base class for errors that are cause by errors in input data.
"""
def __str__(self):
return self.format % self.args |
3,459 | 36a4645987d0c327f60d38292c57d2a8 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=155-157/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BrokenNetwork | type | class BrokenNetwork(IpError):
"""Base class for errors regarding network objects.
""" |
3,460 | 60804f10d569d77c1658d1b3c16ad009 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=177-180/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | BadType | type | class BadType(Exception):
"""An object of an unexpected type was passed to a function.
"""
pass |
3,461 | d287190dc88697b424ec7f2632226cb1 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=159-160/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | EmptyIpAddress | type | class EmptyIpAddress(BrokenNetwork):
format = _("IP address not entered") |
3,462 | 9f9275f7a2db79442f3270e5dc328de3 | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=618-948/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | network | type | class network(object):
"""Designate a network or host.
The constructor takes four arguments: the IP address part, the
netmask part, an optional demand parameter and an optional peer
parameter. See class ipaddr and class netmask for a description
of the first two arguments. The demand argument can... |
3,463 | deb47c4465adcf603f733a5ca55bb96c | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=137-138/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | PartNegative | type | class PartNegative(BrokenIpAddress):
format = _("A part of the IP address is negative") |
3,464 | 9aa552907b2f3ed25694df0f8daaeffd | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=149-150/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | NeedMoreBits | type | class NeedMoreBits(BrokenNetmask):
format = _("At least %d bits must be non-zero") |
3,465 | bab13dcdfcacb666591c48b442ba1bcb | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=140-141/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | PartOverflow | type | class PartOverflow(BrokenIpAddress):
format = _("A part of the IP address is greater than 255") |
3,466 | 97c3ea01aa693c6a65e3527f5d83f9cc | swh:1:cnt:7ee7221c03361206c081eb749f4522f944dcb240;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=152-153/ | d0b6ad580236df0234d019893d890b7b6583d84d | udplog | analytics | ipaddr.py | NeedLessBits | type | class NeedLessBits(BrokenNetmask):
format = _("At most %d bits may be non-zero") |
3,467 | e1aef3cb37f39052cd6c99bb5615b715 | swh:1:cnt:84b6a59fd24b63ff8e79c31b60902b50b790c4ed;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=7-50/ | 64f1ee001832578dbf3f837ed2b3facd554f08d9 | udplog | analytics | filters/5xx-filter.c | main(int argc, char **argv) | function | int main(int argc, char **argv) {
char line[10240];
char code[10240];
char *codestart, *codeend;
char *t = 0;
while (!feof(stdin)) {
char *r;
r=fgets(line, 10000, stdin);
if (!r) {
break;
}
int pos=0;
t = line;
/* eliminate mobile :-) */
if (r[0] == 'm')
continue;
while(pos++<5) {
if ... |
3,468 | d0b5936709567024dad1c896b006abd3 | swh:1:cnt:9d54a5df811fa4b791194c0b6288afa76c8e378c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=13-22/ | ae093a853aa823cb520c946200c08e40816c0e0f | udplog | analytics | filters/glam.py | test() | function | def test():
t1 = 'http://commons.wikimedia.org/wiki/File:German_prisoners_in_a_French_prison_camp._French_Pictorial_Service.,_1917_-_1919_-_NARA_-_533724.tif'
t2 = 'http://commons.wikimedia.org/wiki/File:Aerial_view_of_ruins_of_Vaux,_France,_1918,_ca._03-1918_-_ca._11-1918_-_NARA_-_512862.tif'
t3 = 'http://... |
3,469 | f147d89da65bff5849fc27385b023268 | swh:1:cnt:9d54a5df811fa4b791194c0b6288afa76c8e378c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=24-29/ | ae093a853aa823cb520c946200c08e40816c0e0f | udplog | analytics | filters/glam.py | main() | function | def main():
while True:
line = sys.stdin.readline()
match = re.search(nara, pic)
if match:
sys.stdout.write(line) |
3,470 | 40a5f753d5b37250126e71593d325cbf | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=8-90/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance | type | class EpollInstance : public FileDescriptor
{
public:
typedef std::vector<struct epoll_event> EventArray;
EpollInstance(int flags = 0)
: FileDescriptor()
{
fd = epoll_create1(flags);
if (fd == -1) {
good = false;
RaiseError("EpollInstance constructor");
} else {
good = true;
}
}
// epoll_ctl(E... |
3,471 | c2af03cfdad2b27ebdd3d6f15f2c10e1 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=47-47/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::DeletePoll::epoll_event | type | struct epoll_event |
3,472 | c2af03cfdad2b27ebdd3d6f15f2c10e1 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=11-11/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::epoll_event | type | struct epoll_event |
3,473 | c2af03cfdad2b27ebdd3d6f15f2c10e1 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=36-36/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::ModifyPoll::epoll_event | type | struct epoll_event |
3,474 | c2af03cfdad2b27ebdd3d6f15f2c10e1 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=26-26/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::AddPoll::epoll_event | type | struct epoll_event |
3,475 | b38cfcff774a5845ad7d73049ba452d7 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=57-57/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::DEFAULT_WAIT_SIZE | type | enum {DEFAULT_WAIT_SIZE = 10} |
3,476 | 74be85f55c565856f54293bf45494844 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=35-43/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::ModifyPoll(const FileDescriptor & polled, struct epoll_event & event) | function | // epoll_ctl(EPOLL_CTL_MOD) wrapper
int ModifyPoll(const FileDescriptor & polled, struct epoll_event & event) {
if (epoll_ctl(fd, EPOLL_CTL_MOD, polled.GetFD(), &event) == -1) {
RaiseError("EpollInstance::ModifyPoll");
return errno;
} else {
return 0;
}
} |
3,477 | 3750ada59cee0122daf3ff622f870c3c | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=59-72/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::EpollWait(EventArray * events, int timeout) | function | // epoll_wait() wrapper
int EpollWait(EventArray * events, int timeout) {
if (!events->size()) {
events->resize(DEFAULT_WAIT_SIZE);
}
int result = epoll_wait(fd, &((*events)[0]), events->size(), timeout);
if (result == -1) {
events->resize(0);
RaiseError("EpollInstance::EpollWait");
} else {
even... |
3,478 | c3723e6e83e4dc0d6db2209ebd6630bc | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=25-33/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::AddPoll(const FileDescriptor & polled, struct epoll_event & event) | function | // epoll_ctl(EPOLL_CTL_ADD) wrapper
int AddPoll(const FileDescriptor & polled, struct epoll_event & event) {
if (epoll_ctl(fd, EPOLL_CTL_ADD, polled.GetFD(), &event) == -1) {
RaiseError("EpollInstance::AddPoll");
return errno;
} else {
return 0;
}
} |
3,479 | ea5a5f360e7f32562aae5035dcede532 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=13-23/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::EpollInstance(int flags = 0) | function | EpollInstance(int flags = 0)
: FileDescriptor()
{
fd = epoll_create1(flags);
if (fd == -1) {
good = false;
RaiseError("EpollInstance constructor");
} else {
good = true;
}
} |
3,480 | 72b1d9e303660ab7ddbd9d0a4aa7d962 | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=45-55/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::DeletePoll(const FileDescriptor & polled) | function | // epoll_ctl(EPOLL_CTL_DEL) wrapper
int DeletePoll(const FileDescriptor & polled) {
static struct epoll_event dummy;
if (epoll_ctl(fd, EPOLL_CTL_DEL, polled.GetFD(), &dummy) == -1) {
RaiseError("EpollInstance::DeletePoll");
return errno;
} else {
return 0;
}
} |
3,481 | 1a28d843489bfaefb4c8abe02126c6cd | swh:1:cnt:d4cc194611f57c65bae8bc293306872f1cdc1cfb;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=74-88/ | ae451aa08a0ab484c5190d052f76db108a96ccdb | udplog | analytics | srclib/EpollInstance.h | EpollInstance::EpollSignalWait(EventArray * events,
int timeout, const sigset_t & sigmask) | function | // epoll_pwait() wrapper
int EpollSignalWait(EventArray * events,
int timeout, const sigset_t & sigmask) {
if (!events->size()) {
events->resize(DEFAULT_WAIT_SIZE);
}
int result = epoll_pwait(fd, &((*events)[0]), events->size(), timeout, &sigmask);
if (result == -1) {
events->resize(0);
RaiseError... |
3,482 | ed2abb20b22ff1c5493cfe08b4c02447 | swh:1:cnt:5515b0f3bccb1d0aeea2165369643964e7b49f1c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=9-24/ | c71d8dfc871a8a81e288f3af4bfc17a3fe3240ef | udplog | analytics | srclib/Exception.h | libc_error | type | class libc_error : public std::runtime_error {
public:
libc_error(const std::string & what_arg)
: std::runtime_error(std::string(what_arg).append(": ").append(std::strerror(errno))),
code(errno)
{}
const char* what() {
return msg.c_str();
}
virtual ~libc_error() throw() {}
std::string msg;
int code;
} |
3,483 | 5fcf2aa0bc9f0bacb0b202e38cbd573b | swh:1:cnt:5515b0f3bccb1d0aeea2165369643964e7b49f1c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=11-14/ | c71d8dfc871a8a81e288f3af4bfc17a3fe3240ef | udplog | analytics | srclib/Exception.h | libc_error(const std::string & what_arg) | function | libc_error(const std::string & what_arg)
: std::runtime_error(std::string(what_arg).append(": ").append(std::strerror(errno))),
code(errno)
{} |
3,484 | ec0ef41956018f8761b4a6507724e0ca | swh:1:cnt:5515b0f3bccb1d0aeea2165369643964e7b49f1c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=20-20/ | c71d8dfc871a8a81e288f3af4bfc17a3fe3240ef | udplog | analytics | srclib/Exception.h | libc_error::~libc_error() | function | virtual ~libc_error() throw() {} |
3,485 | 13f7d31e2b7b46ba7441c99cd8304879 | swh:1:cnt:5515b0f3bccb1d0aeea2165369643964e7b49f1c;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=16-18/ | c71d8dfc871a8a81e288f3af4bfc17a3fe3240ef | udplog | analytics | srclib/Exception.h | libc_error::what() | function | const char* what() {
return msg.c_str();
} |
3,486 | 91b779a51a63bccd5be2f3f828856e1b | swh:1:cnt:adbda19b7240662e25b6f1aa6c57b950af82b101;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=4-21/ | a4a2a402cb8ffcb88b7c65de351f71cede0b9ab4 | udplog | analytics | srclib/FileDescriptor.cpp | FileDescriptor::RaiseError(const char* msg) | function | void FileDescriptor::RaiseError(const char* msg)
{
if (ignoreErrors.size() == 0) {
// Ignore none
throw libc_error(msg);
}
ErrorSet * curIgnore = ignoreErrors.back().get();
if (!curIgnore) {
// Ignore all
return;
}
if (!curIgnore->count(errno)) {
// Don't ignore this one
throw libc_error(msg);
}
} |
3,487 | 8f07f51d887e64eddc161f608ee0ddb0 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=11-11/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | Socket | type | class Socket |
3,488 | ebcd8674da6c1399fa671887cb2c18be | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=13-138/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor | type | class FileDescriptor
{
private:
// Not copyable
FileDescriptor(const Socket & s) {}
protected:
FileDescriptor()
: fd(-1), good(false), ownFd(true)
{}
public:
typedef std::set<int> ErrorSet;
typedef boost::shared_ptr<ErrorSet> ErrorSetPointer;
virtual ~FileDescriptor() {
Close();
}
operator bool() {
... |
3,489 | 3ff319e63e039dbbc20721eaf35f8479 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=16-17/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::FileDescriptor(const Socket & s) | function | // Not copyable
FileDescriptor(const Socket & s) {} |
3,490 | 4ebc4839b6d09bbdc0526bf98be50eb2 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=32-34/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::good() | function | operator bool() {
return good;
} |
3,491 | e5f05f7811f24fa64e79554bacd33fc9 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=40-52/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::Close() | function | // close() wrapper
int Close() {
int status = 0;
if (fd != -1 && ownFd) {
status = close(fd);
fd = -1;
good = false;
if (status == -1) {
RaiseError("FileDescriptor::Close");
}
}
return status;
} |
3,492 | a7d89a3b7e4fd5994017c171af4d5c22 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=72-79/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::SetDescriptorFlags(long flags) | function | // fcntl(F_SETFD) wrapper
int SetDescriptorFlags(long flags) {
int status = fcntl(fd, F_SETFD, flags);
if (status == -1) {
RaiseError("FileDescriptor::SetDescriptorFlags");
}
return status;
} |
3,493 | a989281b0e88a7131182afa7b6baf7e6 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=81-88/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::GetDescriptorFlags() | function | // fcntl(F_GETFD) wrapper
long GetDescriptorFlags() {
int flags = fcntl(fd, F_GETFD);
if (flags == -1) {
RaiseError("FileDescriptor::GetDescriptorFlags");
}
return flags;
} |
3,494 | 728f844cc83656e6a9d82a6409fe87f2 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=99-106/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::GetStatusFlags() | function | // fcntl(F_GETFL) wrapper
long GetStatusFlags() {
int flags = fcntl(fd, F_GETFL);
if (flags == -1) {
RaiseError("FileDescriptor::GetStatusFlags");
}
return flags;
} |
3,495 | 0ea37ac7714fc7803614a4cd5a947c3f | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=116-119/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::Ignore(ErrorSetPointer s) | function | // Ignore a given set of errors
void Ignore(ErrorSetPointer s) {
ignoreErrors.push_back(s);
} |
3,496 | 381fc00c7a28b2ebd2a4426c84b45c24 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=126-129/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::PopIgnore() | function | // Restore the previous ignore set
void PopIgnore() {
ignoreErrors.pop_back();
} |
3,497 | 34d70aba02d28d9875cfc58c5d643a87 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=36-38/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::GetFD() | function | int GetFD() const {
return fd;
} |
3,498 | 78001c1bda9bb2b88db0e782a3db6c20 | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=20-22/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::FileDescriptor() | function | FileDescriptor()
: fd(-1), good(false), ownFd(true)
{} |
3,499 | 0a6d6d1bbc2cc3041f8c929f44825a6b | swh:1:cnt:3569b3b75dc8f4215b7c11edcd5f6c131637c8da;origin=https://gerrit.wikimedia.org/r/analytics/udplog.git;lines=28-30/ | fd81618b2634e9f1dceb824cee0154071a6384cc | udplog | analytics | srclib/FileDescriptor.h | FileDescriptor::~FileDescriptor() | function | virtual ~FileDescriptor() {
Close();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.