本文整理汇总了Python中connection.Connection.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.__init__方法的具体用法?Python Connection.__init__怎么用?Python Connection.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connection.Connection
的用法示例。
在下文中一共展示了Connection.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, urlOrCfg, project=None, certificate=None, privateKey=None, caChain=None):
'''Initialize resource.
This is done either by specifying all components or by only giving the
first parameter pointing to a resource daemon configuration file.
Instead of a resource daemon configuration file, it can also point to a
tarball containing LGI.cfg as resource daemon configuration file and
certificates.
@type urlOrCfg str
@param urlOrCfg location of configuration file, or LGI project server url
@type project str
@param project LGI project to work with
@type certificate str
@param certificate location of user certificate file
@type privateKey str
@param privateKey location of user private key file
@type caChain str
@param caChain location of CA chain to validate LGI project server with
'''
self._apps = None
self._sessionId = None
self._tmpdir = None
if project:
Connection.__init__(self, urlOrCfg, project, certificate, privateKey, caChain)
else:
Connection.__init__(self, None, None, None, None, None)
if tarfile.is_tarfile(urlOrCfg):
self.parseTarball(urlOrCfg)
else:
self.parseConfig(urlOrCfg)
示例2: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, url=None, project=None, user=None, groups=None, certificate=None, privateKey=None, caChain=None):
'''Initialize LGI client connection.
Configuration can be supplied as parameters, or else defaults will
be read from the first existing file/directory out of this list:
@type url str
@param url LGI project server url to work with
@type project str
@param project LGI project to work with
@type user str
@param user LGI username
@type groups str
@param groups LGI groups
@type certificate str
@param certificate location of user certificate file
@type privateKey str
@param privateKey location of user private key file
@type caChain str
@param caChain location of CA chain to validate LGI project server with
'''
Connection.__init__(self, url, project, certificate, privateKey, caChain)
self.readConfig()
if url is not None: self._url = url
if project is not None: self._project = project
if certificate is not None: self._certificate = certificate
if privateKey is not None: self._privateKey = privateKey
if caChain is not None: self._chChain = caChain
if user is not None: self._user = user
if groups is not None: self._groups = groups
示例3: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, dcfilename=default_dcfilename):
Connection.__init__(self)
self.mod = module.Module()
# Add Astron-specific keywords
for word in astron_keywords:
self.mod.add_keyword(word)
dcfile.parse_dcfile(self.mod, dcfilename)
# Create class definition dicts
self.create_dclass_dicts()
self.distributed_objects = {}
self.owner_views = {}
self.handlers = {}
# FIXME: Maybe move this into ClientRepository, if Internals won't get Interests in the future.
# FIXME: Actually, fold this into the general callback mechanism.
self.interest_counters = {}
self.interest_callback_map = {}
# The callback system for handling *_RESP messages
self.msg_to_msgresp_map = {
servermsg.STATESERVER_OBJECT_GET_FIELD : servermsg.STATESERVER_OBJECT_GET_FIELD_RESP,
servermsg.STATESERVER_OBJECT_GET_FIELDS : servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP,
servermsg.STATESERVER_OBJECT_GET_ALL : servermsg.STATESERVER_OBJECT_GET_ALL_RESP,
servermsg.STATESERVER_OBJECT_GET_LOCATION : servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP,
servermsg.STATESERVER_OBJECT_GET_AI : servermsg.STATESERVER_OBJECT_GET_AI_RESP,
servermsg.STATESERVER_OBJECT_GET_OWNER : servermsg.STATESERVER_OBJECT_GET_OWNER_RESP,
servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT : servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP,
servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT : servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP,
servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT : servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP,
servermsg.DBSS_OBJECT_GET_ACTIVATED : servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP,
servermsg.DBSERVER_CREATE_OBJECT : servermsg.DBSERVER_CREATE_OBJECT_RESP,
servermsg.DBSERVER_OBJECT_GET_FIELD : servermsg.DBSERVER_OBJECT_GET_FIELD_RESP,
servermsg.DBSERVER_OBJECT_GET_FIELDS : servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP,
servermsg.DBSERVER_OBJECT_GET_ALL : servermsg.DBSERVER_OBJECT_GET_ALL_RESP,
servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS : servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP,
servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS: servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP,
servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY : servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP,
}
self.context_counters = {
servermsg.STATESERVER_OBJECT_GET_FIELD_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_ALL_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_AI_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_OWNER_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP : 0,
servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP : 0,
servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP : 0,
servermsg.DBSERVER_CREATE_OBJECT_RESP : 0,
servermsg.DBSERVER_OBJECT_GET_FIELD_RESP : 0,
servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP : 0,
servermsg.DBSERVER_OBJECT_GET_ALL_RESP : 0,
servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP : 0,
servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP: 0,
servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP : 0,
}
self.callbacks = {}
示例4: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, inmod, outmod, name=None,
inSliceFrom=0, inSliceTo=None, outSliceFrom=0, outSliceTo=None):
if outSliceTo is None:
outSliceTo = outmod.indim
size = outSliceTo - outSliceFrom
Connection.__init__(self, inmod, outmod, name,
inSliceFrom, inSliceTo, outSliceFrom, outSliceTo)
ParameterContainer.__init__(self, size)
示例5: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, source=None, target=None, weights=None, toric=False, fft=True):
""" """
Connection.__init__(self, source, target, toric)
self._src_rows = None
self._src_cols = None
self._fft = fft
self.setup_weights(weights)
self.setup_equation(None)
示例6: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, socket, parent):
self.link = socket
self.flags = FLAG_NONE
self.tbuf = ""
Client.__init__(self)
Connection.__init__(self, socket, parent)
self.local = True
self.queue = Queue.Queue()
示例7: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, transport, source_address, source_port, destination_address, destination_port, app=None):
Connection.__init__(self, transport, source_address, source_port, destination_address, destination_port, app)
self.send_buffer = ""
self.receive_buffer = ""
self.packet_is_outstanding = False
self.mss = 1000
self.sequence = 0
self.last_sent = 0
self.ack = 0
self.timer = None
self.timeout = 1
self.max_sequence = math.pow(2, 64)
示例8: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, pool, max_retries, *args, **kwargs):
self._pool = pool
self._retry_count = 0
self.max_retries = max_retries
self.info = {}
self.starttime = time.time()
self.operation_count = 0
self._state = ConnectionWrapper._CHECKED_OUT
Connection.__init__(self, *args, **kwargs)
self._pool._notify_on_connect(self)
# For testing purposes only
self._should_fail = False
self._original_meth = self.send_batch_mutate
示例9: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, useSSL, certificatesDirectory, port, transferQueue, incomingDataThread, callbackObject) :
"""
Initializes the connection's state
Args:
useSSL: if True, all the traffic will be protectd by SSLv4. If false,
certificatesDirectory: the directory where the certificates are stored
port: the port assigned to the connection.
transferQueue: the incoming data transferQueue assigned to the connection
incomingDataThread: the incoming data thread assigned to the connection
callbackObject: the callback object assigned to the connection
"""
Connection.__init__(self, useSSL, certificatesDirectory, port, transferQueue, incomingDataThread, callbackObject)
self.__listenningPort = None
示例10: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, useSSL, certificatesDirectory, host, port, transferQueue,
incomingDataThread, reconnect, callbackObject):
"""
Initializes the connection's state
Args:
useSSL: if True, all the traffic will be protectd by SSLv4. If false,
certificatesDirectory: the directory where the certificates are stored
host: the server's hostname or IPv4 address
port: the port assigned to the connection.
transferQueue: the incoming data transferQueue assigned to the connection
incomingDataThread: the incoming data thread assigned to the connection
reconnect: if True, the network subsystem will try to reestablish the unexpectedly closed client connection.
callbackObject: the callback object assigned to the connection
"""
Connection.__init__(self, useSSL, certificatesDirectory, port, transferQueue, incomingDataThread, callbackObject)
self.__host = host
self.__reconnect = reconnect
示例11: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, mother, *args, **kwargs):
Connection.__init__(self, *args, **kwargs)
self._replaceParamsByMother(mother)
示例12: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, source=None, target=None, weights=None, equation = '', toric=False):
""" """
Connection.__init__(self, source, target, toric)
self.setup_weights(weights)
self.setup_equation(equation)
示例13: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Connection.__init__(self, *args, **kwargs)
assert self.indim == self.outdim, \
"Indim (%i) does not equal outdim (%i)" % (
self.indim, self.outdim)
示例14: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, targetHostname):
Connection.__init__(self, targetHostname)
示例15: __init__
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Connection.__init__(self, *args, **kwargs)
self.model = None