From 2d5967e6ff4b2f1609b43d56a3fe3e6e0f3fd0b4 Mon Sep 17 00:00:00 2001 From: hsc Date: Thu, 14 May 2026 09:43:36 +0800 Subject: [PATCH 1/3] update code flake8 error --- qns/entity/cchannel/cchannel_ex.py | 6 ++++-- qns/simulator/stablepool.py | 2 +- test/entity/test_cchannelex.py | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/qns/entity/cchannel/cchannel_ex.py b/qns/entity/cchannel/cchannel_ex.py index b1c5e01..23ea16f 100644 --- a/qns/entity/cchannel/cchannel_ex.py +++ b/qns/entity/cchannel/cchannel_ex.py @@ -15,13 +15,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from typing import Any, List +from typing import List from qns.simulator.ts import Time from qns.entity.node.node import QNode from qns.models.delay.delay import DelayModel from qns.simulator.simulator import Simulator -from qns.entity.cchannel.cchannel import * +from qns.utils.rnd import get_rand +import qns.utils.log as log +from qns.entity.cchannel.cchannel import ClassicPacket, ClassicChannel, RecvClassicPacket, NextHopNotConnectionException class ClassicChannelEx(ClassicChannel): diff --git a/qns/simulator/stablepool.py b/qns/simulator/stablepool.py index 9f0e586..0e845fb 100644 --- a/qns/simulator/stablepool.py +++ b/qns/simulator/stablepool.py @@ -30,7 +30,7 @@ def __eq__(self, other) -> bool: return self.event == other.event and self.seq == other.seq def __lt__(self, other) -> bool: - return self.event < other.event or (@ + return self.event < other.event or ( self.event == other.event and self.seq < other.seq ) diff --git a/test/entity/test_cchannelex.py b/test/entity/test_cchannelex.py index f2ad33d..969c0ac 100644 --- a/test/entity/test_cchannelex.py +++ b/test/entity/test_cchannelex.py @@ -1,8 +1,10 @@ from qns.simulator.event import Event from qns.simulator import Simulator, func_to_event -from qns.utils.log import * from qns.simulator.stablepool import StableEventPool -from qns.entity import * +from qns.entity.node.node import QNode +from qns.entity.node.app import Application +from qns.utils.log import install +from qns.entity.cchannel.cchannel import ClassicChannel, ClassicPacket from qns.entity.cchannel.cchannel_ex import ClassicChannelEx From f0f3c74325c221385f703a274091988947f969dc Mon Sep 17 00:00:00 2001 From: hsc Date: Thu, 14 May 2026 10:14:37 +0800 Subject: [PATCH 2/3] Update pytest error --- qns/entity/cchannel/cchannel_ex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qns/entity/cchannel/cchannel_ex.py b/qns/entity/cchannel/cchannel_ex.py index 23ea16f..663b90c 100644 --- a/qns/entity/cchannel/cchannel_ex.py +++ b/qns/entity/cchannel/cchannel_ex.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from typing import List +from typing import List, Union from qns.simulator.ts import Time from qns.entity.node.node import QNode @@ -37,7 +37,7 @@ def __init__( name: str = None, node_list: List[QNode] = [], bandwidth: int = 0, - delay: float | DelayModel = 0, + delay: Union[float, DelayModel] = 0, length: float | None = 0, drop_rate: float = 0, max_buffer_size: int = 0, From 0efcc3ce737fdb08b0d9474b2db38dca3f48413a Mon Sep 17 00:00:00 2001 From: hsc Date: Thu, 14 May 2026 10:20:29 +0800 Subject: [PATCH 3/3] update error --- qns/entity/cchannel/cchannel_ex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qns/entity/cchannel/cchannel_ex.py b/qns/entity/cchannel/cchannel_ex.py index 663b90c..cc4bd9c 100644 --- a/qns/entity/cchannel/cchannel_ex.py +++ b/qns/entity/cchannel/cchannel_ex.py @@ -38,7 +38,7 @@ def __init__( node_list: List[QNode] = [], bandwidth: int = 0, delay: Union[float, DelayModel] = 0, - length: float | None = 0, + length: Union[float, None] = 0, drop_rate: float = 0, max_buffer_size: int = 0, ):