本文整理汇总了Python中system.storage.manager.StorageManager.release_file方法的典型用法代码示例。如果您正苦于以下问题:Python StorageManager.release_file方法的具体用法?Python StorageManager.release_file怎么用?Python StorageManager.release_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类system.storage.manager.StorageManager
的用法示例。
在下文中一共展示了StorageManager.release_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Manager
# 需要导入模块: from system.storage.manager import StorageManager [as 别名]
# 或者: from system.storage.manager.StorageManager import release_file [as 别名]
#.........这里部分代码省略.........
@deprecated("Use the plugin manager directly")
def unload_plugin(self, name):
"""
Attempt to unload a plugin by name.
This will return one of the system.enums.PluginState values.
:param name: The name of the plugin
:type name: str
"""
return self.plugman.unload_plugin(name)
def unload_protocol(self, name): # Removes with a shutdown
"""
Attempt to unload a protocol by name. This will also shut it down.
:param name: The name of the protocol
:type name: str
:return: Whether the protocol was unloaded
:rtype: bool
"""
if name in self.factories:
proto = self.factories[name]
try:
proto.shutdown()
except Exception:
self.logger.exception(_("Error shutting down protocol %s")
% name)
finally:
try:
self.storage.release_file(self, "config",
"protocols/%s.yml" % name)
self.storage.release_files(proto)
self.storage.release_files(proto.protocol)
except Exception:
self.logger.exception("Error releasing files for protocol "
"%s" % name)
del self.factories[name]
return True
return False
def unload(self):
"""
Shut down and unload everything.
"""
# Shut down!
for name in self.factories.keys():
self.logger.info(_("Unloading protocol: %s") % name)
self.unload_protocol(name)
self.plugman.unload_plugins()
if reactor.running:
try:
reactor.stop()
except Exception:
self.logger.exception("Error stopping reactor")
# Grab stuff
def get_protocol(self, name):
"""