本文整理汇总了Python中viper.core.database.Database.get_sample_count方法的典型用法代码示例。如果您正苦于以下问题:Python Database.get_sample_count方法的具体用法?Python Database.get_sample_count怎么用?Python Database.get_sample_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viper.core.database.Database
的用法示例。
在下文中一共展示了Database.get_sample_count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: logo
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def logo():
print(""" _
(_)
_ _ _ ____ _____ ____
| | | | | _ \| ___ |/ ___)
\ V /| | |_| | ____| |
\_/ |_| __/|_____)_| v{}
|_|
""".format(__version__))
db = Database()
count = db.get_sample_count()
try:
db.find('all')
except Exception:
print_error("You need to update your Viper database. Run 'python update.py -d'")
sys.exit()
if __project__.name:
name = __project__.name
else:
name = 'default'
print(magenta("You have " + bold(count)) +
magenta(" files in your " + bold(name)) +
magenta(" repository"))
示例2: logo
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def logo():
print(""" _
(_)
_ _ _ ____ _____ ____
| | | | | _ \| ___ |/ ___)
\ V /| | |_| | ____| |
\_/ |_| __/|_____)_| v1.3-dev
|_|
""")
db = Database()
count = db.get_sample_count()
# Handle the New database format
try:
db.find('all', None)
except:
print_error("You need to update your viper database. Run 'python update.py -d'")
sys.exit()
if __project__.name:
name = __project__.name
else:
name = 'default'
print(magenta("You have " + bold(count)) +
magenta(" files in your " + bold(name) +
magenta(" repository".format(bold(name)))))
if cfg.autorun.enabled and len(cfg.autorun.commands) == 0:
print_warning("You have enabled autorun but not set any commands in viper.conf.")
示例3: logo
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def logo():
print(""" _
(_)
_ _ _ ____ _____ ____
| | | | | _ \| ___ |/ ___)
\ V /| | |_| | ____| |
\_/ |_| __/|_____)_| v1.2
|_|
""")
db = Database()
count = db.get_sample_count()
if __project__.name:
name = __project__.name
else:
name = 'default'
print(magenta("You have " + bold(count)) +
magenta(" files in your " + bold(name) +
magenta(" repository".format(bold(name)))))
示例4: landing
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def landing(p=False):
contents = {}
if p in project_list():
__project__.open(p)
contents['p'] = p
else:
__project__.open("../")
contents['p'] = 'Main'
db = Database()
# Pagination
# 25 per page
value = 25
offset = 0
contents['count'] = db.get_sample_count()
page = request.query.page
if not page:
page = 0
offset = int(page) * int(value)
contents['act_page'] = page
contents['latest'] = db.find('latest', value=value, offset=offset)
# return the Template
return template('index.tpl', **contents)
示例5: landing
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def landing(p=False):
contents = {}
if p in project_list():
__project__.open(p)
contents["p"] = p
else:
__project__.open("../")
contents["p"] = "Main"
db = Database()
# Pagination
# 25 per page
value = 25
offset = 0
contents["count"] = db.get_sample_count()
page = request.query.page
if not page:
page = 0
offset = int(page) * int(value)
contents["act_page"] = page
contents["latest"] = db.find("latest", value=value, offset=offset)
# return the Template
return template("index.tpl", **contents)
示例6: logo
# 需要导入模块: from viper.core.database import Database [as 别名]
# 或者: from viper.core.database.Database import get_sample_count [as 别名]
def logo():
print(""" _
(_)
_ _ _ ____ _____ ____
| | | | | _ \| ___ |/ ___)
\ V /| | |_| | ____| |
\_/ |_| __/|_____)_| v1.3-dev
|_|
""")
db = Database()
count = db.get_sample_count()
if __project__.name:
name = __project__.name
else:
name = 'default'
print(magenta("You have " + bold(count)) +
magenta(" files in your " + bold(name) +
magenta(" repository".format(bold(name)))))
if cfg.autorun.enabled and len(cfg.autorun.commands) == 0:
print_warning("You have enabled autorun but not set any commands in viper.conf.")