diff --git a/account_outputs.py b/account_outputs.py index c4bb045..6d883e2 100644 --- a/account_outputs.py +++ b/account_outputs.py @@ -1,4 +1,4 @@ -"""Account result persistence and pending recovery helpers.""" +"""负责账号结果、pending 恢复以及 grok2api token 池的安全持久化。""" import json import os import tempfile diff --git a/app_config.py b/app_config.py index 6cd6dbd..a23fa21 100644 --- a/app_config.py +++ b/app_config.py @@ -1,4 +1,4 @@ -"""Application configuration loading, normalization, and validation.""" +"""负责应用配置的默认值、加载保存、规范化和运行前校验。""" import json import os import tempfile diff --git a/browser_runtime.py b/browser_runtime.py index 98b08ab..60a084f 100644 --- a/browser_runtime.py +++ b/browser_runtime.py @@ -1,4 +1,4 @@ -"""Shared HTTP, proxy, and Chromium option helpers.""" +"""提供共享的 HTTP 请求、代理处理和 Chromium 启动参数。""" import os import urllib.parse diff --git a/cf_mail_debug.py b/cf_mail_debug.py index fe1581d..775e1b4 100755 --- a/cf_mail_debug.py +++ b/cf_mail_debug.py @@ -1,5 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +"""提供 Cloudflare 临时邮箱接口的命令行诊断工具。""" + import argparse import time diff --git a/cpa_export.py b/cpa_export.py index 23fb3e9..4cd8271 100644 --- a/cpa_export.py +++ b/cpa_export.py @@ -1,4 +1,4 @@ -"""Optional post-registration CPA/OIDC export hook.""" +"""在注册成功后可选生成 CPA xAI OIDC 凭证并复制到热加载目录。""" from dataclasses import dataclass import importlib.util import os diff --git a/cpa_xai/__init__.py b/cpa_xai/__init__.py index ceae679..37c57cc 100644 --- a/cpa_xai/__init__.py +++ b/cpa_xai/__init__.py @@ -1,3 +1,5 @@ +"""导出 CPA xAI OIDC 凭证生成流程的公共接口。""" + from .mint import mint_and_export __all__ = ["mint_and_export"] diff --git a/cpa_xai/browser_confirm.py b/cpa_xai/browser_confirm.py index d2c9571..3968704 100644 --- a/cpa_xai/browser_confirm.py +++ b/cpa_xai/browser_confirm.py @@ -1,9 +1,4 @@ -"""Approve xAI device-code in Chromium (DrissionPage). - -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. -""" +"""自动完成 xAI 登录、设备授权确认和相关页面交互。""" from __future__ import annotations diff --git a/cpa_xai/browser_session.py b/cpa_xai/browser_session.py index 71a9bbe..e16cbe4 100644 --- a/cpa_xai/browser_session.py +++ b/cpa_xai/browser_session.py @@ -1,4 +1,4 @@ -"""CPA Chromium session lifecycle, reuse, cleanup, and cookies.""" +"""管理 CPA 授权浏览器会话、代理、Cookie 注入和资源清理。""" from __future__ import annotations import os diff --git a/cpa_xai/mint.py b/cpa_xai/mint.py index c434f07..8bc6303 100644 --- a/cpa_xai/mint.py +++ b/cpa_xai/mint.py @@ -1,4 +1,4 @@ -"""High-level OIDC mint + export pipeline.""" +"""协调浏览器授权、OAuth 轮询和 CPA 凭证导出流程。""" from .browser_confirm import mint_with_browser from .schema import DEFAULT_BASE_URL, build_cpa_xai_auth diff --git a/cpa_xai/oauth_device.py b/cpa_xai/oauth_device.py index 7783786..30aca4b 100644 --- a/cpa_xai/oauth_device.py +++ b/cpa_xai/oauth_device.py @@ -1,4 +1,4 @@ -"""xAI OAuth device-code flow for Build/CLI credentials.""" +"""实现 OAuth Device Authorization 的发现、启动和 token 轮询。""" import json import time diff --git a/cpa_xai/proxyutil.py b/cpa_xai/proxyutil.py index b5d48b7..4506be9 100644 --- a/cpa_xai/proxyutil.py +++ b/cpa_xai/proxyutil.py @@ -1,11 +1,4 @@ -"""Proxy helpers for CPA/OIDC export. - -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. -""" +"""解析认证代理并为 CPA 浏览器提供本地代理桥。""" import base64 import os diff --git a/cpa_xai/schema.py b/cpa_xai/schema.py index 069580c..a810190 100644 --- a/cpa_xai/schema.py +++ b/cpa_xai/schema.py @@ -1,4 +1,4 @@ -"""Build CLIProxyAPI-compatible xAI OAuth auth payloads.""" +"""定义并规范化 CPA xAI 凭证文件的数据结构。""" import base64 import json diff --git a/cpa_xai/writer.py b/cpa_xai/writer.py index 8fd5224..5612186 100644 --- a/cpa_xai/writer.py +++ b/cpa_xai/writer.py @@ -1,4 +1,4 @@ -"""Atomic write of xAI auth files.""" +"""将 CPA xAI 凭证安全写入本地 JSON 文件。""" import json import os diff --git a/grok_register_ttk.py b/grok_register_ttk.py index 2dbf631..c702485 100755 --- a/grok_register_ttk.py +++ b/grok_register_ttk.py @@ -1,9 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -""" -Grok 注册机 - TTK GUI 版本 -整合 DrissionPage_example.py, openai_register.py, batch_open_nsfw.py -""" +"""GUI 与 CLI 主入口,并为拆分后的注册模块保留兼容适配。""" try: import tkinter as tk diff --git a/mail_service.py b/mail_service.py index 0f8fd79..201f94e 100644 --- a/mail_service.py +++ b/mail_service.py @@ -1,4 +1,4 @@ -"""Temporary-mail providers shared by GUI, CLI, and debug tooling.""" +"""接入临时邮箱服务并负责邮箱创建、邮件轮询和验证码提取。""" import re import secrets import string diff --git a/registration_browser.py b/registration_browser.py index 42f62f4..67ed1d1 100644 --- a/registration_browser.py +++ b/registration_browser.py @@ -1,4 +1,4 @@ -"""Registration browser lifecycle and page automation.""" +"""管理主注册浏览器生命周期并实现注册页面自动化操作。""" import gc import random import re diff --git a/registration_flow.py b/registration_flow.py index 822af4f..3800c94 100644 --- a/registration_flow.py +++ b/registration_flow.py @@ -1,4 +1,4 @@ -"""Shared registration workflow used by both GUI and CLI adapters.""" +"""编排 GUI 与 CLI 共用的单账号注册和批量执行流程。""" from dataclasses import dataclass, field from typing import Any, Callable, Dict, Optional, Tuple diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..c440978 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,2 @@ +"""标记测试包并集中承载项目测试模块。""" + diff --git a/tests/test_browser_session.py b/tests/test_browser_session.py index 035045b..cb1a466 100644 --- a/tests/test_browser_session.py +++ b/tests/test_browser_session.py @@ -1,3 +1,5 @@ +"""验证 CPA 浏览器会话的复用、取消、代理和清理行为。""" + import unittest from cpa_xai import browser_session diff --git a/tests/test_cloudflare_admin_api.py b/tests/test_cloudflare_admin_api.py index e99f0c1..bad73ab 100644 --- a/tests/test_cloudflare_admin_api.py +++ b/tests/test_cloudflare_admin_api.py @@ -1,3 +1,5 @@ +"""验证 Cloudflare 临时邮箱 admin 创建和鉴权接口行为。""" + import unittest from unittest.mock import patch diff --git a/tests/test_cpa_core.py b/tests/test_cpa_core.py index d168d65..6165e26 100644 --- a/tests/test_cpa_core.py +++ b/tests/test_cpa_core.py @@ -1,3 +1,5 @@ +"""验证 CPA 凭证结构、写入和核心 mint 流程。""" + import tempfile import unittest from pathlib import Path diff --git a/tests/test_grok2api_remote_pool.py b/tests/test_grok2api_remote_pool.py index b3052b5..054cb9e 100644 --- a/tests/test_grok2api_remote_pool.py +++ b/tests/test_grok2api_remote_pool.py @@ -1,3 +1,5 @@ +"""验证 grok2api 远端 token 入池及并发安全回退逻辑。""" + import sys import types import unittest diff --git a/tests/test_minimal_boundary_regressions.py b/tests/test_minimal_boundary_regressions.py index 1b57689..65015f1 100644 --- a/tests/test_minimal_boundary_regressions.py +++ b/tests/test_minimal_boundary_regressions.py @@ -1,3 +1,5 @@ +"""验证后处理警告、邮件重试、目标锁和常量兼容边界。""" + import json import tempfile import unittest diff --git a/tests/test_module_compatibility.py b/tests/test_module_compatibility.py index b08b1a7..36ce9f7 100644 --- a/tests/test_module_compatibility.py +++ b/tests/test_module_compatibility.py @@ -1,3 +1,5 @@ +"""验证主模块对拆分模块公开函数和运行状态的兼容代理。""" + import unittest from unittest.mock import patch diff --git a/tests/test_oauth_device.py b/tests/test_oauth_device.py index 59a02eb..854e85a 100644 --- a/tests/test_oauth_device.py +++ b/tests/test_oauth_device.py @@ -1,3 +1,5 @@ +"""验证 OAuth Device Authorization 的发现、重试、轮询和错误处理。""" + import json import unittest from unittest.mock import patch diff --git a/tests/test_pending_recovery.py b/tests/test_pending_recovery.py index c00414f..0e77fb1 100644 --- a/tests/test_pending_recovery.py +++ b/tests/test_pending_recovery.py @@ -1,3 +1,5 @@ +"""验证 pending 账号恢复的去重、锁、原子更新和异常处理。""" + import json import os import tempfile diff --git a/tests/test_post_modularization_regressions.py b/tests/test_post_modularization_regressions.py index ff8e6e9..7e62dd8 100644 --- a/tests/test_post_modularization_regressions.py +++ b/tests/test_post_modularization_regressions.py @@ -1,3 +1,5 @@ +"""验证模块化改造后的配置、浏览器、邮箱和兼容性回归。""" + import json import tempfile import unittest diff --git a/tests/test_registration_flow.py b/tests/test_registration_flow.py index 3e804dd..0f0a711 100644 --- a/tests/test_registration_flow.py +++ b/tests/test_registration_flow.py @@ -1,3 +1,5 @@ +"""验证共享注册流程的重试、统计、取消、清理和后处理边界。""" + import unittest from registration_flow import (