MCPcopy Create free account
hub / github.com/geekcomputers/Python / check_ratio

Function check_ratio

random_file_move.py:14–22  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

12
13
14def check_ratio(x):
15 try:
16 x = float(x)
17 except ValueError:
18 raise argparse.ArgumentTypeError("%r not a floating-point literal" % (x,))
19
20 if x < 0.0 or x > 1.0:
21 raise argparse.ArgumentTypeError("%r not in range [0.0, 1.0]" % (x))
22 return x
23
24
25desc = "Script to move specified number of files(given in ratio) from the src directory to dest directory."

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected