pull-requests-san 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pull_requests_san-0.1.0/LICENSE +21 -0
- pull_requests_san-0.1.0/MANIFEST.in +3 -0
- pull_requests_san-0.1.0/PKG-INFO +72 -0
- pull_requests_san-0.1.0/README.md +45 -0
- pull_requests_san-0.1.0/pull_requests_san/__init__.py +69 -0
- pull_requests_san-0.1.0/pull_requests_san/__main__.py +6 -0
- pull_requests_san-0.1.0/pull_requests_san/auth.py +179 -0
- pull_requests_san-0.1.0/pull_requests_san/client.py +1330 -0
- pull_requests_san-0.1.0/pull_requests_san/diff.py +1150 -0
- pull_requests_san-0.1.0/pull_requests_san/models.py +332 -0
- pull_requests_san-0.1.0/pull_requests_san/pr_review.py +72 -0
- pull_requests_san-0.1.0/pull_requests_san/pr_review_gui.py +611 -0
- pull_requests_san-0.1.0/pull_requests_san/session.py +471 -0
- pull_requests_san-0.1.0/pull_requests_san/templates/pr_review.html +2769 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/PKG-INFO +72 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/SOURCES.txt +20 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/dependency_links.txt +1 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/entry_points.txt +2 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/requires.txt +4 -0
- pull_requests_san-0.1.0/pull_requests_san.egg-info/top_level.txt +1 -0
- pull_requests_san-0.1.0/pyproject.toml +43 -0
- pull_requests_san-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sanskrit Coders
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pull_requests_san
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Single-pane word-flow and character-level GitHub PR review tool for Sanskrit & Indic repositories
|
|
5
|
+
Author-email: Sanskrit Coders <sanskrit-programmers@googlegroups.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sanskrit-coders/diff_san
|
|
8
|
+
Project-URL: Repository, https://github.com/sanskrit-coders/diff_san
|
|
9
|
+
Keywords: sanskrit,github,pull-request,diff,devanagari,vedic,proofreading
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: fastapi>=0.100
|
|
23
|
+
Requires-Dist: regex>=2023.0.0
|
|
24
|
+
Requires-Dist: requests>=2.28
|
|
25
|
+
Requires-Dist: uvicorn>=0.23
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# pull_requests_san
|
|
29
|
+
|
|
30
|
+
Single-pane word-flow and character/grapheme-level GitHub Pull Request reviewer tailored for Sanskrit and Indic repositories (`vishvAsa` by default, or any `--owner` / `--repo`).
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install pull_requests_san
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Review all open PRs in vishvAsa repos (or specify any GitHub user/org)
|
|
42
|
+
pull_requests_san --owner vishvAsa --state open
|
|
43
|
+
|
|
44
|
+
# Review a specific repo or use module invocation
|
|
45
|
+
python -m pull_requests_san --owner vishvAsa --repo mahAbhAratam
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
GitHub authentication is auto-resolved in order from `--token`, `GITHUB_TOKEN`/`GH_TOKEN`, `~/.config/gh/hosts.yml`, `gh auth token`, or optional `tokens.toml` (`curation_utils.creds` / TOML fallback).
|
|
49
|
+
|
|
50
|
+
## Key Features
|
|
51
|
+
|
|
52
|
+
- **Single-pane word-flow diff** (default) matching changed space-separated strings inline without requiring strict line-by-line alignment (`Alt+S` toggles 2-pane LHS/RHS) and highlighting intra-word character differences cleanly.
|
|
53
|
+
- **Vedic grapheme & codepoint modes** keeping trailing Vedic svaras (including `U+1CD3` `᳓`) attached to their akṣara.
|
|
54
|
+
- **Unicode normalization (`NFC`/`NFD`/`NFKC`) & `Ignore punct`** (`।`, `॥`, quotes, commas) adapted from `bhashika-org-in/wordiff`.
|
|
55
|
+
- **Full GitHub review & PR management**: inline line/range comments, thread replies, draft review batching, approve / request changes, resolve threads, mergeability & 3-way conflict inspection, open PR in main browser (`Alt+B`), merge PR (`Alt+Shift+M`), close/reopen PR (`Alt+Shift+C`).
|
|
56
|
+
|
|
57
|
+
## Screenshots
|
|
58
|
+
|
|
59
|
+
### Single-Pane Word-Flow Diff (Default)
|
|
60
|
+
Matches changed space-separated strings inline across reflowed paragraphs and line breaks cleanly, with Vedic/Devanagari font sizing (`Adishila SanVedic`, 26px) and inline Sanskrit review threads:
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
### PR Controls, Mergeability & Review Submission
|
|
65
|
+
Browse all open PRs across an organization or repo, inspect mergeability status, open PRs in your main browser, approve/request changes, close, or merge:
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+
### 2-Pane Vedic Grapheme Diff & 3-Way Conflict Inspection
|
|
70
|
+
Toggle `Alt+S` for 2-pane LHS/RHS mode and `Char (Grapheme \X)` to keep Vedic accent marks (`U+1CD3` `᳓`, etc.) attached to their akṣara, plus inspect 3-way overlapping merge conflicts before resolving or rebasing:
|
|
71
|
+
|
|
72
|
+

