p = PillowImageFile . Parser ( ) parser = command . create_parser ( '' , name ) defaults , _ = parser . parse_args ( args = [ ] ) parser = subcommand_cls . create_parser ( '' , cwords [ 0 ] ) parser = CommandParser ( None , usage = "%(prog)s subcommand [options] [args]" , add_help = False ) parser . add_argument ( '--settings' ) parser . add_argument ( '--pythonpath' ) parser . add_argument ( 'args' , nargs = '*' ) options , args = parser . parse_known_args ( self . argv [ 2 : ] ) parser . add_option ( '--pythonpath' , help = 'A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".' ) , parser . add_option ( '--traceback' , action = 'store_true' , help = 'Raise on exception' ) parser . add_option ( '--no-color' , action = 'store_true' , dest = 'no_color' , default = False , help = "Don't colorize the command output." ) parser . add_option ( opt ) parser . add_argument ( '--version' , action = 'version' , version = self . get_version ( ) ) parser . add_argument ( '-v' , '--verbosity' , action = 'store' , dest = 'verbosity' , default = '1' , type = int , choices = [ 0 , 1 , 2 , 3 ] , help = 'Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output' ) parser . add_argument ( '--pythonpath' , help = 'A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".' ) parser . add_argument ( '--traceback' , action = 'store_true' , help = 'Raise on exception' ) parser . add_argument ( '--no-color' , action = 'store_true' , dest = 'no_color' , default = False , help = "Don't colorize the command output." ) parser . add_argument ( 'args' , nargs = '*' ) self . add_arguments ( parser ) return parser def add_arguments ( self , parser ) : parser = self . create_parser ( prog_name , subcommand ) parser . print_help ( ) parser = self . create_parser ( argv [ 0 ] , argv [ 1 ] ) options = parser . parse_args ( argv [ 2 : ] ) options , args = parser . parse_args ( argv [ 2 : ] ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'app_label' , nargs = '+' , help = 'One or more application label.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = self . label , nargs = '+' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'app_label' , nargs = '*' ) parser . add_argument ( '--list-tags' , action = 'store_true' , dest = 'list_tags' , help = 'List available tags.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--locale' , '-l' , dest = 'locale' , action = 'append' , default = [ ] , help = 'Locale(s) to process (e.g. de_AT). Default is to process all. ' 'Can be used multiple times.' ) parser . add_argument ( '--exclude' , '-x' , dest = 'exclude' , action = 'append' , default = [ ] , help = 'Locales to exclude. Default is none. Can be used multiple times.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'table_name' , nargs = '*' , help = 'Optional table names. Otherwise, settings.CACHES is used to ' 'find cache tables.' ) parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database onto which the cache tables will be ' 'installed. Defaults to the "default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database onto which to ' 'open a shell. Defaults to the "default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--all' , action = 'store_true' , dest = 'all' , default = False , help = 'Display all settings, regardless of their value. ' 'Default values are prefixed by "###".' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'app_label[.ModelName]' , nargs = '*' , help = 'Restricts dumped data to the specified app_label or app_label.ModelName.' ) parser . add_argument ( '--format' , default = 'json' , dest = 'format' , help = 'Specifies the output serialization format for fixtures.' ) parser . add_argument ( '--indent' , default = None , dest = 'indent' , type = int , help = 'Specifies the indent level to use when pretty-printing output.' ) parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a specific database to dump fixtures from. ' 'Defaults to the "default" database.' ) parser . add_argument ( '-e' , '--exclude' , dest = 'exclude' , action = 'append' , default = [ ] , help = 'An app_label or app_label.ModelName to exclude ' '(use multiple --exclude to exclude multiple apps/models).' ) parser . add_argument ( '-n' , '--natural' , action = 'store_true' , dest = 'use_natural_keys' , default = False , help = 'Use natural keys if they are available (deprecated: use --natural-foreign instead).' ) parser . add_argument ( '--natural-foreign' , action = 'store_true' , dest = 'use_natural_foreign_keys' , default = False , help = 'Use natural foreign keys if they are available.' ) parser . add_argument ( '--natural-primary' , action = 'store_true' , dest = 'use_natural_primary_keys' , default = False , help = 'Use natural primary keys if they are available.' ) parser . add_argument ( '-a' , '--all' , action = 'store_true' , dest = 'use_base_manager' , default = False , help = "Use Django's base manager to dump all models stored in the database, " "including those that would otherwise be filtered or modified by a custom manager." ) parser . add_argument ( '-o' , '--output' , default = None , dest = 'output' , help = 'Specifies file to which the output is written.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to flush. Defaults to the "default" database.' ) parser . add_argument ( '--no-initial-data' , action = 'store_false' , dest = 'load_initial_data' , default = True , help = 'Tells Django not to load any initial data after database synchronization.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to ' 'introspect. Defaults to using the "default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'fixture' , nargs = '+' , help = 'Fixture labels.' ) parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a specific database to load ' 'fixtures into. Defaults to the "default" database.' ) parser . add_argument ( '--app' , action = 'store' , dest = 'app_label' , default = None , help = 'Only look for fixtures in the specified app.' ) parser . add_argument ( '--ignorenonexistent' , '-i' , action = 'store_true' , dest = 'ignore' , default = False , help = 'Ignores entries in the serialized data for fields that do not ' 'currently exist on the model.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--locale' , '-l' , default = [ ] , dest = 'locale' , action = 'append' , help = 'Creates or updates the message files for the given locale(s) (e.g. pt_BR). ' 'Can be used multiple times.' ) parser . add_argument ( '--exclude' , '-x' , default = [ ] , dest = 'exclude' , action = 'append' , help = 'Locales to exclude. Default is none. Can be used multiple times.' ) parser . add_argument ( '--domain' , '-d' , default = 'django' , dest = 'domain' , help = 'The domain of the message files (default: "django").' ) parser . add_argument ( '--all' , '-a' , action = 'store_true' , dest = 'all' , default = False , help = 'Updates the message files for all existing locales.' ) parser . add_argument ( '--extension' , '-e' , dest = 'extensions' , help = 'The file extension(s) to examine (default: "html,txt", or "js" ' 'if the domain is "djangojs"). Separate multiple extensions with ' 'commas, or use -e multiple times.' , action = 'append' ) parser . add_argument ( '--symlinks' , '-s' , action = 'store_true' , dest = 'symlinks' , default = False , help = 'Follows symlinks to directories when examining ' 'source code and templates for translation strings.' ) parser . add_argument ( '--ignore' , '-i' , action = 'append' , dest = 'ignore_patterns' , default = [ ] , metavar = 'PATTERN' , help = 'Ignore files or directories matching this glob-style pattern. ' 'Use multiple times to ignore more.' ) parser . add_argument ( '--no-default-ignore' , action = 'store_false' , dest = 'use_default_ignore_patterns' , default = True , help = "Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'." ) parser . add_argument ( '--no-wrap' , action = 'store_true' , dest = 'no_wrap' , default = False , help = "Don't break long message lines into several lines." ) parser . add_argument ( '--no-location' , action = 'store_true' , dest = 'no_location' , default = False , help = "Don't write '#: filename:line' lines." ) parser . add_argument ( '--no-obsolete' , action = 'store_true' , dest = 'no_obsolete' , default = False , help = "Remove obsolete message strings." ) parser . add_argument ( '--keep-pot' , action = 'store_true' , dest = 'keep_pot' , default = False , help = "Keep .pot file after making messages. Useful when debugging." ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'app_label' , nargs = '*' , help = 'Specify the app label(s) to create migrations for.' ) parser . add_argument ( '--dry-run' , action = 'store_true' , dest = 'dry_run' , default = False , help = "Just show what migrations would be made; don't actually write them." ) parser . add_argument ( '--merge' , action = 'store_true' , dest = 'merge' , default = False , help = "Enable fixing of migration conflicts." ) parser . add_argument ( '--empty' , action = 'store_true' , dest = 'empty' , default = False , help = "Create an empty migration." ) parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'app_label' , nargs = '?' , help = 'App label of an application to synchronize the state.' ) parser . add_argument ( 'migration_name' , nargs = '?' , help = 'Database state will be brought to the state after that migration.' ) parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) parser . add_argument ( '--no-initial-data' , action = 'store_false' , dest = 'load_initial_data' , default = True , help = 'Tells Django not to load any initial data after database synchronization.' ) parser . add_argument ( '--database' , action = 'store' , dest = 'database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to synchronize. ' 'Defaults to the "default" database.' ) parser . add_argument ( '--fake' , action = 'store_true' , dest = 'fake' , default = False , help = 'Mark migrations as run without actually running them' ) parser . add_argument ( '--list' , '-l' , action = 'store_true' , dest = 'list' , default = False , help = 'Show a list of all known migrations and which are applied' ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , nargs = argparse . REMAINDER , help = 'Various KEY=val options.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'addrport' , nargs = '?' , help = 'Optional port number, or ipaddr:port' ) parser . add_argument ( '--ipv6' , '-6' , action = 'store_true' , dest = 'use_ipv6' , default = False , help = 'Tells Django to use an IPv6 address.' ) parser . add_argument ( '--nothreading' , action = 'store_false' , dest = 'use_threading' , default = True , help = 'Tells Django to NOT use threading.' ) parser . add_argument ( '--noreload' , action = 'store_false' , dest = 'use_reloader' , default = True , help = 'Tells Django to NOT use the auto-reloader.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--plain' , action = 'store_true' , dest = 'plain' , help = 'Tells Django to use plain Python, not IPython or bpython.' ) parser . add_argument ( '--no-startup' , action = 'store_true' , dest = 'no_startup' , help = 'When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'app_label' , help = 'App label of the application containing the migration.' ) parser . add_argument ( 'migration_name' , help = 'Migration name to print the SQL for.' ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to create SQL for. Defaults to the ' '"default" database.' ) parser . add_argument ( '--backwards' , action = 'store_true' , dest = 'backwards' , default = False , help = 'Creates SQL to unapply the migration, rather than to apply it' ) def add_arguments ( self , parser ) : super ( Command , self ) . add_arguments ( parser ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to print the SQL for. Defaults to the ' '"default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'app_label' , help = 'App label of the application to squash migrations for.' ) parser . add_argument ( 'migration_name' , help = 'Migrations will be squashed until and including this migration.' ) parser . add_argument ( '--no-optimize' , action = 'store_true' , dest = 'no_optimize' , default = False , help = 'Do not try to optimize the squashed operations.' ) parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) parser . add_argument ( '--no-initial-data' , action = 'store_false' , dest = 'load_initial_data' , default = True , help = 'Tells Django not to load any initial data after database synchronization.' ) parser . add_argument ( '--database' , default = DEFAULT_DB_ALIAS , help = 'Nominates a database to synchronize. Defaults to the "default" database.' ) def add_arguments ( self , parser ) : parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) , parser . add_argument ( '--failfast' , action = 'store_true' , dest = 'failfast' , default = False , help = 'Tells Django to stop running the test suite after first ' 'failed test.' ) , parser . add_argument ( '--testrunner' , action = 'store' , dest = 'testrunner' , help = 'Tells Django to use specified test runner class instead of ' 'the one specified by the TEST_RUNNER setting.' ) , parser . add_argument ( '--liveserver' , action = 'store' , dest = 'liveserver' , default = None , help = 'Overrides the default address where the live server (used ' 'with LiveServerTestCase) is expected to run from. The ' 'default value is localhost:8081.' ) , test_runner_class . add_arguments ( parser ) def add_arguments ( self , parser ) : parser . add_argument ( 'args' , metavar = 'fixture' , nargs = '*' , help = 'Path(s) to fixtures to load before running the server.' ) parser . add_argument ( '--noinput' , action = 'store_false' , dest = 'interactive' , default = True , help = 'Tells Django to NOT prompt the user for input of any kind.' ) parser . add_argument ( '--addrport' , default = '' , help = 'Port number or ipaddr:port to run the server on.' ) parser . add_argument ( '--ipv6' , '-6' , action = 'store_true' , dest = 'use_ipv6' , default = False , help = 'Tells Django to use an IPv6 address.' ) def add_arguments ( self , parser ) : parser . add_argument ( 'name' , help = 'Name of the application or project.' ) parser . add_argument ( 'directory' , nargs = '?' , help = 'Optional destination directory' ) parser . add_argument ( '--template' , help = 'The path or URL to load the template from.' ) parser . add_argument ( '--extension' , '-e' , dest = 'extensions' , action = 'append' , default = [ 'py' ] , help = 'The file extension(s) to render (default: "py"). ' 'Separate multiple extensions with commas, or use ' '-e multiple times.' ) parser . add_argument ( '--name' , '-n' , dest = 'files' , action = 'append' , default = [ ] , help = 'The file name(s) to render. ' 'Separate multiple extensions with commas, or use ' '-n multiple times.' ) parser = self . _parser parser . StartDoctypeDeclHandler = self . start_doctype_decl parser . EntityDeclHandler = self . entity_decl parser . UnparsedEntityDeclHandler = self . unparsed_entity_decl parser . ExternalEntityRefHandler = self . external_entity_ref_handler for item_type , meta_data , field_stream in Parser ( stream , self . _boundary ) : return parser . parse ( ) lexer_class , parser_class = Lexer , Parser parser = parser_class ( lexer . tokenize ( ) ) return parser . parse ( ) def __init__ ( self , token , parser ) : filter_func = parser . find_filter ( filter_name ) def token_kwargs ( bits , parser , support_legacy = False ) : kwargs [ key ] = parser . compile_filter ( value ) def parse_bits ( parser , bits , params , varargs , varkw , defaults , takes_context , name ) : kwarg = token_kwargs ( [ bit ] , parser ) args . append ( parser . compile_filter ( bit ) ) def generic_tag_compiler ( parser , token , params , varargs , varkw , defaults , name , takes_context , node_class ) : def compile_func ( parser , token ) : def autoescape ( parser , token ) : nodelist = parser . parse ( ( 'endautoescape' , ) ) parser . delete_first_token ( ) def comment ( parser , token ) : parser . skip_past ( 'endcomment' ) def cycle ( parser , token ) : if not hasattr ( parser , '_namedCycleNodes' ) : if name not in parser . _namedCycleNodes : return parser . _namedCycleNodes [ name ] values = [ parser . compile_filter ( arg ) for arg in args [ 1 : - 2 ] ] if not hasattr ( parser , '_namedCycleNodes' ) : parser . _namedCycleNodes = { } parser . _namedCycleNodes [ name ] = node values = [ parser . compile_filter ( arg ) for arg in args [ 1 : ] ] def csrf_token ( parser , token ) : def debug ( parser , token ) : def do_filter ( parser , token ) : filter_expr = parser . compile_filter ( "var|%s" % ( rest ) ) nodelist = parser . parse ( ( 'endfilter' , ) ) parser . delete_first_token ( ) def firstof ( parser , token ) : return FirstOfNode ( [ parser . compile_filter ( bit ) for bit in bits ] ) def do_for ( parser , token ) : sequence = parser . compile_filter ( bits [ in_index + 1 ] ) nodelist_loop = parser . parse ( ( 'empty' , 'endfor' , ) ) token = parser . next_token ( ) nodelist_empty = parser . parse ( ( 'endfor' , ) ) parser . delete_first_token ( ) def do_ifequal ( parser , token , negate ) : nodelist_loop = parser . parse ( ( 'else' , end_tag ) ) token = parser . next_token ( ) nodelist_false = parser . parse ( ( end_tag , ) ) parser . delete_first_token ( ) val1 = parser . compile_filter ( bits [ 1 ] ) val2 = parser . compile_filter ( bits [ 2 ] ) def ifequal ( parser , token ) : return do_ifequal ( parser , token , False ) def ifnotequal ( parser , token ) : return do_ifequal ( parser , token , True ) self . template_parser = parser def do_if ( parser , token ) : condition = TemplateIfParser ( parser , bits ) . parse ( ) token = parser . next_token ( ) condition = TemplateIfParser ( parser , bits ) . parse ( ) token = parser . next_token ( ) nodelist = parser . parse ( ( 'endif' , ) ) token = parser . next_token ( ) def ifchanged ( parser , token ) : nodelist_true = parser . parse ( ( 'else' , 'endifchanged' ) ) token = parser . next_token ( ) nodelist_false = parser . parse ( ( 'endifchanged' , ) ) parser . delete_first_token ( ) values = [ parser . compile_filter ( bit ) for bit in bits [ 1 : ] ] def ssi ( parser , token ) : filepath = parser . compile_filter ( bits [ 1 ] ) def load ( parser , token ) : parser . add_library ( temp_lib ) parser . add_library ( lib ) def now ( parser , token ) : def regroup ( parser , token ) : target = parser . compile_filter ( bits [ 1 ] ) expression = parser . compile_filter ( var_name + VARIABLE_ATTRIBUTE_SEPARATOR + bits [ 3 ] ) def spaceless ( parser , token ) : nodelist = parser . parse ( ( 'endspaceless' , ) ) parser . delete_first_token ( ) def templatetag ( parser , token ) : def url ( parser , token ) : viewname = parser . compile_filter ( bits [ 1 ] ) kwargs [ name ] = parser . compile_filter ( value ) args . append ( parser . compile_filter ( value ) ) def verbatim ( parser , token ) : nodelist = parser . parse ( ( 'endverbatim' , ) ) parser . delete_first_token ( ) def widthratio ( parser , token ) : return WidthRatioNode ( parser . compile_filter ( this_value_expr ) , parser . compile_filter ( max_value_expr ) , parser . compile_filter ( max_width ) , asvar = asvar ) def do_with ( parser , token ) : extra_context = token_kwargs ( remaining_bits , parser , support_legacy = True ) nodelist = parser . parse ( ( 'endwith' , ) ) parser . delete_first_token ( ) def do_block ( parser , token ) : if block_name in parser . __loaded_blocks : parser . __loaded_blocks . append ( block_name ) parser . __loaded_blocks = [ block_name ] nodelist = parser . parse ( ( 'endblock' , ) ) endblock = parser . next_token ( ) def do_extends ( parser , token ) : parent_name = parser . compile_filter ( bits [ 1 ] ) nodelist = parser . parse ( ) def do_include ( parser , token ) : value = token_kwargs ( remaining_bits , parser , support_legacy = False ) def nud ( self , parser ) : def led ( self , left , parser ) : def led ( self , left , parser ) : self . second = parser . expression ( bp ) def nud ( self , parser ) : self . first = parser . expression ( bp ) def nud ( self , parser ) : def nud ( self , parser ) :