perceval/backend.py
def parse(self, *args):
        """Parse a list of arguments.

        Parse argument strings needed to run a backend command. The result
        will be a `argparse.Namespace` object populated with the values
        obtained after the validation of the parameters.

        :param args: argument strings

        :result: an object with the parsed values
        """
        parsed_args = self.parser.parse_args(args)

        # Category was not set, remove it
        if parsed_args.category is None:
            delattr(parsed_args, 'category')

        if self._from_date:
            parsed_args.from_date = str_to_datetime(parsed_args.from_date)
        if self._to_date and parsed_args.to_date:
            parsed_args.to_date = str_to_datetime(parsed_args.to_date)
        if self._archive and parsed_args.archived_since:
            parsed_args.archived_since = str_to_datetime(parsed_args.archived_since)

        if self._archive and parsed_args.fetch_archive and parsed_args.no_archive:
            raise AttributeError("fetch-archive and no-archive arguments are not compatible")
        if self._archive and parsed_args.fetch_archive and not parsed_args.category:
            raise AttributeError("fetch-archive needs a category to work with")

        # Set aliases
        for alias, arg in self.aliases.items():
            if (alias not in parsed_args) and (arg in parsed_args):
                value = getattr(parsed_args, arg, None)
                setattr(parsed_args, alias, value)

        return parsed_args
def parse(self, *args):
        parsed_args = self.parser.parse_args(args)

        # Category was not set, remove it
        if parsed_args.category is None:
            delattr(parsed_args, 'category')

        if self._from_date:
            parsed_args.from_date = str_to_datetime(parsed_args.from_date)
        if self._to_date and parsed_args.to_date:
            parsed_args.to_date = str_to_datetime(parsed_args.to_date)
        if self._archive and parsed_args.archived_since:
            parsed_args.archived_since = str_to_datetime(parsed_args.archived_since)

        if self._archive and parsed_args.fetch_archive and parsed_args.no_archive:
            raise AttributeError("fetch-archive and no-archive arguments are not compatible")
        if self._archive and parsed_args.fetch_archive and not parsed_args.category:
            raise AttributeError("fetch-archive needs a category to work with")

        # Set aliases
        for alias, arg in self.aliases.items():
            if (alias not in parsed_args) and (arg in parsed_args):
                value = getattr(parsed_args, arg, None)
                setattr(parsed_args, alias, value)

        return parsed_args
def parse ( self , * args ) : parsed_args = self . parser . parse_args ( args ) # Category was not set, remove it if parsed_args . category is None : delattr ( parsed_args , 'category' ) if self . _from_date : parsed_args . from_date = str_to_datetime ( parsed_args . from_date ) if self . _to_date and parsed_args . to_date : parsed_args . to_date = str_to_datetime ( parsed_args . to_date ) if self . _archive and parsed_args . archived_since : parsed_args . archived_since = str_to_datetime ( parsed_args . archived_since ) if self . _archive and parsed_args . fetch_archive and parsed_args . no_archive : raise AttributeError ( "fetch-archive and no-archive arguments are not compatible" ) if self . _archive and parsed_args . fetch_archive and not parsed_args . category : raise AttributeError ( "fetch-archive needs a category to work with" ) # Set aliases for alias , arg in self . aliases . items ( ) : if ( alias not in parsed_args ) and ( arg in parsed_args ) : value = getattr ( parsed_args , arg , None ) setattr ( parsed_args , alias , value ) return parsed_args
Parse a list of arguments.

        Parse argument strings needed to run a backend command. The result
        will be a `argparse.Namespace` object populated with the values
        obtained after the validation of the parameters.

        :param args: argument strings

        :result: an object with the parsed values
Parse a list of arguments .