MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / load_token

Function load_token

tools/commitlist.py:229–241  ·  view source on GitHub ↗
(explicit_token: str | None)

Source from the content-addressed store, hash-verified

227
228
229def load_token(explicit_token: str | None) -> str | None:
230 if explicit_token:
231 return explicit_token
232 for env_name in ('GITHUB_API_TOKEN', 'GITHUB_TOKEN', 'GH_TOKEN'):
233 value = os.getenv(env_name)
234 if value:
235 return value
236 token_file = Path('~/.gh_tokenrc').expanduser()
237 if token_file.exists():
238 match = re.search(r'github_oauth\s*=\s*(\S+)', token_file.read_text())
239 if match:
240 return match.group(1)
241 return None
242
243
244def collect_commits(

Callers 1

mainFunction · 0.85

Calls 3

existsMethod · 0.80
searchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected