当前位置: 首页>>代码示例>>Python>>正文


Python Timer.get_time_taken_pretty方法代码示例

本文整理汇总了Python中timer.Timer.get_time_taken_pretty方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.get_time_taken_pretty方法的具体用法?Python Timer.get_time_taken_pretty怎么用?Python Timer.get_time_taken_pretty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timer.Timer的用法示例。


在下文中一共展示了Timer.get_time_taken_pretty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cluster_docs

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import get_time_taken_pretty [as 别名]
def cluster_docs():
    timer = Timer()
    timer.start()
    from clustering.K_means import K_means
    c = K_means()
    c.clusterDocs()
    timer.end()

    return render_template('clustering_result.html',
        duration=timer.get_time_taken_pretty(),
        numclusters=len(c.centroidList)
    )
开发者ID:MJafarMashhadi,项目名称:MiniGoogle,代码行数:14,代码来源:ui.py

示例2: page_rank

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import get_time_taken_pretty [as 别名]
def page_rank():
    timer = Timer()
    timer.start()

    from pageRank.PageRank import PageRank
    c = PageRank()
    c.pageRank()

    timer.end()

    return render_template('pagerank_result.html',
        duration=timer.get_time_taken_pretty()
    )
开发者ID:MJafarMashhadi,项目名称:MiniGoogle,代码行数:15,代码来源:ui.py

示例3: _generic_index

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import get_time_taken_pretty [as 别名]
def _generic_index(retrieved_path):
    timer = Timer()
    timer.start()

    api = IndexingAPI(ELASTIC_URL, retrieved_path)
    response = api.bulk_add_documents_in_directory(retrieved_path, INDEX_NAME, DOCUMENT_TYPE).json()
    success = not response['errors']
    num_docs = len(response['items'])
    pretty_response = json.dumps(response, indent=True)
    timer.end()

    return render_template('indexing_result.html',
        duration=timer.get_time_taken_pretty(),
        elastic_response=pretty_response,
        success=success,
        numdocs=num_docs
    )
开发者ID:MJafarMashhadi,项目名称:MiniGoogle,代码行数:19,代码来源:ui.py

示例4: author_cluster_admin

# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import get_time_taken_pretty [as 别名]
def author_cluster_admin():
    timer = Timer()
    timer.start()
    authors = list()
    for file in list_files(AUTHOR_CLUSTER_SOURCE_DIRECTORY, '*.json'):
        with open(os.path.join(AUTHOR_CLUSTER_SOURCE_DIRECTORY, file), 'r') as fp:
            author_data = json.load(fp)
            authors.append(Author(author_data))

    from clustering.authors_cluster import Dendogram
    clusters = Dendogram(authors)
    clusters.cluster()

    min_similarity = 0.375
    cluster_list = list(map(
        lambda cluster: list(map(lambda x: x.name, cluster)),
        map(
            lambda x: list(x.authors),
            clusters.get_clusters(min_similarity)
        )
    ))

    cluster_dict = dict()
    for cluster in cluster_list:
        for author in cluster:
            cluster_dict[author] = cluster

    with open(AUTHOR_CLUSTER_FILE, 'w') as fp:
        json.dump(cluster_dict, fp)

    timer.end()

    return render_template('indexing_result.html',
        duration=timer.get_time_taken_pretty(),
        elastic_response=json.dumps(cluster_list, indent=True),
        success=True,
        numdocs=len(cluster_list)
    )
开发者ID:MJafarMashhadi,项目名称:MiniGoogle,代码行数:40,代码来源:ui.py


注:本文中的timer.Timer.get_time_taken_pretty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。