<s> import sys <EOL> import os <EOL> libdir = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , '<STR_LIT>' ) <EOL> sys . path . append ( libdir ) <EOL> import utils <EOL> import jdecode <EOL> from datalib import Datamine <EOL> def main ( fname , verbose = True , outliers = False , dump_all = False ) : <EOL> if fname [ - <NUM_LIT:5> : ] == '<STR_LIT>' : <EOL> if verbose : <EOL> print '<STR_LIT>' + fname <EOL> json_srcs = jdecode . mtg_open_json ( fname , verbose ) <EOL> card_srcs = [ ] <EOL> for json_cardname in sorted ( json_srcs ) : <EOL> if len ( json_srcs [ json_cardname ] ) > <NUM_LIT:0> : <EOL> card_srcs += [ json_srcs [ json_cardname ] [ <NUM_LIT:0> ] ] <EOL> else : <EOL> if verbose : <EOL> print '<STR_LIT>' + fname <EOL> with open ( fname , '<STR_LIT>' ) as f : <EOL> text = f . read ( ) <EOL> card_srcs = text . split ( utils . cardsep ) <EOL> mine = Datamine ( card_srcs ) <EOL> mine . summarize ( ) <EOL> if outliers or dump_all : <EOL> mine . outliers ( dump_invalid = dump_all ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import argparse <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> main ( args . infile , verbose = args . verbose , outliers = args . outliers , dump_all = args . all ) <EOL> exit ( <NUM_LIT:0> ) </s>
