Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
if arg[-1] in 'kK':
file_size = int(arg[:-1]) * 1024
elif arg[-1] in 'mM':
file_size = int(arg[:-1]) * 1024 * 1024
else:
file_size = int(arg)
if file_size < 200 * 1024: raise ValueError()
except ValueError:
wikiextractor.show_size_error(script_name, arg)
sys.exit(2)
elif opt in ('-o', '--output'):
if os.path.isdir(arg):
output_dir = arg
else:
wikiextractor.show_file_error(script_name, arg)
sys.exit(3)
if len(args) > 0:
wikiextractor.show_usage(sys.stderr, script_name)
wikiextractor.show_suggestion(sys.stderr, script_name)
sys.exit(4)
wiki_extractor = AnnotatedWikiExtractor()
output_splitter = wikiextractor.OutputSplitter(compress, file_size, output_dir)
process_data(sys.stdin, wiki_extractor, output_splitter)
output_splitter.close()
try:
if arg[-1] in 'kK':
file_size = int(arg[:-1]) * 1024
elif arg[-1] in 'mM':
file_size = int(arg[:-1]) * 1024 * 1024
else:
file_size = int(arg)
if file_size < 200 * 1024: raise ValueError()
except ValueError:
wikiextractor.show_size_error(script_name, arg)
sys.exit(2)
elif opt in ('-o', '--output'):
if os.path.isdir(arg):
output_dir = arg
else:
wikiextractor.show_file_error(script_name, arg)
sys.exit(3)
if len(args) > 0:
wikiextractor.show_usage(sys.stderr, script_name)
wikiextractor.show_suggestion(sys.stderr, script_name)
sys.exit(4)
wiki_extractor = AnnotatedWikiExtractor()
output_splitter = wikiextractor.OutputSplitter(compress, file_size, output_dir)
process_data(sys.stdin, wiki_extractor, output_splitter)
output_splitter.close()