|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# pull_requests_san
|
|
2
|
+
|
|
3
|
+
Single-pane word-flow and character/grapheme-level GitHub Pull Request reviewer tailored for Sanskrit and Indic repositories (`vishvAsa` by default, or any `--owner` / `--repo`).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install pull_requests_san
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Review all open PRs in vishvAsa repos (or specify any GitHub user/org)
|
|
15
|
+
pull_requests_san --owner vishvAsa --state open
|
|
16
|
+
|
|
17
|
+
# Review a specific repo or use module invocation
|
|
18
|
+
python -m pull_requests_san --owner vishvAsa --repo mahAbhAratam
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
GitHub authentication is auto-resolved in order from `--token`, `GITHUB_TOKEN`/`GH_TOKEN`, `~/.config/gh/hosts.yml`, `gh auth token`, or optional `tokens.toml` (`curation_utils.creds` / TOML fallback).
|
|
22
|
+
|
|
23
|
+
## Key Features
|
|
24
|
+
|
|
25
|
+
- **Single-pane word-flow diff** (default) matching changed space-separated strings inline without requiring strict line-by-line alignment (`Alt+S` toggles 2-pane LHS/RHS) and highlighting intra-word character differences cleanly.
|
|
26
|
+
- **Vedic grapheme & codepoint modes** keeping trailing Vedic svaras (including `U+1CD3` `᳓`) attached to their akṣara.
|
|
27
|
+
- **Unicode normalization (`NFC`/`NFD`/`NFKC`) & `Ignore punct`** (`।`, `॥`, quotes, commas) adapted from `bhashika-org-in/wordiff`.
|
|
28
|
+
- **Full GitHub review & PR management**: inline line/range comments, thread replies, draft review batching, approve / request changes, resolve threads, mergeability & 3-way conflict inspection, open PR in main browser (`Alt+B`), merge PR (`Alt+Shift+M`), close/reopen PR (`Alt+Shift+C`).
|
|
29
|
+
|
|
30
|
+
## Screenshots
|
|
31
|
+
|
|
32
|
+
### Single-Pane Word-Flow Diff (Default)
|
|
33
|
+
Matches changed space-separated strings inline across reflowed paragraphs and line breaks cleanly, with Vedic/Devanagari font sizing (`Adishila SanVedic`, 26px) and inline Sanskrit review threads:
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
### PR Controls, Mergeability & Review Submission
|
|
38
|
+
Browse all open PRs across an organization or repo, inspect mergeability status, open PRs in your main browser, approve/request changes, close, or merge:
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
### 2-Pane Vedic Grapheme Diff & 3-Way Conflict Inspection
|
|
43
|
+
Toggle `Alt+S` for 2-pane LHS/RHS mode and `Char (Grapheme \X)` to keep Vedic accent marks (`U+1CD3` `᳓`, etc.) attached to their akṣara, plus inspect 3-way overlapping merge conflicts before resolving or rebasing:
|
|
44
|
+
|
|
45
|
+

