randpal 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
randpal/__init__.py
ADDED
randpal/__main__.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import random
|
|
3
|
+
|
|
4
|
+
VERBOSE_MODE = True
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def command_int(args: argparse.Namespace) -> None:
|
|
8
|
+
if VERBOSE_MODE:
|
|
9
|
+
print("Random number is ", end="") # noqa: T201
|
|
10
|
+
|
|
11
|
+
print(random.randint(args.a, args.b), end="\n\n") # noqa: T201
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def command_choose(args: argparse.Namespace) -> None:
|
|
15
|
+
if VERBOSE_MODE:
|
|
16
|
+
print("Random chosen item is ", end="") # noqa: T201
|
|
17
|
+
|
|
18
|
+
print(random.choice(args.item), end="\n\n") # noqa: T201
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def parse_args() -> argparse.Namespace:
|
|
22
|
+
parser = argparse.ArgumentParser()
|
|
23
|
+
commands = parser.add_subparsers(required=True)
|
|
24
|
+
|
|
25
|
+
com_int = commands.add_parser("int")
|
|
26
|
+
com_int.add_argument("a", type=int)
|
|
27
|
+
com_int.add_argument("b", type=int)
|
|
28
|
+
com_int.set_defaults(command=command_int)
|
|
29
|
+
|
|
30
|
+
com_choose = commands.add_parser("choose")
|
|
31
|
+
com_choose.add_argument("item", nargs="+")
|
|
32
|
+
com_choose.set_defaults(command=command_choose)
|
|
33
|
+
|
|
34
|
+
return parser.parse_args()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def main() -> None:
|
|
38
|
+
args = parse_args()
|
|
39
|
+
args.command(args)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
main()
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
randpal/__init__.py,sha256=ZMMx7hHYTCyEBGFBwLAlXaXioTxy9ocmt7zzAZDo-dA,55
|
|
2
|
+
randpal/__main__.py,sha256=a78PF6W5uYgZY99As385K_62Fnirz-xyVR1N6pDwUGA,1085
|
|
3
|
+
randpal-0.1.0.dist-info/METADATA,sha256=c59G91BnfXfkuyjipG_Wa6XCSTsffT21XNLYgJ_bhCM,183
|
|
4
|
+
randpal-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
5
|
+
randpal-0.1.0.dist-info/entry_points.txt,sha256=uRaxIllVtRG_iMyBb5Hs8nVosJWe2bXErFlgTxLJpwg,50
|
|
6
|
+
randpal-0.1.0.dist-info/RECORD,,
|