本文整理汇总了Python中threading.Thread.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.__init__方法的具体用法?Python Thread.__init__怎么用?Python Thread.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类threading.Thread
的用法示例。
在下文中一共展示了Thread.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self):
self.path = "logs/"
self.names = []
self.logs = {}
self.id = {}
self.current_index = {}
self.log_file_name = {}
self.log_file = {}
self.log_path = ""
self.log_file_path = {}
self._running = False
self.event = None
Thread.__init__(self)
示例2: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, laddress, data_callback, family = None, o = None):
if o == None:
if family == None:
if laddress != None and laddress[0].startswith('['):
family = socket.AF_INET6
laddress = (laddress[0][1:-1], laddress[1])
else:
family = socket.AF_INET
self.family = family
self.laddress = laddress
self.data_callback = data_callback
else:
self.laddress, self.data_callback, self.family, self.nworkers, self.flags, \
self.ploss_out_rate, self.pdelay_out_max, self.ploss_in_rate, \
self.pdelay_in_max = o.laddress, o.data_callback, o.family, \
o.nworkers, o.flags, o.ploss_out_rate, o.pdelay_out_max, o.ploss_in_rate, \
o.pdelay_in_max
示例3: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, global_config, address = '/var/run/rtpproxy.sock', \
bind_address = None, nworkers = 1, family = socket.AF_UNIX):
#print('Rtp_proxy_client_stream.__init__', address, bind_address, nworkers, family)
if family == socket.AF_UNIX:
self.is_local = True
self.address = address
else:
self.is_local = False
self.address = self.getdestbyaddr(address, family)
self.family = family
self.wi_available = Condition()
self.wi = []
self.nworkers = nworkers
self.workers = []
for i in range(0, self.nworkers):
try:
self.workers.append(_RTPPLWorker(self))
except:
break
self.nworkers_act = i + 1
self.delay_flt = recfilter(0.95, 0.25)
示例4: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self,user,password,socket,logdir,isdebug):
Thread.__init__(self)
self.user = user
self.password = password
self.socket = socket
self.logdir = logdir
self.isdebug = isdebug
self.errorno = 0
self.dbcursor = self.init_dbconn()
self.port = self.init_port()
self.start_position = 0
self.stop_position = 0
self.lockfile = "/tmp/mysql_repl_repair" + str(self.port) + ".lck"
self.logger = MyLogger(self.port, self.logdir, self.isdebug)
self.logger.info("*"*64)
self.logger.info(" "*25 + "PROCESS START")
self.logger.info("*"*64)
示例5: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, host, user, passwd=None, private_key=None, port=22, proxy_host=None):
# Atributo para la version "thread"
self.thread = None
self.proxy_host = proxy_host
self.tty = False
self.port = port
self.host = host
self.username = user
self.password = passwd
self.private_key = private_key
self.private_key_obj = None
if (private_key is not None and private_key.strip() != ""):
private_key_obj = StringIO()
if os.path.isfile(private_key):
pkfile = open(private_key)
for line in pkfile.readlines():
private_key_obj.write(line)
pkfile.close()
else:
private_key_obj.write(private_key)
private_key_obj.seek(0)
self.private_key_obj = paramiko.RSAKey.from_private_key(
private_key_obj)
示例6: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, base_addr, size):
Thread.__init__(self)
self.base_addr = base_addr # the vector we are monitoring
self.size = size # its size
self.messages = Queue() # cross-thread communication
# store contents of vec
self.values = []
int_t = gdb.lookup_type('int')
for idx in range(0, size):
self.values.append(int((base_addr + idx).dereference().cast(int_t)))
self.animations = []
# Front end code
# These methods run in the gdb thread in response to breakpoints,
# and accept gdb.Value objects
# Updates for instrumented actions
示例7: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self):
Thread.__init__(self)
self.__simulator = None
self.__parserManager = None
self.__mixerDataTable = None
self.__useThreading = False
if self.__useThreading:
self.__stop = False
self.__waitTimeout = 3600
self.__messageQueue = Queue()
#----------------------------------------------------------------------------------------
#
#
#
示例8: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self):
Thread.__init__(self)
self.__running = False
self.__lock = Lock()
self.__data = {} # key=threadId, value={timeoutHint: timestamp, lastUpdate: timestamp}
self.__watchDogFile = "/dev/watchdog"
self.__watchDogDescriptor = None
self.__watchDogTimeout = 5
self.__lastWatchdogTimestamp = None
self.__lastCheckTimestamp = None
self.__lastNoneIpTimestamp = None
self.__pause = False
self.__wifiRefreshTimeout = 60 * 2
self.__wifiNoneIpTimeout = 60 * 1
self.__systemTimeChangeThreshold = 60 * 10 # on which system time change(ntpd) threshold we should reset
self.__mainManager = None
#----------------------------------------------------------------------------------------
#
#
#
示例9: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self):
print("Hello world")
Thread.__init__(self)
示例10: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, context, monitor_p):
self.context = context
self._as_parameter_ = monitor_p
self._libudev = context._libudev
self._started = False
示例11: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self):
Thread.__init__(self)
self.daemon = True
self.running = False
示例12: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, mode="train", contract_type="classic", config='config/', db=None, agent="PPO"):
self.db = db
if not "/" in config[len(config)-1]:
raise ValueError("You forget \"/\" at the end, it should be {}/".format(config))
self.env = None
self.mode = mode
self.contract_type = contract_type
self.config = config
self.agent = None
self.worker = None
self.saver = Saver()
self.logger = None
self.dl = None
self.settings = dict()
if self.saver.check_settings_files(config):
self.settings['env'], self.settings['agent'], self.settings['network'] = self.saver.load_settings(config)
self.logger = Logger()
self.dl = dataLoader(directory=self.settings['env']['base']['data_directory'], mode=self.mode)
#self.settings['env']['base'].pop('data_directory')
self.saver._check(self.settings['agent']['type'].split('_')[0].upper(), self.settings)
else:
self.initEnv()
default_env, default_network = self.env.get_default_settings()
self.saver.save_settings(default_env,
getattr(__import__('TradzQAI'), agent).get_specs(),
default_network, config)
Thread.__init__(self)
示例13: src_agents
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def src_agents(self):
ignore = ['Agent.py', '__init__.py', '__pycache__']
valid = []
for f in os.listdir("TradzQAI/agents"):
if f not in ignore:
valid.append(f.replace(".py", ""))
return valid
示例14: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, mode="train", contract_type="classic",
config='config/', db=None, agent="PPO"):
self.db = db
if not "/" in config[len(config)-1]:
raise ValueError("You forget \"/\" at the end, it should be {}/".format(config))
self.env = None
self.mode = mode
self.contract_type = contract_type
self.config = config
self.agent = None
self.worker = None
self.api_name = None
self.saver = Saver()
self.logger = None
self.dl = None
self.settings = dict()
if self.saver.check_settings_files(config):
self.settings['env'], self.settings['agent'], self.settings['network'] = self.saver.load_settings(config)
self.logger = Logger()
else:
self.initEnv()
default_env, default_network = self.env.get_default_settings()
self.saver.save_settings(default_env,
getattr(__import__('TradzQAI'), agent).get_specs(),
default_network, config)
Thread.__init__(self)
示例15: __init__
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
def __init__(self, file_name):
Thread.__init__(self)
self.file_name = file_name