|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Sanskrit/Indic GitHub pull-request single-pane word-flow and character-level reviewer."""
|
|
2
|
+
|
|
3
|
+
from pull_requests_san.pr_review import (
|
|
4
|
+
AlignedDiffRow,
|
|
5
|
+
DEFAULT_API_BASE,
|
|
6
|
+
DEFAULT_LOCAL_ORG_DIR,
|
|
7
|
+
DEFAULT_OWNER,
|
|
8
|
+
DiffHunk,
|
|
9
|
+
GitHubAPIError,
|
|
10
|
+
GitHubClient,
|
|
11
|
+
PRReviewSession,
|
|
12
|
+
PullRequestCommit,
|
|
13
|
+
PullRequestDetail,
|
|
14
|
+
PullRequestFileDiff,
|
|
15
|
+
PullRequestSummary,
|
|
16
|
+
ReviewComment,
|
|
17
|
+
ReviewThread,
|
|
18
|
+
VALID_DIFF_MODES,
|
|
19
|
+
VALID_MERGE_METHODS,
|
|
20
|
+
VALID_NORMALIZATIONS,
|
|
21
|
+
VALID_REVIEW_EVENTS,
|
|
22
|
+
apply_normalization,
|
|
23
|
+
build_full_file_hunk,
|
|
24
|
+
build_inline_flow_rows,
|
|
25
|
+
build_unified_patch_from_texts,
|
|
26
|
+
compute_char_diff,
|
|
27
|
+
compute_stream_diff,
|
|
28
|
+
extract_three_way_conflicts,
|
|
29
|
+
normalize_owner,
|
|
30
|
+
parse_full_diff_by_file,
|
|
31
|
+
parse_patch_hunks,
|
|
32
|
+
resolve_github_token,
|
|
33
|
+
strip_punctuation,
|
|
34
|
+
tokenize_for_diff,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"AlignedDiffRow",
|
|
39
|
+
"DEFAULT_API_BASE",
|
|
40
|
+
"DEFAULT_LOCAL_ORG_DIR",
|
|
41
|
+
"DEFAULT_OWNER",
|
|
42
|
+
"DiffHunk",
|
|
43
|
+
"GitHubAPIError",
|
|
44
|
+
"GitHubClient",
|
|
45
|
+
"PRReviewSession",
|
|
46
|
+
"PullRequestCommit",
|
|
47
|
+
"PullRequestDetail",
|
|
48
|
+
"PullRequestFileDiff",
|
|
49
|
+
"PullRequestSummary",
|
|
50
|
+
"ReviewComment",
|
|
51
|
+
"ReviewThread",
|
|
52
|
+
"VALID_DIFF_MODES",
|
|
53
|
+
"VALID_MERGE_METHODS",
|
|
54
|
+
"VALID_NORMALIZATIONS",
|
|
55
|
+
"VALID_REVIEW_EVENTS",
|
|
56
|
+
"apply_normalization",
|
|
57
|
+
"build_full_file_hunk",
|
|
58
|
+
"build_inline_flow_rows",
|
|
59
|
+
"build_unified_patch_from_texts",
|
|
60
|
+
"compute_char_diff",
|
|
61
|
+
"compute_stream_diff",
|
|
62
|
+
"extract_three_way_conflicts",
|
|
63
|
+
"normalize_owner",
|
|
64
|
+
"parse_full_diff_by_file",
|
|
65
|
+
"parse_patch_hunks",
|
|
66
|
+
"resolve_github_token",
|
|
67
|
+
"strip_punctuation",
|
|
68
|
+
"tokenize_for_diff",
|
|
69
|
+
]
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""GitHub owner normalization and API token resolution helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import inspect
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import re
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import tomllib
|
|
14
|
+
except ImportError: # Python 3.10 fallback
|
|
15
|
+
try:
|
|
16
|
+
import tomli as tomllib # type: ignore[no-redef]
|
|
17
|
+
except ImportError:
|
|
18
|
+
tomllib = None # type: ignore[assignment]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
DEFAULT_OWNER = "vishvAsa"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _default_tokens_toml_path() -> Path | None:
|
|
25
|
+
try:
|
|
26
|
+
from curation_utils import creds
|
|
27
|
+
|
|
28
|
+
default_path = inspect.signature(creds.get_toml_value).parameters["path"].default
|
|
29
|
+
return Path(default_path) if default_path else None
|
|
30
|
+
except Exception:
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def normalize_owner(owner: str) -> str:
|
|
35
|
+
"""Normalize an owner string or GitHub org URL (e.g. ``https://github.com/vishvAsa/``) to its login."""
|
|
36
|
+
raw = (owner or "").strip()
|
|
37
|
+
if not raw:
|
|
38
|
+
return DEFAULT_OWNER
|
|
39
|
+
m = re.match(r"^https?://(?:www\.)?github\.com/([^/?#]+)", raw, re.IGNORECASE)
|
|
40
|
+
if m:
|
|
41
|
+
return m.group(1).strip()
|
|
42
|
+
return raw.strip("/").split("/")[0]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _read_gh_hosts_token(hosts_path: str | Path | None = None) -> str | None:
|
|
46
|
+
path = Path(hosts_path or os.path.expanduser("~/.config/gh/hosts.yml"))
|
|
47
|
+
if not path.is_file():
|
|
48
|
+
return None
|
|
49
|
+
try:
|
|
50
|
+
text = path.read_text(encoding="utf-8")
|
|
51
|
+
except OSError:
|
|
52
|
+
return None
|
|
53
|
+
try:
|
|
54
|
+
import yaml # type: ignore
|
|
55
|
+
|
|
56
|
+
data = yaml.safe_load(text) or {}
|
|
57
|
+
if isinstance(data, dict):
|
|
58
|
+
gh_entry = data.get("github.com")
|
|
59
|
+
if isinstance(gh_entry, dict):
|
|
60
|
+
tok = gh_entry.get("oauth_token")
|
|
61
|
+
if isinstance(tok, str) and tok.strip():
|
|
62
|
+
return tok.strip()
|
|
63
|
+
except Exception:
|
|
64
|
+
pass
|
|
65
|
+
in_github = False
|
|
66
|
+
for line in text.splitlines():
|
|
67
|
+
if not line.strip() or line.lstrip().startswith("#"):
|
|
68
|
+
continue
|
|
69
|
+
if not line.startswith(" "):
|
|
70
|
+
in_github = line.strip().startswith("github.com:")
|
|
71
|
+
continue
|
|
72
|
+
if in_github:
|
|
73
|
+
m = re.match(r"^\s+oauth_token:\s*(.+?)\s*$", line)
|
|
74
|
+
if m:
|
|
75
|
+
val = m.group(1).strip().strip("'\"")
|
|
76
|
+
if val:
|
|
77
|
+
return val
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _read_simple_github_toml(toml_path: Path) -> str | None:
|
|
82
|
+
"""Minimal TOML reader for ``[github]`` tokens when tomllib/tomli is unavailable (Python 3.10)."""
|
|
83
|
+
try:
|
|
84
|
+
text = toml_path.read_text(encoding="utf-8")
|
|
85
|
+
except OSError:
|
|
86
|
+
return None
|
|
87
|
+
if tomllib is not None:
|
|
88
|
+
try:
|
|
89
|
+
data = tomllib.loads(text)
|
|
90
|
+
gh = data.get("github")
|
|
91
|
+
if isinstance(gh, dict):
|
|
92
|
+
for k in ("general_kv", "checkin"):
|
|
93
|
+
val = gh.get(k)
|
|
94
|
+
if isinstance(val, dict):
|
|
95
|
+
val = val.get("key") or val.get("token")
|
|
96
|
+
if isinstance(val, str) and val.strip():
|
|
97
|
+
return val.strip()
|
|
98
|
+
except Exception:
|
|
99
|
+
pass
|
|
100
|
+
return None
|
|
101
|
+
section = ""
|
|
102
|
+
found: dict[str, str] = {}
|
|
103
|
+
for raw_line in text.splitlines():
|
|
104
|
+
line = raw_line.split("#", 1)[0].strip()
|
|
105
|
+
if not line:
|
|
106
|
+
continue
|
|
107
|
+
if line.startswith("[") and line.endswith("]"):
|
|
108
|
+
section = line[1:-1].strip()
|
|
109
|
+
continue
|
|
110
|
+
if section == "github" and "=" in line:
|
|
111
|
+
k, v = line.split("=", 1)
|
|
112
|
+
key = k.strip()
|
|
113
|
+
val = v.strip().strip("'\"")
|
|
114
|
+
if key in ("general_kv", "checkin") and val:
|
|
115
|
+
found[key] = val
|
|
116
|
+
elif section in ("github.general_kv", "github.checkin") and "=" in line:
|
|
117
|
+
k, v = line.split("=", 1)
|
|
118
|
+
if k.strip() in ("key", "token"):
|
|
119
|
+
val = v.strip().strip("'\"")
|
|
120
|
+
if val:
|
|
121
|
+
found.setdefault(section.split(".", 1)[1], val)
|
|
122
|
+
for k in ("general_kv", "checkin"):
|
|
123
|
+
if found.get(k):
|
|
124
|
+
return found[k]
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def resolve_github_token(
|
|
129
|
+
token: str | None = None,
|
|
130
|
+
*,
|
|
131
|
+
cred_path: str | Path | None = None,
|
|
132
|
+
allow_gh_cli: bool = True,
|
|
133
|
+
) -> str | None:
|
|
134
|
+
"""Resolve a GitHub API token.
|
|
135
|
+
|
|
136
|
+
When ``token`` is explicitly provided as ``""`` (empty string), returns ``None``
|
|
137
|
+
to allow opting out of ambient credentials (e.g. in tests). When ``token is None``,
|
|
138
|
+
checks env vars, gh CLI config, ``gh auth token``, and ``curation_utils.creds``.
|
|
139
|
+
"""
|
|
140
|
+
if token is not None:
|
|
141
|
+
return token.strip() or None
|
|
142
|
+
for env_name in ("GITHUB_TOKEN", "GH_TOKEN"):
|
|
143
|
+
val = os.environ.get(env_name)
|
|
144
|
+
if val and val.strip():
|
|
145
|
+
return val.strip()
|
|
146
|
+
hosts_tok = _read_gh_hosts_token()
|
|
147
|
+
if hosts_tok:
|
|
148
|
+
return hosts_tok
|
|
149
|
+
if allow_gh_cli and shutil.which("gh"):
|
|
150
|
+
try:
|
|
151
|
+
out = subprocess.check_output(
|
|
152
|
+
["gh", "auth", "token"],
|
|
153
|
+
stderr=subprocess.DEVNULL,
|
|
154
|
+
text=True,
|
|
155
|
+
timeout=5,
|
|
156
|
+
).strip()
|
|
157
|
+
if out:
|
|
158
|
+
return out
|
|
159
|
+
except (subprocess.SubprocessError, OSError):
|
|
160
|
+
pass
|
|
161
|
+
try:
|
|
162
|
+
from curation_utils import creds
|
|
163
|
+
|
|
164
|
+
toml_path = Path(cred_path) if cred_path else _default_tokens_toml_path()
|
|
165
|
+
if toml_path and toml_path.is_file():
|
|
166
|
+
for key in ("github.general_kv", "github.checkin"):
|
|
167
|
+
val = creds.get_toml_value(key=key, path=toml_path)
|
|
168
|
+
if isinstance(val, dict):
|
|
169
|
+
val = val.get("key") or val.get("token")
|
|
170
|
+
if isinstance(val, str) and val.strip():
|
|
171
|
+
return val.strip()
|
|
172
|
+
except Exception:
|
|
173
|
+
pass
|
|
174
|
+
toml_path = Path(cred_path) if cred_path else Path(os.path.expanduser("~/.config/curation_utils/tokens.toml"))
|
|
175
|
+
if toml_path.is_file():
|
|
176
|
+
tok = _read_simple_github_toml(toml_path)
|
|
177
|
+
if tok:
|
|
178
|
+
return tok
|
|
179
|
+
return None
|