🔧 修复P0级问题:40+文件语法错误 + import路径 + 清理废弃代码
✨ 跟项目能跑起来就差这一步!这次狠狠修了一波: 🩺 修复40+损坏Python文件 - 补全所有缺少的class定义头(plugin-loader-pro、code-reviewer、 http-api/ws-api/http-tcp、webui/dashboard/log-terminal 等) - 修复中文括号、字符串未闭合、缩进错乱等语法问题 🔗 创建符号链接 plugin_bridge -> plugin-bridge - 解决Python模块路径不支持连字符的问题 - 关联修复 plugin-bridge 中错误的 import 路径 🧹 清理废弃代码 - 删除 oss/tui/ 目录(已废弃) - 清理所有 __pycache__ 和 .pyc 缓存文件 ✅ 全量语法检查通过,零错误! 📋 ai.md 新增代码审计报告和分阶段修复计划 🗺️ 所有插件 use() 调用现在走统一路径
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
class BaseRoute:
|
||||
|
||||
__slots__ = ('method', 'path', 'handler', '_pattern_parts')
|
||||
|
||||
def __init__(self, method: str, path: str, handler: Callable):
|
||||
@@ -66,7 +68,8 @@ def extract_path_params(pattern: str, path: str) -> dict[str, str]:
|
||||
|
||||
for i, p in enumerate(parts_to_process):
|
||||
if i < len(path_parts) and p.startswith(":"):
|
||||
param_name = p[1:] params[param_name] = path_parts[i]
|
||||
param_name = p[1:]
|
||||
params[param_name] = path_parts[i]
|
||||
|
||||
if use_wildcard:
|
||||
param_name = last_pattern[1:]
|
||||
@@ -88,13 +91,9 @@ class BaseRouter:
|
||||
self.add("PUT", path, handler)
|
||||
|
||||
def delete(self, path: str, handler: Callable):
|
||||
|
||||
Args:
|
||||
method: HTTP 方法
|
||||
path: 请求路径
|
||||
|
||||
Returns:
|
||||
(路由,路径参数) 或 None
|
||||
self.add("DELETE", path, handler)
|
||||
|
||||
def match(self, method: str, path: str):
|
||||
for route in self.routes:
|
||||
if route.method == method and match_path(route.path, path):
|
||||
params = extract_path_params(route.path, path)
|
||||
|
||||
Reference in New Issue
Block a user