docs: clarify Python module responsibilities
Rewrite the module-level descriptions for all 28 Python files and remove the obsolete integration note from grok_register_ttk.py. Verified on Python 3.9 and Python 3.12.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Account result persistence and pending recovery helpers."""
|
"""负责账号结果、pending 恢复以及 grok2api token 池的安全持久化。"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Application configuration loading, normalization, and validation."""
|
"""负责应用配置的默认值、加载保存、规范化和运行前校验。"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Shared HTTP, proxy, and Chromium option helpers."""
|
"""提供共享的 HTTP 请求、代理处理和 Chromium 启动参数。"""
|
||||||
import os
|
import os
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
"""提供 Cloudflare 临时邮箱接口的命令行诊断工具。"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Optional post-registration CPA/OIDC export hook."""
|
"""在注册成功后可选生成 CPA xAI OIDC 凭证并复制到热加载目录。"""
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""导出 CPA xAI OIDC 凭证生成流程的公共接口。"""
|
||||||
|
|
||||||
from .mint import mint_and_export
|
from .mint import mint_and_export
|
||||||
|
|
||||||
__all__ = ["mint_and_export"]
|
__all__ = ["mint_and_export"]
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
"""Approve xAI device-code in Chromium (DrissionPage).
|
"""自动完成 xAI 登录、设备授权确认和相关页面交互。"""
|
||||||
|
|
||||||
Paths resolve relative to the project root.
|
|
||||||
Token polling is the source of truth; browser automation is only used to
|
|
||||||
log in and approve the device authorization page.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"""CPA Chromium session lifecycle, reuse, cleanup, and cookies."""
|
"""管理 CPA 授权浏览器会话、代理、Cookie 注入和资源清理。"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""High-level OIDC mint + export pipeline."""
|
"""协调浏览器授权、OAuth 轮询和 CPA 凭证导出流程。"""
|
||||||
|
|
||||||
from .browser_confirm import mint_with_browser
|
from .browser_confirm import mint_with_browser
|
||||||
from .schema import DEFAULT_BASE_URL, build_cpa_xai_auth
|
from .schema import DEFAULT_BASE_URL, build_cpa_xai_auth
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"""xAI OAuth device-code flow for Build/CLI credentials."""
|
"""实现 OAuth Device Authorization 的发现、启动和 token 轮询。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
"""Proxy helpers for CPA/OIDC export.
|
"""解析认证代理并为 CPA 浏览器提供本地代理桥。"""
|
||||||
|
|
||||||
The OAuth HTTP calls can use ``http://user:pass@host:port`` directly, but
|
|
||||||
Chromium cannot reliably use proxy credentials embedded in --proxy-server.
|
|
||||||
When an authenticated HTTP/HTTPS proxy is configured we start a tiny localhost
|
|
||||||
bridge that injects Proxy-Authorization for Chromium, matching the main
|
|
||||||
registration browser behavior.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Build CLIProxyAPI-compatible xAI OAuth auth payloads."""
|
"""定义并规范化 CPA xAI 凭证文件的数据结构。"""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Atomic write of xAI auth files."""
|
"""将 CPA xAI 凭证安全写入本地 JSON 文件。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""GUI 与 CLI 主入口,并为拆分后的注册模块保留兼容适配。"""
|
||||||
Grok 注册机 - TTK GUI 版本
|
|
||||||
整合 DrissionPage_example.py, openai_register.py, batch_open_nsfw.py
|
|
||||||
"""
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
"""Temporary-mail providers shared by GUI, CLI, and debug tooling."""
|
"""接入临时邮箱服务并负责邮箱创建、邮件轮询和验证码提取。"""
|
||||||
import re
|
import re
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"""Registration browser lifecycle and page automation."""
|
"""管理主注册浏览器生命周期并实现注册页面自动化操作。"""
|
||||||
import gc
|
import gc
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
"""Shared registration workflow used by both GUI and CLI adapters."""
|
"""编排 GUI 与 CLI 共用的单账号注册和批量执行流程。"""
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Callable, Dict, Optional, Tuple
|
from typing import Any, Callable, Dict, Optional, Tuple
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
"""标记测试包并集中承载项目测试模块。"""
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 CPA 浏览器会话的复用、取消、代理和清理行为。"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from cpa_xai import browser_session
|
from cpa_xai import browser_session
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 Cloudflare 临时邮箱 admin 创建和鉴权接口行为。"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 CPA 凭证结构、写入和核心 mint 流程。"""
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 grok2api 远端 token 入池及并发安全回退逻辑。"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证后处理警告、邮件重试、目标锁和常量兼容边界。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证主模块对拆分模块公开函数和运行状态的兼容代理。"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 OAuth Device Authorization 的发现、重试、轮询和错误处理。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证 pending 账号恢复的去重、锁、原子更新和异常处理。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证模块化改造后的配置、浏览器、邮箱和兼容性回归。"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
"""验证共享注册流程的重试、统计、取消、清理和后处理边界。"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from registration_flow import (
|
from registration_flow import (
|
||||||
|
|||||||
Reference in New Issue
Block a user