Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 7b1139f

Browse files
committed
Speed up dict initialization
"use-dict-literal" pylint error fix. The literal is faster as it avoids an additional function call. Signed-off-by: Andrea Cervesato <[email protected]>
1 parent 5d9a984 commit 7b1139f

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

ltp/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _sut_config(value: str) -> dict:
8080
for opt, desc in sut.config_help.items():
8181
msg += f"\t{opt}: {desc}\n"
8282

83-
return dict(help=msg)
83+
return {"help": msg}
8484

8585
if not value:
8686
raise argparse.ArgumentTypeError("SUT parameters can't be empty")

ltp/qemu.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,18 @@ def setup(self, **kwargs: dict) -> None:
188188

189189
@property
190190
def config_help(self) -> dict:
191-
return dict(
192-
image="qcow2 image location",
193-
image_overlay="image_overlay: image copy location",
194-
password="root password (default: root)",
195-
system="system architecture (default: x86_64)",
196-
ram="RAM of the VM (default: 2G)",
197-
smp="number of CPUs (default: 2)",
198-
serial="type of serial protocol. isa|virtio (default: isa)",
199-
virtfs="directory to mount inside VM",
200-
ro_image="path of the image that will exposed as read only",
201-
options="user defined options",
202-
)
191+
return {
192+
"image": "qcow2 image location",
193+
"image_overlay": "image_overlay: image copy location",
194+
"password": "root password (default: root)",
195+
"system": "system architecture (default: x86_64)",
196+
"ram": "RAM of the VM (default: 2G)",
197+
"smp": "number of CPUs (default: 2)",
198+
"serial": "type of serial protocol. isa|virtio (default: isa)",
199+
"virtfs": "directory to mount inside VM",
200+
"ro_image": "path of the image that will exposed as read only",
201+
"options": "user defined options",
202+
}
203203

204204
@property
205205
def name(self) -> str:

ltp/ssh.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,18 @@ def setup(self, **kwargs: dict) -> None:
138138

139139
@property
140140
def config_help(self) -> dict:
141-
return dict(
142-
host="IP address of the SUT (default: localhost)",
143-
port="TCP port of the service (default: 22)",
144-
user="name of the user (default: root)",
145-
password="root password",
146-
timeout="connection timeout in seconds (default: 10)",
147-
key_file="private key location",
148-
hostkey_policy="host key policy - auto | missing | reject. (default: auto)",
149-
known_hosts="known_hosts file (default: ~/.ssh/known_hosts)",
150-
reset_command="command to reset the remote SUT",
151-
sudo="use sudo to access to root shell (default: 0)",
152-
)
141+
return {
142+
"host": "IP address of the SUT (default: localhost)",
143+
"port": "TCP port of the service (default: 22)",
144+
"user": "name of the user (default: root)",
145+
"password": "root password",
146+
"timeout": "connection timeout in seconds (default: 10)",
147+
"key_file": "private key location",
148+
"hostkey_policy": "host key policy - auto | missing | reject. (default: auto)",
149+
"known_hosts": "known_hosts file (default: ~/.ssh/known_hosts)",
150+
"reset_command": "command to reset the remote SUT",
151+
"sudo": "use sudo to access to root shell (default: 0)",
152+
}
153153

154154
@property
155155
def name(self) -> str:

0 commit comments

Comments
 (0)