Skip to content

Commit 7544fc7

Browse files
committed
Code cleanup.
1 parent c3d3455 commit 7544fc7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

examples/icmp_echo_client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656

5757
ICMP4__ECHO_REQUEST__TYPE = 8
5858
ICMP4__ECHO_REQUEST__CODE = 0
59-
6059
ICMP6_ECHO_REQUEST_TYPE = 128
6160
ICMP6_ECHO_REQUEST_CODE = 0
6261

@@ -209,21 +208,20 @@ def cli(
209208
ctx: click.Context,
210209
*,
211210
remote_ip_address: Ip6Address | Ip4Address,
212-
**kwargs: dict[str, Any],
211+
**kwargs: Any,
213212
) -> None:
214213
"""
215-
Start PyTCP stack and stop it when user presses Ctrl-C.
216214
Start ICMP Echo client.
217215
"""
218216

219-
match remote_ip_address.version:
220-
case IpVersion.IP6:
221-
client = IcmpEchoClient(remote_ip_address=remote_ip_address)
222-
case IpVersion.IP4:
223-
client = IcmpEchoClient(remote_ip_address=remote_ip_address)
224-
225-
ctx.invoke(stack_cli, subsystem=client, **kwargs)
217+
ctx.invoke(
218+
stack_cli,
219+
subsystem=IcmpEchoClient(remote_ip_address=remote_ip_address),
220+
**kwargs,
221+
)
226222

227223

228224
if __name__ == "__main__":
225+
cli.help = (cli.help or "").rstrip() + (stack_cli.help or "")
226+
cli.params += stack_cli.params
229227
cli.main()

0 commit comments

Comments
 (0)