polygon-mcp-server 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- polygon_mcp/server.py +26 -6
- {polygon_mcp_server-0.1.0.dist-info → polygon_mcp_server-0.1.1.dist-info}/METADATA +1 -1
- polygon_mcp_server-0.1.1.dist-info/RECORD +8 -0
- polygon_mcp_server-0.1.0.dist-info/RECORD +0 -8
- {polygon_mcp_server-0.1.0.dist-info → polygon_mcp_server-0.1.1.dist-info}/WHEEL +0 -0
- {polygon_mcp_server-0.1.0.dist-info → polygon_mcp_server-0.1.1.dist-info}/entry_points.txt +0 -0
- {polygon_mcp_server-0.1.0.dist-info → polygon_mcp_server-0.1.1.dist-info}/top_level.txt +0 -0
polygon_mcp/server.py
CHANGED
|
@@ -242,9 +242,14 @@ def _resolve_output_path(path: str) -> str:
|
|
|
242
242
|
return abs_path
|
|
243
243
|
|
|
244
244
|
|
|
245
|
-
def _slice_lines(text: str, start_line: Optional[int], line_count: Optional[int]) -> str:
|
|
245
|
+
def _slice_lines(text: str | bytes, start_line: Optional[int], line_count: Optional[int]) -> str | bytes:
|
|
246
246
|
if start_line is None and line_count is None:
|
|
247
247
|
return text
|
|
248
|
+
if isinstance(text, (bytes, bytearray)):
|
|
249
|
+
try:
|
|
250
|
+
text = text.decode("utf-8")
|
|
251
|
+
except UnicodeDecodeError as exc:
|
|
252
|
+
raise ValueError("Line slicing is supported only for UTF-8 files") from exc
|
|
248
253
|
if start_line is None:
|
|
249
254
|
start_line = 1
|
|
250
255
|
if start_line < 1:
|
|
@@ -753,20 +758,33 @@ def problem_view_solution(
|
|
|
753
758
|
def problem_save_solution(
|
|
754
759
|
problem_id: int,
|
|
755
760
|
name: str,
|
|
756
|
-
source_type: str,
|
|
757
|
-
tag: str,
|
|
761
|
+
source_type: Optional[str] = None,
|
|
762
|
+
tag: Optional[str] = None,
|
|
758
763
|
content: Optional[str] = None,
|
|
759
764
|
content_base64: bool = False,
|
|
760
765
|
local_path: Optional[str] = None,
|
|
761
766
|
check_existing: Optional[bool] = None,
|
|
762
767
|
) -> Any:
|
|
768
|
+
"""Add or edit a solution.
|
|
769
|
+
|
|
770
|
+
For edits, all parameters except problem_id and name are optional.
|
|
771
|
+
|
|
772
|
+
Parameters:
|
|
773
|
+
check_existing: if true, only adding solutions is allowed
|
|
774
|
+
name: solution name
|
|
775
|
+
content/local_path: solution content (file), mutually exclusive
|
|
776
|
+
source_type: source type
|
|
777
|
+
tag: solution tag (MA - Main, OK - Accepted, RJ - Rejected, TL - Time Limit, TO - Time Limit Exceeded or Accepted, WA - Wrong Answer, PE - Presentation Error, ML - Memory Limit, RE - Runtime Error)
|
|
778
|
+
"""
|
|
763
779
|
polygon = _get_client()
|
|
780
|
+
if local_path and content is not None:
|
|
781
|
+
raise ValueError("content and local_path are mutually exclusive")
|
|
764
782
|
if local_path:
|
|
765
783
|
file_value = _read_local_file(local_path)
|
|
766
|
-
|
|
767
|
-
if content is None:
|
|
768
|
-
raise ValueError("content or local_path is required")
|
|
784
|
+
elif content is not None:
|
|
769
785
|
file_value = _decode_content(content, content_base64)
|
|
786
|
+
else:
|
|
787
|
+
file_value = None
|
|
770
788
|
result = _call_polygon(
|
|
771
789
|
polygon.problem_save_solution,
|
|
772
790
|
problem_id,
|
|
@@ -797,6 +815,8 @@ def problem_tests(
|
|
|
797
815
|
If input_line_limit is set, returned test inputs are truncated to the first N lines.
|
|
798
816
|
If examples_only is true, only tests with use_in_statements=true are returned.
|
|
799
817
|
"""
|
|
818
|
+
if no_inputs is not True:
|
|
819
|
+
raise ValueError("problem_tests requires no_inputs=true; use problem_test_input to fetch test input")
|
|
800
820
|
polygon = _get_client()
|
|
801
821
|
result = _call_polygon(polygon.problem_tests, problem_id, testset, no_inputs=no_inputs)
|
|
802
822
|
data = _to_jsonable(result)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
polygon_mcp/__init__.py,sha256=gXvDHD0ZhWT76B3yvx1UcO1LirlOksdxnyROmAY2tJs,70
|
|
2
|
+
polygon_mcp/__main__.py,sha256=9HlMHQ2cj2K9BUr1DoPL4Sxp3p_ekxPHxbTlUOGLa6c,100
|
|
3
|
+
polygon_mcp/server.py,sha256=BFLlj9yJR_D4SiTPdjW3pAnPBBD3ONl1Mdi8xO7sf6Y,34007
|
|
4
|
+
polygon_mcp_server-0.1.1.dist-info/METADATA,sha256=_g748o821bVtZvb-DT1UrKzrCmvteOI_YYu_w4Gio5k,1306
|
|
5
|
+
polygon_mcp_server-0.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
+
polygon_mcp_server-0.1.1.dist-info/entry_points.txt,sha256=5PXQVKSKsYtmZKJXghFlXMHzNrys1hdW-lcjkQmKIW4,58
|
|
7
|
+
polygon_mcp_server-0.1.1.dist-info/top_level.txt,sha256=rh_UcWwNLGw86a3QHkPRLlPyDCeD6-6jHKRoqEdZhTo,12
|
|
8
|
+
polygon_mcp_server-0.1.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
polygon_mcp/__init__.py,sha256=gXvDHD0ZhWT76B3yvx1UcO1LirlOksdxnyROmAY2tJs,70
|
|
2
|
-
polygon_mcp/__main__.py,sha256=9HlMHQ2cj2K9BUr1DoPL4Sxp3p_ekxPHxbTlUOGLa6c,100
|
|
3
|
-
polygon_mcp/server.py,sha256=go5SmqJfcNJ3jraMVTPPpGO0mQNcDUWI6oZ2WCaqwjo,32977
|
|
4
|
-
polygon_mcp_server-0.1.0.dist-info/METADATA,sha256=xoc3Gwpu0EXrXLriUA0RajsZuCkkqkmCNhOzzkM8L3Y,1306
|
|
5
|
-
polygon_mcp_server-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
-
polygon_mcp_server-0.1.0.dist-info/entry_points.txt,sha256=5PXQVKSKsYtmZKJXghFlXMHzNrys1hdW-lcjkQmKIW4,58
|
|
7
|
-
polygon_mcp_server-0.1.0.dist-info/top_level.txt,sha256=rh_UcWwNLGw86a3QHkPRLlPyDCeD6-6jHKRoqEdZhTo,12
|
|
8
|
-
polygon_mcp_server-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|