mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
feat: remove redundant project attribution comments from GNS3-Copilot modules
Removed repetitive "This module is part of the GNS3-Copilot project" and GitHub URL comments from multiple module docstrings. These comments were redundant since the project information is already established in the main package documentation. This cleanup improves code readability and reduces maintenance overhead by eliminating duplicate attribution statements across the codebase.
This commit is contained in:
1 parent
d12b2df306
commit
2779734de4
32 files changed
-166
No files matched your search
@@ -21,8 +21,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
GNS3-Copilot Public Model Package
|
||||
|
||||
This package provides reusable public models and utilities for GNS3 network automation tasks.
|
||||
@@ -55,7 +53,6 @@ __author__ = "Guobin Yue"
|
||||
__description__ = "AI-powered network automation assistant for GNS3"
|
||||
__url__ = "https://github.com/yueguobin/gns3-copilot"
|
||||
|
||||
|
||||
# Export main utility functions
|
||||
__all__ = [
|
||||
"get_device_ports_from_topology",
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
Public module for getting device port information from GNS3 topology
|
||||
"""
|
||||
|
||||
@@ -31,7 +29,6 @@ from typing import Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_device_ports_from_topology(
|
||||
device_names: list[str],
|
||||
project_id: str | None = None,
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
Drawing utility functions for GNS3 area annotations.
|
||||
|
||||
Calculates drawing parameters and generates SVG content for network area annotations.
|
||||
@@ -102,7 +100,6 @@ COLOR_SCHEMES = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def calculate_two_node_shape(
|
||||
node1: dict,
|
||||
node2: dict,
|
||||
@@ -241,7 +238,6 @@ def calculate_two_node_shape(
|
||||
"metadata": metadata,
|
||||
}
|
||||
|
||||
|
||||
def generate_ellipse_svg(
|
||||
rx: int,
|
||||
ry: int,
|
||||
@@ -252,7 +248,6 @@ def generate_ellipse_svg(
|
||||
"""Generate SVG for ellipse."""
|
||||
return f'''<svg width="{svg_width}" height="{svg_height}"><ellipse cx="{rx}" cy="{ry}" rx="{rx}" ry="{ry}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>'''
|
||||
|
||||
|
||||
def generate_rectangle_svg(
|
||||
width: int,
|
||||
height: int,
|
||||
@@ -261,7 +256,6 @@ def generate_rectangle_svg(
|
||||
"""Generate SVG for rectangle."""
|
||||
return f'''<svg width="{width}" height="{height}"><rect x="0" y="0" width="{width}" height="{height}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>'''
|
||||
|
||||
|
||||
def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str:
|
||||
"""Generate SVG for text label."""
|
||||
text_width = len(text) * 8 + 20
|
||||
@@ -269,7 +263,6 @@ def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str:
|
||||
|
||||
return f'''<svg width="{text_width}" height="{text_height}"><text font-family="TypeWriter" font-size="{DEFAULT_FONT_SIZE}.0" font-weight="bold" fill="{color_scheme["stroke"]}" text-anchor="middle" x="{text_width / 2}" y="{text_height / 2 + 4}">{text}</text></svg>'''
|
||||
|
||||
|
||||
def _hsv_to_hex(h: int, s: int, v: int) -> str:
|
||||
"""Convert HSV to HEX color."""
|
||||
h_norm = (h % 360) / 360
|
||||
@@ -303,7 +296,6 @@ def _hsv_to_hex(h: int, s: int, v: int) -> str:
|
||||
|
||||
return f"#{r:02x}{g:02x}{b:02x}"
|
||||
|
||||
|
||||
def calculate_z_order(area_size: float) -> int:
|
||||
"""
|
||||
Calculate z-order based on area size for proper layering.
|
||||
@@ -321,7 +313,6 @@ def calculate_z_order(area_size: float) -> int:
|
||||
else:
|
||||
return 3
|
||||
|
||||
|
||||
def _get_color_scheme(area_name: str) -> dict[str, Any]:
|
||||
"""
|
||||
Get color scheme based on area name using keyword inference.
|
||||
@@ -410,7 +401,6 @@ def _get_color_scheme(area_name: str) -> dict[str, Any]:
|
||||
|
||||
return COLOR_SCHEMES["DEFAULT"]
|
||||
|
||||
|
||||
def calculate_two_node_ellipse(
|
||||
node1: dict,
|
||||
node2: dict,
|
||||
@@ -431,7 +421,6 @@ def calculate_two_node_ellipse(
|
||||
"metadata": result["metadata"],
|
||||
}
|
||||
|
||||
|
||||
def calculate_two_node_rectangle(
|
||||
node1: dict,
|
||||
node2: dict,
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
LLM Model Configuration Helper for GNS3 Copilot
|
||||
|
||||
This module provides utility functions to retrieve LLM model configurations
|
||||
@@ -47,7 +45,6 @@ from fastapi import FastAPI
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def get_user_llm_config_with_app(
|
||||
user_id: UUID,
|
||||
app: FastAPI
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
Message format converters for OpenAI-compatible message format.
|
||||
Converts between LangChain messages and OpenAI-compatible format.
|
||||
"""
|
||||
@@ -27,7 +25,6 @@ import uuid
|
||||
from datetime import datetime
|
||||
from typing import Dict, Any
|
||||
|
||||
|
||||
def _ensure_string(content: Any) -> str:
|
||||
"""Ensure content is a string, converting dicts/lists to JSON if needed."""
|
||||
if isinstance(content, str):
|
||||
@@ -37,7 +34,6 @@ def _ensure_string(content: Any) -> str:
|
||||
else:
|
||||
return str(content)
|
||||
|
||||
|
||||
def convert_langchain_to_openai(lc_message) -> Dict[str, Any]:
|
||||
"""
|
||||
Convert LangChain message to OpenAI-compatible format.
|
||||
@@ -126,7 +122,6 @@ def convert_langchain_to_openai(lc_message) -> Dict[str, Any]:
|
||||
"content": str(lc_message)
|
||||
}
|
||||
|
||||
|
||||
def convert_openai_to_langchain(msg: Dict[str, Any]):
|
||||
"""
|
||||
Convert OpenAI-compatible format to LangChain message.
|
||||
@@ -175,7 +170,6 @@ def convert_openai_to_langchain(msg: Dict[str, Any]):
|
||||
# Fallback to HumanMessage for unknown roles
|
||||
return HumanMessage(content=content)
|
||||
|
||||
|
||||
def convert_stream_event_to_openai(event: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
Convert LangGraph streaming event to OpenAI-compatible format.
|
||||
|
||||
@@ -60,9 +60,6 @@ Standard Tool Response Format:
|
||||
Author: Guobin Yue
|
||||
"""
|
||||
|
||||
This module is part of the GNS3-Copilot project.
|
||||
GitHub: https://github.com/yueguobin/gns3-copilot
|
||||
|
||||
import ast
|
||||
import json
|
||||
import logging
|
||||
@@ -70,7 +67,6 @@ from typing import Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def parse_tool_content(
|
||||
content: str | dict | list | int | float | bool | None,
|
||||
fallback_to_raw: bool = True,
|
||||
@@ -227,7 +223,6 @@ def parse_tool_content(
|
||||
logger.info("Returning error: %s", result)
|
||||
return result
|
||||
|
||||
|
||||
def format_tool_response(
|
||||
content: str | dict | list | int | float | bool | None, indent: int = 2
|
||||
) -> str:
|
||||
@@ -277,7 +272,6 @@ def format_tool_response(
|
||||
logger.info("format_tool_response returning error: %s", result)
|
||||
return result
|
||||
|
||||
|
||||
def normalize_tool_response(
|
||||
response: dict | list | str,
|
||||
tool_name: str = "unknown"
|
||||
@@ -456,7 +450,6 @@ def normalize_tool_response(
|
||||
"metadata": metadata
|
||||
}
|
||||
|
||||
|
||||
# Test function to verify the implementation
|
||||
def _test_parse_tool_content() -> None:
|
||||
"""Test function to verify parse_tool_content works correctly with all input types"""
|
||||
@@ -515,6 +508,5 @@ def _test_parse_tool_content() -> None:
|
||||
valid = "✗"
|
||||
print(f"Format Test {i + 1}: {valid} Input: {repr(input_data)} -> {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_test_parse_tool_content()
|
||||
Reference in new issue
Block a user