def parse_args_and_create_context(self, args):
        """
        Helper method that will parse the args into options and
        remaining args as well as create an initial
        :py:class:`swiftly.cli.context.CLIContext`.

        The new context will be a copy of
        :py:attr:`swiftly.cli.cli.CLI.context` with the following
        attributes added:

        =======================  ===================================
        muted_account_headers    The headers to omit when outputting
                                 account headers.
        muted_container_headers  The headers to omit when outputting
                                 container headers.
        muted_object_headers     The headers to omit when outputting
                                 object headers.
        =======================  ===================================

        :returns: options, args, context
        """
        original_args = args
        try:
            options, args = self.option_parser.parse_args(args)
        except UnboundLocalError:
            # Happens sometimes with an error handler that doesn't raise its
            # own exception. We'll catch the error below with
            # error_encountered.
            pass
        if self.option_parser.error_encountered:
            if '-?' in original_args or '-h' in original_args or \
                    '--help' in original_args:
                self.option_parser.print_help()
            raise ReturnCode()
        if options.help:
            self.option_parser.print_help()
            raise ReturnCode()
        if self.min_args is not None and len(args) < self.min_args:
            raise ReturnCode(
                'requires at least %s args.' % self.min_args)
        if self.max_args is not None and len(args) > self.max_args:
            raise ReturnCode(
                'requires no more than %s args.' % self.max_args)
        context = self.cli.context.copy()
        context.muted_account_headers = [
            'accept-ranges', 'content-length', 'content-type', 'date']
        context.muted_container_headers = [
            'accept-ranges', 'content-length', 'content-type', 'date']
        context.muted_object_headers = ['accept-ranges', 'date']
        return options, args, context
def parse_args_and_create_context(self, args):
        """
        Helper method that will parse the args into options and
        remaining args as well as create an initial
        :py:class:`swiftly.cli.context.CLIContext`.

        The new context will be a copy of
        :py:attr:`swiftly.cli.cli.CLI.context` with the following
        attributes added:

        =======================  ===================================
        muted_account_headers    The headers to omit when outputting
                                 account headers.
        muted_container_headers  The headers to omit when outputting
                                 container headers.
        muted_object_headers     The headers to omit when outputting
                                 object headers.
        =======================  ===================================

        :returns: options, args, context
        """
        original_args = args
        try:
            options, args = self.option_parser.parse_args(args)
        except UnboundLocalError:
            # Happens sometimes with an error handler that doesn't raise its
            # own exception. We'll catch the error below with
            # error_encountered.
            pass
        if self.option_parser.error_encountered:
            if '-?' in original_args or '-h' in original_args or \
                    '--help' in original_args:
                self.option_parser.print_help()
            raise ReturnCode()
        if options.help:
            self.option_parser.print_help()
            raise ReturnCode()
        if self.min_args is not None and len(args) < self.min_args:
            raise ReturnCode(
                'requires at least %s args.' % self.min_args)
        if self.max_args is not None and len(args) > self.max_args:
            raise ReturnCode(
                'requires no more than %s args.' % self.max_args)
        context = self.cli.context.copy()
        context.muted_account_headers = [
            'accept-ranges', 'content-length', 'content-type', 'date']
        context.muted_container_headers = [
            'accept-ranges', 'content-length', 'content-type', 'date']
        context.muted_object_headers = ['accept-ranges', 'date']
        return options, args, context
def parse_args_and_create_context ( self , args ) : original_args = args try : options , args = self . option_parser . parse_args ( args ) except UnboundLocalError : # Happens sometimes with an error handler that doesn't raise its # own exception. We'll catch the error below with # error_encountered. pass if self . option_parser . error_encountered : if '-?' in original_args or '-h' in original_args or '--help' in original_args : self . option_parser . print_help ( ) raise ReturnCode ( ) if options . help : self . option_parser . print_help ( ) raise ReturnCode ( ) if self . min_args is not None and len ( args ) < self . min_args : raise ReturnCode ( 'requires at least %s args.' % self . min_args ) if self . max_args is not None and len ( args ) > self . max_args : raise ReturnCode ( 'requires no more than %s args.' % self . max_args ) context = self . cli . context . copy ( ) context . muted_account_headers = [ 'accept-ranges' , 'content-length' , 'content-type' , 'date' ] context . muted_container_headers = [ 'accept-ranges' , 'content-length' , 'content-type' , 'date' ] context . muted_object_headers = [ 'accept-ranges' , 'date' ] return options , args , context
Helper method that will parse the args into options and
        remaining args as well as create an initial
        :py:class:`swiftly.cli.context.CLIContext`.

        The new context will be a copy of
        :py:attr:`swiftly.cli.cli.CLI.context` with the following
        attributes added:

        =======================  ===================================
        muted_account_headers    The headers to omit when outputting
                                 account headers.
        muted_container_headers  The headers to omit when outputting
                                 container headers.
        muted_object_headers     The headers to omit when outputting
                                 object headers.
        =======================  ===================================

        :returns: options, args, context
Helper method that will parse the args into options and remaining args as well as create an initial : py : class : swiftly . cli . context . CLIContext .