• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(83)  |  Call(26)  |  Derive(3)  |  Import(54)
Raised if an Option instance is created with invalid or
inconsistent arguments.

src/z/a/zamboni-lib-HEAD/lib/python/logilab/common/optik_ext.py   zamboni-lib(Download)
from os.path import exists
 
# python >= 2.3
from optparse import OptionParser as BaseParser, Option as BaseOption, \
     OptionGroup, OptionContainer, OptionValueError, OptionError, \
     Values, HelpFormatter, NO_DEFAULT, SUPPRESS_HELP
 
    def _check_choice(self):
        """FIXME: need to override this due to optik misdesign"""
        if self.type in ("choice", "multiple_choice"):
            if self.choices is None:
                raise OptionError(
                    "must supply a list of choices for type 'choice'", self)
            elif type(self.choices) not in (types.TupleType, types.ListType):
                raise OptionError(
                    "choices must be a list of strings ('%s' supplied)"
                    % str(type(self.choices)).split("'")[1], self)
        elif self.choices is not None:
            raise OptionError(
                "must not supply choices for type %r" % self.type, self)

src/l/o/logilab-common-0.52.0/optik_ext.py   logilab-common(Download)
from os.path import exists
 
# python >= 2.3
from optparse import OptionParser as BaseParser, Option as BaseOption, \
     OptionGroup, OptionContainer, OptionValueError, OptionError, \
     Values, HelpFormatter, NO_DEFAULT, SUPPRESS_HELP
 
    def _check_choice(self):
        """FIXME: need to override this due to optik misdesign"""
        if self.type in ("choice", "multiple_choice"):
            if self.choices is None:
                raise OptionError(
                    "must supply a list of choices for type 'choice'", self)
            elif type(self.choices) not in (types.TupleType, types.ListType):
                raise OptionError(
                    "choices must be a list of strings ('%s' supplied)"
                    % str(type(self.choices)).split("'")[1], self)
        elif self.choices is not None:
            raise OptionError(
                "must not supply choices for type %r" % self.type, self)

src/c/u/cutplace-HEAD/trunk/cutplace/_cutplace.py   cutplace(Download)
class _ExitQuietlyOptionError(optparse.OptionError):
    """
    Pseudo error to indicate the program should exit quietly, for example when --help or --verbose
    was specified.
    """
    pass
 
class _NoExitOptionParser(optparse.OptionParser):
    def exit(self, status=0, msg=None):
        if status:
            raise optparse.OptionError(msg, "")
    def error(self, msg):
        raise optparse.OptionError(msg, "")
 
    def print_version(self, file=None):
        # No super() due to old style class.
        optparse.OptionParser.print_version(self, file)
        if self.version:

src/c/u/cutplace-HEAD/cutplace/_cutplace.py   cutplace(Download)
class _ExitQuietlyOptionError(optparse.OptionError):
    """
    Pseudo error to indicate the program should exit quietly, for example when --help or --verbose
    was specified.
    """
    pass
 
class _NoExitOptionParser(optparse.OptionParser):
    def exit(self, status=0, msg=None):
        if status:
            raise optparse.OptionError(msg, "")
    def error(self, msg):
        raise optparse.OptionError(msg, "")
 
    def print_version(self, file=None):
        # No super() due to old style class.
        optparse.OptionParser.print_version(self, file)
        if self.version:

src/c/u/cutplace-0.6.2/cutplace/_cutplace.py   cutplace(Download)
class _ExitQuietlyOptionError(optparse.OptionError):
    """
    Pseudo error to indicate the program should exit quietly, for example when --help or --verbose
    was specified.
    """
    pass
 
class _NoExitOptionParser(optparse.OptionParser):
    def exit(self, status=0, msg=None):
        if status:
            raise optparse.OptionError(msg, "")
    def error(self, msg):
        raise optparse.OptionError(msg, "")
 
    def print_version(self, file=None):
        # No super() due to old style class.
        optparse.OptionParser.print_version(self, file)
        if self.version:

src/s/u/Sunflower-1.1.0/sunflower/_optparse.py   Sunflower(Download)
# Copyright 2007 Michael M. Hoffman <hoffman+software@ebi.ac.uk>
 
