black formatting
This commit is contained in:
19
args.py
19
args.py
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import logging
|
||||
|
||||
|
||||
def get_string_arg(args, required):
|
||||
"""
|
||||
Take an array of element, take first element and return it stripped.
|
||||
@@ -12,24 +13,26 @@ def get_string_arg(args, required):
|
||||
:return: The arg stripped
|
||||
"""
|
||||
if not args:
|
||||
print(f'Missing {required}')
|
||||
print(f"Missing {required}")
|
||||
sys.exit(1)
|
||||
|
||||
logging.debug(args)
|
||||
return args[0].strip()
|
||||
|
||||
|
||||
# TODO Move this function
|
||||
def arg_string(arg, required = ''):
|
||||
def arg_string(arg, required=""):
|
||||
# TODO To meld with get_string_args
|
||||
if required and arg.startswith('-'):
|
||||
print('required ', required)
|
||||
sys.exit('1')
|
||||
if required and arg.startswith("-"):
|
||||
print("required ", required)
|
||||
sys.exit("1")
|
||||
else:
|
||||
return arg.strip()
|
||||
|
||||
def arg_number(arg, required = ''):
|
||||
|
||||
def arg_number(arg, required=""):
|
||||
if not arg.isdigit():
|
||||
print('Invalid value') # TODO
|
||||
print("Invalid value") # TODO
|
||||
sys.exit(1)
|
||||
|
||||
return int(arg)
|
||||
return int(arg)
|
||||
|
||||
Reference in New Issue
Block a user