1616logger = logging .getLogger ('urlchecker' )
1717
1818
19- def str2bool (str_bool ):
20- """
21- Convert str input to boolean
22-
23- Args:
24- - str_bool (str) : boolean variable as an str.
25-
26- Returns
27- bool
28- """
29- if isinstance (str_bool , bool ):
30- return str_bool
31- if str_bool .lower () in ('true' , 't' , 'y' , '1' ):
32- return True
33- elif str_bool .lower () in ('no' , 'false' , 'f' , 'n' , '0' ):
34- return False
35- else :
36- raise ArgumentTypeError ('Boolean value expected.' )
37-
38-
3919def main (args , extra ):
4020 """
4121 main entrypoint for running a check. We expect an args object with
@@ -73,23 +53,18 @@ def main(args, extra):
7353 white_listed_patterns = remove_empty (args .white_listed_patterns .split ("," ))
7454 white_listed_files = remove_empty (args .white_listed_files .split ("," ))
7555
76- # parse booleans
77- cleanup = str2bool (args .cleanup )
78- print_all = not str2bool (args .no_print )
79- force_pass = str2bool (args .force_pass )
80-
8156 # Alert user about settings
8257 print (" original path: %s" % args .path )
8358 print (" final path: %s" % path )
8459 print (" subfolder: %s" % args .subfolder )
8560 print (" branch: %s" % args .branch )
86- print (" cleanup: %s" % cleanup )
61+ print (" cleanup: %s" % args . cleanup )
8762 print (" file types: %s" % file_types )
88- print (" print all: %s" % print_all )
63+ print (" print all: %s" % ( not args . no_print ) )
8964 print (" url whitetlist: %s" % white_listed_urls )
9065 print (" url patterns: %s" % white_listed_patterns )
9166 print (" file patterns: %s" % white_listed_files )
92- print (" force pass: %s" % force_pass )
67+ print (" force pass: %s" % args . force_pass )
9368 print (" retry count: %s" % args .retry_count )
9469 print (" save: %s" % args .save )
9570 print (" timeout: %s" % args .timeout )
@@ -100,7 +75,7 @@ def main(args, extra):
10075 white_listed_files = white_listed_files ,
10176 white_listed_urls = white_listed_urls ,
10277 white_listed_patterns = white_listed_patterns ,
103- print_all = print_all ,
78+ print_all = not args . no_print ,
10479 retry_count = args .retry_count ,
10580 timeout = args .timeout )
10681
0 commit comments