Commit b7669f5 1 parent 88d29dd commit b7669f5 Copy full SHA for b7669f5
File tree 2 files changed +47
-8
lines changed
2 files changed +47
-8
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ """
3
+ Author : Luke McGuire <[email protected] >
4
+ Date : 2024-06-18
5
+ Purpose: Jump the Five.
6
+ """
7
+
8
+ import argparse
9
+
10
+
11
+ # --------------------------------------------------
12
+ def get_args ():
13
+ """Get command-line arguments"""
14
+
15
+ parser = argparse .ArgumentParser (
16
+ description = "Jump the Five." ,
17
+ formatter_class = argparse .ArgumentDefaultsHelpFormatter ,
18
+ )
19
+
20
+ parser .add_argument ("message" , metavar = "str" , help = "Message to encode." )
21
+
22
+ return parser .parse_args ()
23
+
24
+
25
+ # --------------------------------------------------
26
+ def main ():
27
+ """Make a jazz noise here"""
28
+
29
+ args = get_args ()
30
+ # print(args.message.translate(str.maketrans("1234567890", "9876043215")))
31
+ cipher = dict (zip ("1234567890" , "9876043215" ))
32
+
33
+ # print("".join(cipher.get(c, c) for c in message))
34
+ print (args .message .translate (str .maketrans (cipher )))
35
+
36
+
37
+ # --------------------------------------------------
38
+ if __name__ == "__main__" :
39
+ main ()
Original file line number Diff line number Diff line change 4
4
import os
5
5
from subprocess import getstatusoutput
6
6
7
- prg = ' ./jump.py'
7
+ prg = " ./jump.py"
8
8
9
9
10
10
# --------------------------------------------------
@@ -18,25 +18,25 @@ def test_exists():
18
18
def test_usage ():
19
19
"""usage"""
20
20
21
- for flag in ['-h' , ' --help' ]:
22
- rv , out = getstatusoutput (f' { prg } { flag } ' )
21
+ for flag in ["-h" , " --help" ]:
22
+ rv , out = getstatusoutput (f"python3 { prg } { flag } " )
23
23
assert rv == 0
24
- assert out .lower ().startswith (' usage' )
24
+ assert out .lower ().startswith (" usage" )
25
25
26
26
27
27
# --------------------------------------------------
28
28
def test_01 ():
29
29
"""test"""
30
30
31
- rv , out = getstatusoutput (f' { prg } 123-456-7890' )
31
+ rv , out = getstatusoutput (f"python3 { prg } 123-456-7890" )
32
32
assert rv == 0
33
- assert out == ' 987-604-3215'
33
+ assert out == " 987-604-3215"
34
34
35
35
36
36
# --------------------------------------------------
37
37
def test_02 ():
38
38
"""test"""
39
39
40
- rv , out = getstatusoutput (f'{ prg } "That number to call is 098-765-4321."' )
40
+ rv , out = getstatusoutput (f'python3 { prg } "That number to call is 098-765-4321."' )
41
41
assert rv == 0
42
- assert out .rstrip () == ' That number to call is 512-340-6789.'
42
+ assert out .rstrip () == " That number to call is 512-340-6789."
You can’t perform that action at this time.
0 commit comments