from collections import defaultdict
from optparse import (Option as _Option, OptionError,
                      OptionGroup as _OptionGroup,
                      OptionParser as _OptionParser, OptionValueError)
import sys
    def _check_const(self):
        if self.action not in self.CONST_ACTIONS and self.const is not None:
            msg = "'const' must not be supplied for action %r" % self.action
            raise OptionError(msg, self)
 
    def _check_nargs(self):
        nargs_limit = self.NARGS_SPECIFIED_ACTIONS[self.action]
        elif self.nargs != nargs_limit:
            msg = "'nargs' must be %d for action %r" % (nargs_limit,
                                                        self.action)
            raise OptionError(msg, self)
 
    CHECK_METHODS = [_Option._check_action,
                     _Option._check_type,

src/c/d/cdent-0.5.7/cdent/command.py   cdent(Download)
        def cb_in(option, opt, value, oparser):
            if not os.path.exists(value):
                raise optparse.OptionError(value + ' file does not exist', opt)
            self.in_ = file(value, 'r')
            m = re.match(r'.*?\.((?:\cd?\.)?\w+)$', value)
            if m:
                optparser.rargs.append('--from=' + m.groups()[0])
        def cb_from(option, opt, value, oparser):
            if self.action != 'compile':
                raise optparse.OptionError('--from used before --compile')
            class_ = cdent.compiler.class_(value)
            exec(
                "from cdent.parser." +
                class_ +
        def cb_to(option, opt, value, oparser):
            if self.action != 'compile':
                raise optparse.OptionError('--to used before --compile')
            class_ = cdent.compiler.class_(value)
            exec "from cdent.emitter." + class_ + " import Emitter" in globals()
            self.emitter = Emitter()
            self.to = value
        # validate options
        try:
            if (args):
                raise optparse.OptionError('extra arguments found', args)
            if (not self.action):
                raise optparse.OptionError(
                    'is required',
                    '--compile | --help | --version'
                )
            if self.action == 'compile':
                if (not self.from_):
                    raise optparse.OptionError('is required', '--from')
                if (not self.to):
                    raise optparse.OptionError('is required', '--to')

src/o/p/optplus-0.1.1/optplus/__init__.py   optplus(Download)
# Copyright 2007-2009 Michael M. Hoffman <hoffman+software@ebi.ac.uk>
 
from collections import defaultdict
from optparse import (Option as _Option, OptionError,
                      OptionGroup as _OptionGroup,
                      OptionParser as _OptionParser, OptionValueError)
import sys
    def _check_const(self):
        if self.action not in self.CONST_ACTIONS and self.const is not None:
            msg = "'const' must not be supplied for action %r" % self.action
            raise OptionError(msg, self)
 
    def _check_nargs(self):
        nargs_limit = self.NARGS_SPECIFIED_ACTIONS[self.action]
        elif self.nargs != nargs_limit:
            msg = "'nargs' must be %d for action %r" % (nargs_limit,
                                                        self.action)
            raise OptionError(msg, self)
 
    CHECK_METHODS = [_Option._check_action,
                     _Option._check_type,

src/c/c/cctagutils-0.5a2/cctagutils/cli.py   cctagutils(Download)
    def _check_required (self):
        if self.required and not self.takes_value():
            raise optparse.OptionError(
                "required flag set for option that doesn't take a value",
                 self)
 
    # Make sure _check_required() is called from the constructor!

src/p/y/pybloglines-HEAD/bloglines/settings.py   pybloglines(Download)
  from cStringIO import StringIO
except:
  from StringIO import StringIO
from optparse import OptionParser, OptionError
 
__copyright___ = """
  Copyright 2008 Andrew Robinson <arobinson74@users.sourceforge.net>
      d = self.validateSetting(opt.dest, self.get(opt.dest))
      if not d['valid']:
        if raiseError:
          raise OptionError(d['msg'], \
            '--' + opt.dest.replace('_', '-'))
        else:
          errors[opt.dest] = d['msg']

  1 | 2 | 3 | 4 | 5 | 6  Next