本文整理匯總了Python中dragonfly.Config.targets方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.targets方法的具體用法?Python Config.targets怎麽用?Python Config.targets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dragonfly.Config
的用法示例。
在下文中一共展示了Config.targets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: bring_it
# 需要導入模塊: from dragonfly import Config [as 別名]
# 或者: from dragonfly.Config import targets [as 別名]
def bring_it(self):
target = self.target
# os.startfile默認程序打開
os.startfile(target, self.verb)
class ssh(BringableBase):
putty_path = r"C:\Program Files\PuTTY\putty"
def bring_it(self):
subprocess.Popen([self.putty_path, "-load", self.target])
#---------------------------------------------------------------------------
# Set up this module's configuration.
# _bringme.txt所對應的配置文件
config = Config("bring me")
config.targets = Section("Targets section")
config.targets.mapping = Item(
default={# 配置文件=>targets.mapping =
"my site": website("http://www.google.com"),
},
doc="Mapping of spoken targets to bringable targets.",
namespace={
"website": website,
"open": open,
"folder": folder,
"ssh": ssh,
},
)
config.lang = Section("Language section")
config.lang.bring_me = Item("bring me <target>",
doc="Command to bring a target;"