mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-03 01:00:11 +03:00
refactor: use iterable unpacking instead of concatenation
This commit is contained in:
parent
2dc7479d11
commit
06899c92fc
@ -524,7 +524,7 @@ def _inject_topology_into_system(
|
||||
if filtered_count > 0:
|
||||
logger.debug("Filtered out %d existing SystemMessage(s)", filtered_count)
|
||||
|
||||
return [SystemMessage(content=formatted_prompt)] + non_system_messages
|
||||
return [SystemMessage(content=formatted_prompt), *non_system_messages]
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@ -556,7 +556,7 @@ def prepare_context_messages(
|
||||
else:
|
||||
formatted_prompt = system_prompt.replace("{{topology_info}}", "(No topology information available)")
|
||||
|
||||
return [SystemMessage(content=formatted_prompt)] + state_messages
|
||||
return [SystemMessage(content=formatted_prompt), *state_messages]
|
||||
|
||||
|
||||
# ============================================================================
|
||||
|
||||
@ -444,7 +444,7 @@ class PacketAnalysisTool(BaseTool):
|
||||
# Build command: tshark -r <file> <user_args>
|
||||
import shlex
|
||||
|
||||
cmd = ["tshark", "-r", pcap_file] + shlex.split(tshark_args)
|
||||
cmd = ["tshark", "-r", pcap_file, *shlex.split(tshark_args)]
|
||||
|
||||
logger.info(f"Running tshark: {' '.join(cmd)}")
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ def unpack_zip(filename, extract_dir=None):
|
||||
with zipfile.ZipFile(filename, "r") as zfile:
|
||||
for zinfo in zfile.infolist():
|
||||
fname = os.path.join(extract_dir, zinfo.filename)
|
||||
date_time = time.mktime(zinfo.date_time + (0, 0, -1))
|
||||
date_time = time.mktime((*zinfo.date_time, 0, 0, -1))
|
||||
zfile.extract(zinfo, extract_dir)
|
||||
|
||||
# update timestamp
|
||||
|
||||
@ -146,7 +146,7 @@ class VirtualBoxVM(BaseNode):
|
||||
"""
|
||||
|
||||
args = shlex.split(params)
|
||||
result = await self.manager.execute("controlvm", [self._uuid] + args)
|
||||
result = await self.manager.execute("controlvm", [self._uuid, *args])
|
||||
return result
|
||||
|
||||
async def _modify_vm(self, params):
|
||||
@ -157,7 +157,7 @@ class VirtualBoxVM(BaseNode):
|
||||
"""
|
||||
|
||||
args = shlex.split(params)
|
||||
await self.manager.execute("modifyvm", [self._uuid] + args)
|
||||
await self.manager.execute("modifyvm", [self._uuid, *args])
|
||||
|
||||
async def _check_duplicate_linked_clone(self):
|
||||
"""
|
||||
@ -866,7 +866,7 @@ class VirtualBoxVM(BaseNode):
|
||||
"""
|
||||
|
||||
args = shlex.split(params)
|
||||
await self.manager.execute("storageattach", [self._uuid] + args)
|
||||
await self.manager.execute("storageattach", [self._uuid, *args])
|
||||
|
||||
async def _get_nic_attachements(self, maximum_adapters):
|
||||
"""
|
||||
|
||||
@ -163,7 +163,7 @@ class LLMModelConfigsRepository(BaseRepository):
|
||||
|
||||
# Handle extra config fields
|
||||
for key, value in updates.items():
|
||||
if key not in ["name", "model_type", "is_default", "expected_version"] + config_fields:
|
||||
if key not in ["name", "model_type", "is_default", "expected_version", *config_fields]:
|
||||
if value is not None:
|
||||
current_config[key] = value
|
||||
|
||||
@ -322,7 +322,7 @@ class LLMModelConfigsRepository(BaseRepository):
|
||||
|
||||
# Handle extra config fields
|
||||
for key, value in updates.items():
|
||||
if key not in ["name", "model_type", "is_default", "expected_version"] + config_fields:
|
||||
if key not in ["name", "model_type", "is_default", "expected_version", *config_fields]:
|
||||
if value is not None:
|
||||
current_config[key] = value
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user