<s> import os <EOL> from django . core . management . base import NoArgsCommand <EOL> from optparse import make_option <EOL> class Command ( NoArgsCommand ) : <EOL> option_list = NoArgsCommand . option_list + ( <EOL> make_option ( '<STR_LIT>' , action = '<STR_LIT:store_true>' , dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) , <EOL> ) <EOL> help = "<STR_LIT>" <EOL> shells = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> requires_model_validation = False <EOL> def ipython ( self ) : <EOL> try : <EOL> from IPython . frontend . terminal . embed import TerminalInteractiveShell <EOL> shell = TerminalInteractiveShell ( ) <EOL> shell . mainloop ( ) <EOL> except ImportError : <EOL> try : <EOL> from IPython . Shell import IPShell <EOL> shell = IPShell ( argv = [ ] ) <EOL> shell . mainloop ( ) <EOL> except ImportError : <EOL> raise <EOL> def bpython ( self ) : <EOL> import bpython <EOL> bpython . embed ( ) <EOL> def run_shell ( self ) : <EOL> for shell in self . shells : <EOL> try : <EOL> return getattr ( self , shell ) ( ) <EOL> except ImportError : <EOL> pass <EOL> raise ImportError <EOL> def handle_noargs ( self , ** options ) : <EOL> from django . db . models . loading import get_models <EOL> loaded_models = get_models ( ) <EOL> use_plain = options . get ( '<STR_LIT>' , False ) <EOL> try : <EOL> if use_plain : <EOL> raise ImportError <EOL> self . run_shell ( ) <EOL> except ImportError : <EOL> import code <EOL> imported_objects = { } <EOL> try : <EOL> import readline <EOL> except ImportError : <EOL> pass <EOL> else : <EOL> import rlcompleter <EOL> readline . set_completer ( rlcompleter . Completer ( imported_objects ) . complete ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> if not use_plain : <EOL> pythonrc = os . environ . get ( "<STR_LIT>" ) <EOL> if pythonrc and os . path . isfile ( pythonrc ) : <EOL> try : <EOL> execfile ( pythonrc ) <EOL> except NameError : <EOL> pass <EOL> import user <EOL> code . interact ( local = imported_objects ) </s>
