本文整理汇总了Python中thclient.TreeherderClient.get_repositories方法的典型用法代码示例。如果您正苦于以下问题:Python TreeherderClient.get_repositories方法的具体用法?Python TreeherderClient.get_repositories怎么用?Python TreeherderClient.get_repositories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thclient.TreeherderClient
的用法示例。
在下文中一共展示了TreeherderClient.get_repositories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_repositories
# 需要导入模块: from thclient import TreeherderClient [as 别名]
# 或者: from thclient.TreeherderClient import get_repositories [as 别名]
def query_repositories(clobber=False):
"""
Return dictionary with information about the various repositories.
The data about a repository looks like this:
.. code-block:: python
"ash": {
"repo": "https://hg.mozilla.org/projects/ash",
"graph_branches": ["Ash"],
"repo_type": "hg"
}
"""
global REPOSITORIES
if clobber:
REPOSITORIES = {}
if os.path.exists(REPOSITORIES_FILE):
os.remove(REPOSITORIES_FILE)
if REPOSITORIES:
return REPOSITORIES
if os.path.exists(REPOSITORIES_FILE):
LOG.debug("Loading %s" % REPOSITORIES_FILE)
fd = open(REPOSITORIES_FILE)
REPOSITORIES = json.load(fd)
else:
th_client = TreeherderClient(protocol="https", host=TREEHERDER_URL)
treeherderRepos = th_client.get_repositories()
REPOSITORIES = {}
for th_repo in treeherderRepos:
if th_repo["active_status"] == "active":
repo = {}
repo["repo"] = th_repo["url"]
repo["repo_type"] = th_repo["dvcs_type"]
repo["graph_branches"] = [th_repo["name"].capitalize()]
REPOSITORIES[th_repo["name"]] = repo
with open(REPOSITORIES_FILE, "wb") as fd:
json.dump(REPOSITORIES, fd)
return REPOSITORIES
示例2: query_repositories
# 需要导入模块: from thclient import TreeherderClient [as 别名]
# 或者: from thclient.TreeherderClient import get_repositories [as 别名]
def query_repositories(clear_cache=False):
"""
Return dictionary with information about the various repositories.
The data about a repository looks like this:
.. code-block:: python
"ash": {
"repo": "https://hg.mozilla.org/projects/ash",
"graph_branches": ["Ash"],
"repo_type": "hg"
}
"""
LOG.debug("Query repositories")
global REPOSITORIES
if clear_cache:
REPOSITORIES = {}
if REPOSITORIES:
return REPOSITORIES
th_client = TreeherderClient()
treeherderRepos = th_client.get_repositories()
REPOSITORIES = {}
for th_repo in treeherderRepos:
if th_repo['active_status'] == "active":
REPOSITORIES[th_repo['name']] = {
'repo': th_repo['url'],
'repo_type': th_repo['dvcs_type'],
'graph_branches': [th_repo['name'].capitalize()],
}
return REPOSITORIES