<s> """<STR_LIT>""" <EOL> import argparse <EOL> import csv <EOL> import re <EOL> import hashlib <EOL> import sys <EOL> def setup ( args , flags ) : <EOL> """<STR_LIT>""" <EOL> if args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' or args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = True <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> elif args . type == '<STR_LIT>' : <EOL> flags [ '<STR_LIT>' ] = True <EOL> flags [ '<STR_LIT>' ] = re . compile ( '<STR_LIT>' ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> return False <EOL> return True <EOL> def hashFile ( args , flags ) : <EOL> """<STR_LIT>""" <EOL> skipped = <NUM_LIT:0> <EOL> written = <NUM_LIT:0> <EOL> if args . infile . name . endswith ( "<STR_LIT>" ) : <EOL> csv_file = True <EOL> reader = csv . reader ( args . infile , dialect = '<STR_LIT>' ) <EOL> else : <EOL> csv_file = False <EOL> reader = args . infile <EOL> for text in reader : <EOL> if not csv_file : <EOL> text = [ text ] <EOL> for line in text : <EOL> if not line : <EOL> break <EOL> line = line . rstrip ( ) <EOL> line = '<STR_LIT>' . join ( line . split ( ) ) <EOL> if flags [ '<STR_LIT>' ] : <EOL> line = line . upper ( ) <EOL> else : <EOL> line = line . lower ( ) <EOL> if flags [ '<STR_LIT>' ] : <EOL> line = line . lstrip ( '<STR_LIT:@>' ) <EOL> if flags [ '<STR_LIT>' ] : <EOL> line = line . lstrip ( '<STR_LIT:0>' ) <EOL> if flags [ '<STR_LIT>' ] . match ( line ) is None : <EOL> skipped += <NUM_LIT:1> <EOL> continue <EOL> if debug : <EOL> print ( "<STR_LIT:\t>" + line ) <EOL> hashed = hashlib . sha256 ( line ) . hexdigest ( ) <EOL> args . outfile . write ( hashed + "<STR_LIT:\n>" ) <EOL> written += <NUM_LIT:1> <EOL> args . infile . close ( ) <EOL> args . outfile . close ( ) <EOL> hash_info = { "<STR_LIT>" : written , "<STR_LIT>" : skipped } <EOL> return hash_info <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> debug = False <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> aud_types = [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> parser . add_argument ( '<STR_LIT>' , required = True , metavar = '<STR_LIT>' , help = '<STR_LIT>' , <EOL> choices = aud_types ) <EOL> parser . add_argument ( '<STR_LIT>' , required = True , type = argparse . FileType ( '<STR_LIT>' ) , <EOL> metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , required = True , type = argparse . FileType ( '<STR_LIT:w>' ) , <EOL> metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> flags = { '<STR_LIT>' : False , '<STR_LIT>' : False , '<STR_LIT>' : False } <EOL> if setup ( args , flags ) is True : <EOL> hashed_info = hashFile ( args , flags ) <EOL> print ( "<STR_LIT>" + str ( hashed_info [ '<STR_LIT>' ] ) ) <EOL> print ( "<STR_LIT>" + str ( hashed_info [ '<STR_LIT>' ] ) ) <EOL> sys . exit ( ) </s>
