本文整理汇总了Python中profile.Profile.count_keys方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.count_keys方法的具体用法?Python Profile.count_keys怎么用?Python Profile.count_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profile.Profile
的用法示例。
在下文中一共展示了Profile.count_keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Profile
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import count_keys [as 别名]
sys.exit(0)
scriptdir = os.path.dirname(os.path.abspath(__file__))
config = ConfigParser.ConfigParser()
config.read(os.path.join(scriptdir, "config.ini"))
p = Profile(name=config.get("archive", "name"),
description=config.get("archive", "description"),
homepage=config.get("archive", "homepage"),
accesspoint=config.get("archive", "accesspoint"),
memento_compliance=config.get("archive", "memento_compliance"),
timegate=config.get("archive", "timegate"),
timemap=config.get("archive", "timemap"),
established=config.get("archive", "established"),
profile_updated=time.strftime("%Y-%m-%dT%H:%M:%SZ"),
mechanism="https://oduwsdl.github.io/terms/mechanism#cdx")
cp = CDXExtractProfiler(max_host_segments=config.get("profile", "max_host_segments"),
max_path_segments=config.get("profile", "max_path_segments"),
global_stats=config.getboolean("profile", "generate_global_stats"))
cp.process_cdx_extracts(sys.argv[1:])
cp.calculate_stats()
p.stats = cp.stats
if config.getboolean("profile", "generate_key_stats"):
p.count_keys()
jsonstr = p.to_json()
opf = "profile-"+time.strftime("%Y%m%d-%H%M%S")+".json"
if config.getboolean("output", "write_to_file"):
write_json(jsonstr, filepath=os.path.join(scriptdir, "json", opf))
else:
print(jsonstr)
if config.getboolean("output", "write_to_github"):
post_gist(jsonstr, filename=opf)