<s> """<STR_LIT>""" <EOL> from __future__ import ( <EOL> absolute_import , division , print_function , with_statement , <EOL> unicode_literals ) <EOL> import sys <EOL> import itertools as it <EOL> from os import getcwd , path as p <EOL> from argparse import RawTextHelpFormatter , ArgumentParser <EOL> from builtins import * <EOL> import pygogo as gogo <EOL> HDLRS_FULL = tuple ( h for h in dir ( gogo . handlers ) if h . endswith ( '<STR_LIT>' ) ) <EOL> HDLRS = tuple ( h [ : - <NUM_LIT:5> ] for h in HDLRS_FULL ) <EOL> LEVELS = ( '<STR_LIT>' , '<STR_LIT:error>' , '<STR_LIT>' , '<STR_LIT:info>' , '<STR_LIT>' ) <EOL> FRMTRS_FULL = tuple ( f for f in dir ( gogo . formatters ) if f . endswith ( '<STR_LIT>' ) ) <EOL> FORMATS = tuple ( f [ : - <NUM_LIT:10> ] for f in FRMTRS_FULL ) <EOL> CURDIR = p . basename ( getcwd ( ) ) <EOL> LOGFILE = '<STR_LIT>' % CURDIR <EOL> parser = ArgumentParser ( <EOL> description = '<STR_LIT>' , prog = '<STR_LIT>' , <EOL> usage = '<STR_LIT>' , formatter_class = RawTextHelpFormatter ) <EOL> parser . add_argument ( <EOL> dest = '<STR_LIT:message>' , nargs = '<STR_LIT:?>' , default = sys . stdin , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = LEVELS , default = '<STR_LIT:info>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( LEVELS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( LEVELS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , default = CURDIR , <EOL> help = "<STR_LIT>" % CURDIR ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = HDLRS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = HDLRS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = LEVELS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = LEVELS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( HDLRS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = FORMATS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( FORMATS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( FORMATS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , choices = FORMATS , default = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( <EOL> '<STR_LIT:U+002CU+0020>' . join ( FORMATS [ : <NUM_LIT:4> ] ) , '<STR_LIT:U+002CU+0020>' . join ( FORMATS [ <NUM_LIT:4> : ] ) ) ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , default = False , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT>' , default = [ LOGFILE ] , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) % LOGFILE ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , default = [ "<STR_LIT>" ] , action = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT>' , default = [ '<STR_LIT>' ] , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , default = [ '<STR_LIT:localhost>' ] , action = '<STR_LIT>' , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , metavar = '<STR_LIT>' , type = int , action = '<STR_LIT>' , default = [ '<STR_LIT>' ] , <EOL> help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:count>' , default = <NUM_LIT:0> , help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:count>' , default = <NUM_LIT:0> , help = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , help = "<STR_LIT>" , action = '<STR_LIT:store_true>' , <EOL> default = False ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , help = '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> default = False ) <EOL> args = parser . parse_args ( ) <EOL> def run ( ) : <EOL> """<STR_LIT>""" <EOL> gogo_logger = gogo . Gogo ( __name__ , verbose = args . verbose ) . get_logger ( '<STR_LIT>' ) <EOL> if args . version : <EOL> gogo_logger . info ( '<STR_LIT>' % gogo . __version__ ) <EOL> exit ( <NUM_LIT:0> ) <EOL> counted = { '<STR_LIT>' , '<STR_LIT>' } <EOL> appended = { '<STR_LIT:filename>' , '<STR_LIT>' , '<STR_LIT:url>' , '<STR_LIT:host>' , '<STR_LIT:port>' } <EOL> items = args . _get_kwargs ( ) <EOL> counted_args = [ i for i in items if i [ <NUM_LIT:0> ] in counted ] <EOL> appended_args = [ i for i in items if i [ <NUM_LIT:0> ] in appended ] <EOL> high_appended_args = [ ( k , v [ <NUM_LIT:0> ] ) for k , v in appended_args ] <EOL> high_counted_args = [ ( k , v > <NUM_LIT:0> ) for k , v in counted_args ] <EOL> high_kwargs = dict ( it . chain ( high_appended_args , high_counted_args ) ) <EOL> low_appended_args = [ ( k , v [ - <NUM_LIT:1> ] ) for k , v in appended_args ] <EOL> low_counted_args = [ ( k , v > <NUM_LIT:1> ) for k , v in counted_args ] <EOL> low_kwargs = dict ( it . chain ( low_appended_args , low_counted_args ) ) <EOL> high_hdlr = getattr ( gogo . handlers , '<STR_LIT>' % args . high_hdlr ) <EOL> low_hdlr = getattr ( gogo . handlers , '<STR_LIT>' % args . low_hdlr ) <EOL> high_format = getattr ( gogo . formatters , '<STR_LIT>' % args . high_format ) <EOL> low_format = getattr ( gogo . formatters , '<STR_LIT>' % args . low_format ) <EOL> nkwargs = { <EOL> '<STR_LIT>' : args . verbose , <EOL> '<STR_LIT>' : args . high_level . upper ( ) , <EOL> '<STR_LIT>' : args . low_level . upper ( ) , <EOL> '<STR_LIT>' : high_format , <EOL> '<STR_LIT>' : low_format , <EOL> '<STR_LIT>' : args . monolog , <EOL> '<STR_LIT>' : high_hdlr ( ** high_kwargs ) , <EOL> '<STR_LIT>' : low_hdlr ( ** low_kwargs ) } <EOL> logger = gogo . Gogo ( args . name , ** nkwargs ) . get_logger ( '<STR_LIT>' ) <EOL> try : <EOL> message = args . message . read ( ) <EOL> except AttributeError : <EOL> message = args . message <EOL> getattr ( logger , args . level ) ( message ) <EOL> exit ( <NUM_LIT:0> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run ( ) </s>
