Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@concurrent.thread(name='decorator_kwarg')
def name_keyword_decorated_and_argument(name='bar'):
return (threading.current_thread().name, name)
@concurrent.thread(name='concurrent_thread_name')
def name_keyword_decorated():
return threading.current_thread().name
@concurrent.thread
def stcmethod():
return 2
@concurrent.thread(daemon=False)
def daemon_keyword_decorated():
return threading.current_thread().daemon
@concurrent.thread
def instmethod(self):
return self.b
@concurrent.thread
def error_decorated():
raise RuntimeError("BOOM!")
@thread
def load(self):
if self.model.config_path!='':
self.config=json.load(open(self.model.config_path))
else:
self.config={'CLASS_NAMES':['background','target']}
with self.graph.as_default():
self.model.load_network()
self.model.load_weight()
self.is_weight_loaded=True
self.ids.btn_load_weight.text='Load Model'
@concurrent.thread
def run(self):
if not self.graph is None:
with self.graph.as_default():
if self.use_selected_data:
input=self.data['selection']['data']['content']
result=self.func(input,**self.kwargs)
else:
result=self.func(**self.kwargs)
else:
if self.use_selected_data:
input=self.data['selection']['data']['content']
result=self.func(input,**self.kwargs)
else:
result=self.func(**self.kwargs)
return result
@ thread # run in separate thread
def collect_plugins(self):
for name in self.plugin_package_names:
plugin_wrapper=PluginWrapper(name)
if plugin_wrapper.is_valid is True:
plugin_wrapper.bind(is_disabled=self.on_plugin_disable_clicked)
plugin_wrapper.bind(is_valid=self.on_plugin_validity_changed)
plugin_wrapper.bind(instance=self.on_plugin_instance_changed)
self.plugins[plugin_wrapper.id]={'type':plugin_wrapper.type,'disabled':False,'wrapper':plugin_wrapper,'instance':plugin_wrapper.instance}