diff --git a/tools/__init__.py b/tools/__init__.py index cf8041c..fd42c11 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -1,5 +1,5 @@ from .parse_markdown import parse_markdown -from .scan_doc_dir import * +from .doc import * from .json_example import generate_example_json from .model import * -from .socket import * \ No newline at end of file +from .port import * \ No newline at end of file diff --git a/tools/scan_doc_dir.py b/tools/document.py similarity index 100% rename from tools/scan_doc_dir.py rename to tools/document.py diff --git a/tools/socket.py b/tools/port.py similarity index 68% rename from tools/socket.py rename to tools/port.py index 91199a9..e50952a 100644 --- a/tools/socket.py +++ b/tools/port.py @@ -7,4 +7,9 @@ def find_available_port(start_port): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: if s.connect_ex(('localhost', port)) != 0: # 端口未被占用 return port - port += 1 # 如果端口被占用,尝试下一个端口 \ No newline at end of file + port += 1 # 如果端口被占用,尝试下一个端口 + +if __name__ == "__main__": + start_port = 6006 # 起始端口号 + available_port = find_available_port(start_port) + print(f"Available port: {available_port}") \ No newline at end of file