コード例 #1
0
 def _store_generate_builtins(self, generate_builtins):
     """Store the generate-builtins option."""
     if generate_builtins:
         if self.input:
             raise optparse.OptionConflictError(
                 "Not allowed with an input file", "generate-builtins")
         if self.pythonpath != [""]:
             raise optparse.OptionConflictError(
                 "Not allowed with --pythonpath", "generate-builtins")
         # Set the default pythonpath to [] rather than [""]
         self.pythonpath = []
     elif not self.input and not self.show_config:
         raise optparse.OptParseError("Need a filename.")
     self.generate_builtins = generate_builtins
コード例 #2
0
ファイル: config.py プロジェクト: yangjianxiang/pytype
 def _store_generate_builtins(self, generate_builtins):
     if generate_builtins:
         if self.input:
             raise optparse.OptionConflictError(
                 "Not allowed with an input file", "generate-builtins")
     elif not self.input and not self.show_config:
         raise optparse.OptParseError("Need a filename.")
     self.generate_builtins = generate_builtins
コード例 #3
0
ファイル: config.py プロジェクト: yangjianxiang/pytype
 def _store_check(self, check):
     if check is None:
         self.check = not self.output
     elif self.output:
         raise optparse.OptionConflictError(
             "Not allowed with an output file", "check")
     else:
         self.check = check
コード例 #4
0
ファイル: config.py プロジェクト: yangjianxiang/pytype
    def _store_imports_map(self, imports_map):
        """Postprocess --imports_info."""
        if imports_map:
            if self.pythonpath not in ([], [""]):
                raise optparse.OptionConflictError(
                    "Not allowed with --pythonpath", "imports_info")

            self.imports_map = imports_map_loader.build_imports_map(
                imports_map, self.output)
        else:
            self.imports_map = None
コード例 #5
0
def parse_option():
    try:
        (options, args) = _parser.parse_args()
        name = options.name
        client_address = options.address
        if not name or not client_address:
            raise optparse.OptionConflictError('', '')
        _variable['task'] = name
        _variable['address_file'] = client_address

    except optparse.OptionConflictError:
        _parser.print_help()
コード例 #6
0
ファイル: optparseex.py プロジェクト: yEsPaP/CodeSigner
    def _check_conflict(self, option):
        conflict_opts = []
        for opt in option._long_opts:
            if opt in self._long_opt:
                conflict_opts.append((opt, self._long_opt[opt]))

        if conflict_opts:
            handler = self.conflict_handler
            if handler == 'error':
                msg = 'conflicting option string(s): %s'
                msg %= ', '.join([co[0] for co in conflict_opts])
                raise optparse.OptionConflictError(msg, option)
            elif handler == 'resolve':
                for opt, c_option in conflict_opts:
                    if opt.startswith('-'):
                        c_option._long_opts.remove(opt)
                        del self._long_opt[opt]
コード例 #7
0
ファイル: config.py プロジェクト: gvanrossum/pytype
 def _store_output_errors_csv(self, output_errors_csv):
     if output_errors_csv and not self.report_errors:
         raise optparse.OptionConflictError(
             "Not allowed with --no-report-errors", "output-errors-csv")
     self.output_errors_csv = output_errors_csv
コード例 #8
0
ファイル: config.py プロジェクト: yangjianxiang/pytype
 def _store_output_typegraph(self, output_typegraph):
     if self.output_cfg and output_typegraph:
         raise optparse.OptionConflictError(
             "Can output CFG or typegraph, but not both",
             "output-typegraph")
     self.output_typegraph = output_typegraph
コード例 #9
0
ファイル: config.py プロジェクト: yangjianxiang/pytype
 def _store_output_pickled(self, filename):
     if filename is not None and self.output is None:
         raise optparse.OptionConflictError("Can't use without --output",
                                            "output_pickled")
     self.output_pickled = filename