本文整理汇总了Python中console.Console方法的典型用法代码示例。如果您正苦于以下问题:Python console.Console方法的具体用法?Python console.Console怎么用?Python console.Console使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类console
的用法示例。
在下文中一共展示了console.Console方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import console [as 别名]
# 或者: from console import Console [as 别名]
def main():
parser = argparse.ArgumentParser(
prog='ArtStationDownloader',
description='ArtStation Downloader is a lightweight tool to help you download images and videos from the ArtStation')
parser.add_argument('--version', action='version',
version='%(prog)s '+__version__)
parser.add_argument('-u', '--username',
help='choose who\'s project you want to download, one or more', nargs='*')
parser.add_argument('-d', '--directory', help='output directory')
parser.add_argument(
'-t', '--type', choices=['all', 'image', 'video'], default="all", help='what do you what to download, default is all')
parser.add_argument('-v', '--verbosity', action="count",
help="increase output verbosity")
args = parser.parse_args()
if args.username:
if args.directory:
console = Console()
console.download_by_usernames(args.username, args.directory, args.type)
else:
print("no output directory, please use -d or --directory option to set")
else:
app = App(version=__version__)
app.mainloop() # 进入主循环,程序运行
示例2: create_console_tab
# 需要导入模块: import console [as 别名]
# 或者: from console import Console [as 别名]
def create_console_tab(self):
from console import Console
self.console = console = Console()
return console
示例3: __init__
# 需要导入模块: import console [as 别名]
# 或者: from console import Console [as 别名]
def __init__(self):
"""
Pull all variables from config.py file.
"""
self.player = Player()
self.database = config.database
self.Max_point_tournament = config.Max_point_tournament
self.BotNet_update = config.BotNet_update
self.joinTournament = config.joinTournament
self.tournament_potator = config.tournament_potator
self.booster = config.booster
self.Use_netcoins = config.Use_netcoins
self.attacks_normal = config.attacks_normal
self.updates = config.updates
self.updatecount = config.updatecount
self.maxanti_normal = config.maxanti_normal
self.active_cluster_protection = config.active_cluster_protection
self.mode = config.mode
self.number_task = config.number_task
self.min_energy_botnet = config.minimal_energy_botnet_upgrade
self.stat = "0"
self.wait_load = config.wait_load
self.c = Console(self.player)
self.u = Update(self.player)
# disable botnet for > api v13
self.b = Botnet(self.player)
self.ddos = ddos.Ddos(self.player)
self.m = Mails(self.player)
self.init()
示例4: __init__
# 需要导入模块: import console [as 别名]
# 或者: from console import Console [as 别名]
def __init__(self, player):
self.ddos_cluster = config.ddos_cluster
self.database = config.database
self.Max_point_tournament = config.Max_point_tournament
self.username = player.username
self.password = player.password
self.uhash = player.uhash
self.c = console.Console(player)
示例5: __init__
# 需要导入模块: import console [as 别名]
# 或者: from console import Console [as 别名]
def __init__(self, name="MianBot", build_console=True, w2v_model_path="model/ch-corpus-3sg.bin"):
"""
# Args:
- build_console: 是否要建構依照詞向量進行主題匹配的 console,
如果只需要 qa 模組,可將 build_console 關閉,可見 demo_qa.py
"""
self.name = name # The name of chatbot.
self.speech = '' # The lastest user's input
self.speech_domain = '' # The domain of speech.
self.speech_matchee = '' # The matchee term of speech.
self.speech_path = None # The classification tree traveling path of speech.
self.speech_seg = []
self.root_domain = None # The root domain of user's input.
self.domain_similarity = 0.0 # The similarity between domain and speech.
cur_dir = os.getcwd()
os.chdir(os.path.dirname(__file__))
self.extract_attr_log = open('log/extract_arrt.log','w',encoding='utf-8')
self.exception_log = open('log/exception.log','w',encoding='utf-8')
os.chdir(cur_dir)
# For rule matching
if build_console:
self.console = console.Console(model_path=w2v_model_path)
# self.custom_rulebase = crb.CustomRuleBase() # for one time matching.
# self.custom_rulebase.model = self.console.rb.model # pass word2vec model
# For Question Answering
self.github_qa_unupdated = False
if not self.github_qa_unupdated:
try:
self.answerer = qa.Answerer()
except Exception as exc:
print("[QA] 請確認問答資料集的目錄結構是否正確")
print("[QA] 如尚未取得問答資料集, 請至 Github: zake7749/Chatbot/Readme.md 中下載, 或將 self.github_qa_unupdated 設為 true")
self.default_response = [
"是嗎?",
"我不太明白你的意思",
"原來如此"
]