资源简介
depotTools.zip
代码片段和文件信息
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
“““Google OAuth2 related functions.“““
from __future__ import print_function
import collections
import datetime
import functools
import httplib2
import json
import logging
import os
import subprocess2
# This is what most GAE apps require for authentication.
OAUTH_SCOPE_EMAIL = ‘https://www.googleapis.com/auth/userinfo.email‘
# Gerrit and Git on *.googlesource.com require this scope.
OAUTH_SCOPE_GERRIT = ‘https://www.googleapis.com/auth/gerritcodereview‘
# Deprecated. Use OAUTH_SCOPE_EMAIL instead.
OAUTH_SCOPES = OAUTH_SCOPE_EMAIL
# Mockable datetime.datetime.utcnow for testing.
def datetime_now():
return datetime.datetime.utcnow()
# OAuth access token with its expiration time (UTC datetime or None if unknown).
class AccessToken(collections.namedtuple(‘AccessToken‘ [
‘token‘
‘expires_at‘
])):
def needs_refresh(self):
“““True if this AccessToken should be refreshed.“““
if self.expires_at is not None:
# Allow 30s of clock skew between client and backend.
return datetime_now() + datetime.timedelta(seconds=30) >= self.expires_at
# Token without expiration time never expires.
return False
class LoginRequiredError(Exception):
“““Interaction with the user is required to authenticate.“““
def __init__(self scopes=OAUTH_SCOPE_EMAIL):
msg = (
‘You are not logged in. Please login first by running:\n‘
‘ luci-auth login -scopes %s‘ % scopes)
super(LoginRequiredError self).__init__(msg)
def has_luci_context_local_auth():
“““Returns whether LUCI_CONTEXT should be used for ambient authentication.“““
ctx_path = os.environ.get(‘LUCI_CONTEXT‘)
if not ctx_path:
return False
try:
with open(ctx_path) as f:
loaded = json.load(f)
except (OSError IOError ValueError):
return False
return loaded.get(‘local_auth‘ {}).get(‘default_account_id‘) is not None
class Authenticator(object):
“““object that knows how to refresh access tokens when needed.
Args:
scopes: space separated oauth scopes. Defaults to OAUTH_SCOPE_EMAIL.
“““
def __init__(self scopes=OAUTH_SCOPE_EMAIL):
self._access_token = None
self._scopes = scopes
def has_cached_credentials(self):
“““Returns True if credentials can be obtained.
If returns False get_access_token() later will probably ask for interactive
login by raising LoginRequiredError.
If returns True get_access_token() won‘t ask for interactive login.
“““
return bool(self._get_luci_auth_token())
def get_access_token(self):
“““Returns AccessToken refreshing it if necessary.
Raises:
LoginRequiredError if user interaction is required.
“““
if self._access_token and not self._access_token.needs_refresh(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-01-08 17:48 depotTools\
目录 0 2020-01-08 17:48 depotTools\.git\
文件 23 2020-01-08 17:48 depotTools\.git\HEAD
文件 327 2020-01-08 17:48 depotTools\.git\config
文件 73 2020-01-08 17:48 depotTools\.git\desc
目录 0 2020-01-08 17:48 depotTools\.git\hooks\
文件 478 2020-01-08 17:48 depotTools\.git\hooks\applypatch-msg.sample
文件 896 2020-01-08 17:48 depotTools\.git\hooks\commit-msg.sample
文件 3327 2020-01-08 17:48 depotTools\.git\hooks\fsmonitor-watchman.sample
文件 189 2020-01-08 17:48 depotTools\.git\hooks\post-update.sample
文件 424 2020-01-08 17:48 depotTools\.git\hooks\pre-applypatch.sample
文件 1638 2020-01-08 17:48 depotTools\.git\hooks\pre-commit.sample
文件 1348 2020-01-08 17:48 depotTools\.git\hooks\pre-push.sample
文件 4898 2020-01-08 17:48 depotTools\.git\hooks\pre-reba
文件 544 2020-01-08 17:48 depotTools\.git\hooks\pre-receive.sample
文件 1492 2020-01-08 17:48 depotTools\.git\hooks\prepare-commit-msg.sample
文件 3610 2020-01-08 17:48 depotTools\.git\hooks\update.sample
文件 70577 2020-01-08 17:48 depotTools\.git\index
目录 0 2020-01-08 17:48 depotTools\.git\info\
文件 240 2020-01-08 17:48 depotTools\.git\info\exclude
目录 0 2020-01-08 17:48 depotTools\.git\logs\
文件 210 2020-01-08 17:48 depotTools\.git\logs\HEAD
目录 0 2020-01-08 17:48 depotTools\.git\logs\refs\
目录 0 2020-01-08 17:48 depotTools\.git\logs\refs\heads\
文件 210 2020-01-08 17:48 depotTools\.git\logs\refs\heads\master
目录 0 2020-01-08 17:48 depotTools\.git\logs\refs\remotes\
目录 0 2020-01-08 17:48 depotTools\.git\logs\refs\remotes\origin\
文件 210 2020-01-08 17:48 depotTools\.git\logs\refs\remotes\origin\HEAD
目录 0 2020-01-08 17:48 depotTools\.git\ob
目录 0 2020-01-08 17:48 depotTools\.git\ob
目录 0 2020-01-08 17:48 depotTools\.git\ob
............此处省略769个文件信息
- 上一篇:本地以图搜图识图工具
- 下一篇:QtXlsxWriter和ActivePerl
相关资源
- 火车头采集器v7.6企业版永久破解版
- 父与子的编程之旅.zip
- SVID_20180610_225104.zip
- 凸优化——中文影印版.pdf
- zw_-于博士SI設計手記.zip
- 电动汽车动力电池管理系统设计.pdf
- easy-IoT.rar
- 陶哲轩实分析.pdf
- Node.js高级编程中文完整版.zip
- 建筑·室内·景观设计Sketchup2014从入门
- 17-19.rar
- __EstimationwithApplicationstoTrackingandNavig
- AltiumDesigner原理图与PCB设计第2版.pdf
- market.7z
- 最优化导论第4版.pdf.zip
- garbage-classification.zip
- GBT2423电工电子产品基本环境试验规程
- EFI.zip
- UNITYUI设计_14222083.pdf
- 3d_game_programming_with_DirectX11.rar
- BertsekasD.Nonlinearprogramming(2rd).pdf
- 仿金蝶电商ERP进销存系统v8.zip
- ManageEngine_NetFlowAnalyzer_9.0破解版.zip
- 机器人学基础第二版完整版.pdf
- Real-WorldMachineLearning.pdf
- R数据科学.zip
- 线性代数及其应用_第四版.rar
- machinelearning中文版+英文版+课件ppt.r
- 高德地图矢量数据工具.zip
- 凸优化Stephen_Boyd_著,王书宁_译.pdf
评论
共有 条评论