All Samples(82) | Call(0) | Derive(0) | Import(82)
int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If base is zero, the proper base is guessed based on the string content. If the argument is outside the integer range a long object will be returned instead.
src/p/y/pygmsn-HEAD/src/conexion/papylib/gnet/constants.py pygmsn(Download)
#
"""Constants used in GNet."""
from socket import AF_INET, AF_INET6, \
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET
try:
from socket import AF_UNIX
src/p/a/papyon-HEAD/papyon/gnet/constants.py papyon(Download)
#
"""Constants used in GNet."""
from socket import AF_INET, AF_INET6, \
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET
try:
from socket import AF_UNIX
src/l/i/limousine-HEAD/pymsn/gnet/constants.py limousine(Download)
#
"""Constants used in GNet."""
from socket import AF_INET, AF_INET6, \
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET
try:
from socket import AF_UNIX
src/g/o/gonium-HEAD/src/ip_address.py gonium(Download)
import socket from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 import struct
def _ipintfromstring(ip_string):
if not (isinstance(ip_string, str)):
# Having to do this is *so* moronic!
ip_string = ip_string.decode('ascii')
(int1, int2) = struct.unpack(b'>QQ', inet_pton(AF_INET6, ip_string))
return (int1 << 64) + int2
def __str__(self):
return inet_ntop(AF_INET6, struct.pack(b'>QQ', self.ip >> 64, self.ip & 18446744073709551615)) # 18446744073709551615 == (1 << 64)-1
src/p/y/python-conntrack-HEAD/Conntrack.py python-conntrack(Download)
import sys
from ctypes import *
from threading import Thread, Lock
from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP
nfct = CDLL('libnetfilter_conntrack.so')
libc = CDLL('libc.so.6')
libc.inet_addr(src))
nfct.nfct_set_attr_u32(ct, ATTR_IPV4_DST,
libc.inet_addr(dst))
elif self.__family == AF_INET6:
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_SRC,
libc.inet_addr(src))
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_DST,
libc.inet_addr(src))
nfct.nfct_set_attr_u32(ct, ATTR_IPV4_DST,
libc.inet_addr(dst))
elif self.__family == AF_INET6:
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_SRC,
libc.inet_addr(src))
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_DST,
src/c/o/Conntrack-0.3/Conntrack.py Conntrack(Download)
import sys
from ctypes import *
from threading import Thread, Lock
from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP
nfct = CDLL('libnetfilter_conntrack.so')
libc = CDLL('libc.so.6')
libc.inet_addr(src))
nfct.nfct_set_attr_u32(ct, ATTR_IPV4_DST,
libc.inet_addr(dst))
elif self.__family == AF_INET6:
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_SRC,
libc.inet_addr(src))
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_DST,
libc.inet_addr(src))
nfct.nfct_set_attr_u32(ct, ATTR_IPV4_DST,
libc.inet_addr(dst))
elif self.__family == AF_INET6:
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_SRC,
libc.inet_addr(src))
nfct.nfct_set_attr_u128(ct, ATTR_IPV6_DST,
src/p/y/pymilter-0.9.3/milter-template.py pymilter(Download)
import StringIO import time import email from socket import AF_INET, AF_INET6 from Milter import parse_addr
def connect(self, IPname, family, hostaddr):
# (self, 'ip068.subnet71.example.com', AF_INET, ('215.183.71.68', 4720) )
# (self, 'ip6.mxout.example.com', AF_INET6,
# ('3ffe:80e8:d8::1', 4720, 1, 0) )
self.IP = hostaddr[0]
self.port = hostaddr[1]
if family == AF_INET6:
src/p/y/pysnmp-4.1.13a/pysnmp/carrier/asynsock/dgram/udp6.py pysnmp(Download)
"""Implements asyncore-based UDP6 transport domain"""
try:
from socket import AF_INET6
except:
AF_INET6 = None
from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport
src/j/y/jython-HEAD/sandbox/tobias/jython/Lib/test/test_socket.py jython(Download)
def testIPv6toString(self):
if not hasattr(socket, 'inet_pton'):
return # No inet_pton() on this platform
try:
from socket import inet_pton, AF_INET6, has_ipv6
if not has_ipv6:
return
except ImportError:
return
f = lambda a: inet_pton(AF_INET6, a)
def testStringToIPv6(self):
if not hasattr(socket, 'inet_ntop'):
return # No inet_ntop() on this platform
try:
from socket import inet_ntop, AF_INET6, has_ipv6
if not has_ipv6:
return
except ImportError:
return
f = lambda a: inet_ntop(AF_INET6, a)
src/j/y/jython-HEAD/sandbox/wierzbicki/test27/Lib/test/test_socket.py jython(Download)
def testIPv6toString(self):
if not hasattr(socket, 'inet_pton'):
return # No inet_pton() on this platform
try:
from socket import inet_pton, AF_INET6, has_ipv6
if not has_ipv6:
return
except ImportError:
return
f = lambda a: inet_pton(AF_INET6, a)
def testStringToIPv6(self):
if not hasattr(socket, 'inet_ntop'):
return # No inet_ntop() on this platform
try:
from socket import inet_ntop, AF_INET6, has_ipv6
if not has_ipv6:
return
except ImportError:
return
f = lambda a: inet_ntop(AF_INET6, a)
1 | 2 | 3 | 4 | 5 Next