Debian Codegraph @

examples/unicode_commands.py

raw symbols SCIP
1 #!/usr/bin/env python
2 """A simple example demonstrating support for unicode command names."""
3
4 import math
5
6 import cmd2
7
8
9 class UnicodeApp(cmd2.Cmd):
10 """Example cmd2 application with unicode command names."""
11
12 def __init__(self) -> None:
13 super().__init__()
14 self.intro = "Welcome the Unicode example app. Note the full Unicode support: πŸ˜‡ πŸ’©"
15
16 def do_𝛑print(self, _) -> None: # noqa: PLC2401
17 """This command prints 𝛑 to 5 decimal places."""
18 self.poutput(f"𝛑 = {math.pi:.6}")
19
20 def do_δ½ ε₯½(self, arg) -> None: # noqa: N802, PLC2401
21 """This command says hello in Chinese (Mandarin)."""
22 self.poutput("δ½ ε₯½ " + arg)
23
24
25 if __name__ == "__main__":
26 app = UnicodeApp()
27 app.cmdloop()