swanlab 0.10.6
Assigns Discord webhook URL in PythonApplies wraps to nested Python function
SHA-2567f46c418fd6c233ae1b8a8c91d66145267e3a870a15a613fe18647cd4f4e2b3e
Evidence
1from typing import Any, Dict, Optional
2
3import requests
4
5from swanlab.plugin.notification.base import NotificationCallback
6from swanlab.sdk.internal.pkg import console, safe
7
8
9class DiscordCallback(NotificationCallback):
10 """Discord notification callback.
11
12 Usage::
13
14 from swanlab.plugin import DiscordCallback
15
16 swanlab.init(
17 callbacks=[DiscordCallback(webhook_url="https://discord.com/api/webhooks/...")]
18 )
19 """
⋯4 lines
24
25 def _send_notification(self, state: str, error: Optional[str]) -> None:
26 with safe.block(requests.RequestException, message="❌ DiscordBot sending failed"):
27 content = self._build_content(state, error)
28 payload: Dict[str, Any] = {"content": content}
29 resp = requests.post(self._webhook_url, json=payload, timeout=10)
30 resp.raise_for_status()
31 if resp.status_code not in (200, 204):
32 console.warning(f"❌ DiscordBot sending failed: {resp.text}")
33 return
34 console.info("✅ DiscordBot notification sent successfully")
9:155… [email protected]>, Feudalman <[email protected]>
10License-Expression: Apache-2.0
11License-File: LICENSE
12Keywords: machine learning,reproducibility,visualization
13Classifier: Development Status :: 3 - Alpha
14Classifier: License :: OSI …
21:39… thon :: 3.12
22Classifier: Programming Language :: Python :: 3.13
23Classifier: Programming Language :: Python :: 3.14
24Classifier: Topic :: Scientific/Engineering
25Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
26Classifier: Topic :: Scientific/Engineering :: Visualization
27Requires-Python: >=3.9
28Requires-Dist: click
29Requires-Dist: nvidia-ml-py
30Requires-Dist: orjson; python_version > '3.9'
31Requires-Dist: orjson<=3.11.5; python_version == '3.9 …
61Provides-Extra: s3
62Requires-Dist: boto3>=1.35.49; extra == 's3'
63Description-Content-Type: text/markdown
64
65<div align="center">
66
67<picture>
68 <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/SwanHu …
294:79… �语言模型原理与实践教程 
295- [self-llm](https://github.com/datawhalechina/self-llm):《开源大模型食用指�� …
Showing the top 5 files — 6 more files (49 regions) not shown.
No evidence locations were recorded for this file. Raw result