<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> sys . path . append ( os . path . dirname ( os . path . dirname ( __file__ ) ) ) <EOL> import argparse <EOL> import logging <EOL> import sys <EOL> from imagemounter import ImageParser , __version__ <EOL> from termcolor import colored <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:version>' , version = __version__ , help = '<STR_LIT>' ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = '<STR_LIT>' , required = True , metavar = '<STR_LIT>' , <EOL> help = "<STR_LIT>" , dest = '<STR_LIT>' ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , help = "<STR_LIT>" , dest = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT:-c>" , "<STR_LIT>" , help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store_true>" , help = "<STR_LIT>" , dest = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store_true>" , help = "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> class ImageMounterFormatter ( logging . Formatter ) : <EOL> def format ( self , record ) : <EOL> msg = record . getMessage ( ) <EOL> if args . verbose and record . exc_info : <EOL> if not record . exc_text : <EOL> record . exc_text = self . formatException ( record . exc_info ) <EOL> if msg [ - <NUM_LIT:1> : ] != "<STR_LIT:\n>" : <EOL> msg += "<STR_LIT:\n>" <EOL> msg += record . exc_text <EOL> if record . levelno >= logging . WARNING : <EOL> return colored ( "<STR_LIT>" + msg , '<STR_LIT>' ) <EOL> elif record . levelno == logging . INFO : <EOL> return colored ( "<STR_LIT>" + msg , '<STR_LIT>' ) <EOL> elif msg . startswith ( '<STR_LIT:$>' ) : <EOL> return colored ( "<STR_LIT:U+0020>" + msg , '<STR_LIT>' ) <EOL> else : <EOL> return colored ( "<STR_LIT:U+0020>" + msg , '<STR_LIT>' ) <EOL> handler = logging . StreamHandler ( ) <EOL> handler . setFormatter ( ImageMounterFormatter ( ) ) <EOL> logger = logging . getLogger ( "<STR_LIT>" ) <EOL> logger . setLevel ( logging . WARNING if not args . verbose else logging . DEBUG ) <EOL> logger . addHandler ( handler ) <EOL> parser = ImageParser ( args . images , pretty = True , ** vars ( args ) ) <EOL> for volume in parser . init ( ) : <EOL> if volume . mountpoint : <EOL> print ( '<STR_LIT>' . format ( colored ( volume . get_description ( ) , attrs = [ '<STR_LIT>' ] ) , <EOL> colored ( volume . mountpoint , '<STR_LIT>' , attrs = [ '<STR_LIT>' ] ) ) ) <EOL> elif volume . loopback : <EOL> print ( '<STR_LIT>' . format ( colored ( volume . get_description ( ) , attrs = [ '<STR_LIT>' ] ) , <EOL> colored ( volume . loopback , '<STR_LIT>' , attrs = [ '<STR_LIT>' ] ) ) ) <EOL> print ( colored ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> elif volume . exception and volume . size is not None and volume . size <= <NUM_LIT> : <EOL> print ( colored ( '<STR_LIT>' . format ( volume . get_description ( ) ) , '<STR_LIT>' ) ) <EOL> elif volume . exception : <EOL> print ( colored ( '<STR_LIT>' . format ( volume . get_description ( ) ) , '<STR_LIT>' ) ) <EOL> elif volume . flag != '<STR_LIT>' or args . verbose : <EOL> print ( colored ( '<STR_LIT>' . format ( volume . get_description ( ) ) , '<STR_LIT>' ) ) <EOL> if args . carve and volume . flag != '<STR_LIT>' : <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> sys . stdout . flush ( ) <EOL> if volume . carve ( freespace = not volume . mountpoint ) : <EOL> print ( '<STR_LIT>' . format ( colored ( volume . carvepoint , '<STR_LIT>' , attrs = [ '<STR_LIT>' ] ) ) ) <EOL> else : <EOL> print ( colored ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
