Python optparse.IndentedHelpFormatter() Examples

The following are 30 code examples of optparse.IndentedHelpFormatter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module optparse , or try the search function .
Example #1
Source File: __init__.py    From scylla with Apache License 2.0 6 votes vote down vote up
def cmd_install_module(params):
    formatter = optparse.IndentedHelpFormatter()
    formatter.set_long_opt_delimiter(' ')

    usage = '%prog install-module [options]'
    parser = optparse.OptionParser(usage=usage, formatter=formatter)

    parser.add_option('--modules-directory', metavar='DIRECTORY',
            default=apxs_config.LIBEXECDIR)

    (options, args) = parser.parse_args(params)

    if len(args) != 0:
        parser.error('Incorrect number of arguments.')

    target = os.path.abspath(os.path.join(options.modules_directory,
            os.path.basename(MOD_WSGI_SO)))

    shutil.copyfile(where(), target)

    if _py_dylib:
        print('LoadFile "%s"' % _py_dylib)
    print('LoadModule wsgi_module "%s"' % target)
    print('WSGIPythonHome "%s"' % os.path.normpath(sys.prefix)) 
Example #2
Source File: git_p4.py    From python-zulip-api with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        optparse.IndentedHelpFormatter.__init__(self) 
Example #3
Source File: parser.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #4
Source File: baseparser.py    From Flask-P2P with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #5
Source File: parser.py    From rules_pip with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #6
Source File: util.py    From OpenXMolar with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, banner, *argv, **argd):
        self.banner = banner
        optparse.IndentedHelpFormatter.__init__(self, *argv, **argd) 
Example #7
Source File: parser.py    From rules_pip with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #8
Source File: baseparser.py    From planespotter with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #9
Source File: parser.py    From Weapon-Detection-And-Classification with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #10
Source File: parser.py    From Weapon-Detection-And-Classification with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #11
Source File: baseparser.py    From Flask-P2P with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #12
Source File: baseparser.py    From planespotter with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #13
Source File: baseparser.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #14
Source File: baseparser.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #15
Source File: parser.py    From scylla with Apache License 2.0 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #16
Source File: __init__.py    From scylla with Apache License 2.0 5 votes vote down vote up
def cmd_module_location(params):
    formatter = optparse.IndentedHelpFormatter()
    formatter.set_long_opt_delimiter(' ')

    usage = '%prog module-location'
    parser = optparse.OptionParser(usage=usage, formatter=formatter)

    (options, args) = parser.parse_args(params)

    if len(args) != 0:
        parser.error('Incorrect number of arguments.')

    print(where()) 
Example #17
Source File: __init__.py    From scylla with Apache License 2.0 5 votes vote down vote up
def cmd_start_server(params):
    formatter = optparse.IndentedHelpFormatter()
    formatter.set_long_opt_delimiter(' ')

    usage = '%prog start-server script [options]'
    parser = optparse.OptionParser(usage=usage, option_list=option_list,
            formatter=formatter)

    (options, args) = parser.parse_args(params)

    config = _cmd_setup_server('start-server', args, vars(options))

    if config['setup_only']:
        return

    executable = os.path.join(config['server_root'], 'apachectl')

    if config['isatty'] and sys.stdout.isatty():
        process = None

        def handler(signum, frame):
            if process is None:
                sys.exit(1)

            else:
                if signum not in [signal.SIGWINCH]:
                    os.kill(process.pid, signum)

        signal.signal(signal.SIGINT, handler)
        signal.signal(signal.SIGTERM, handler)
        signal.signal(signal.SIGHUP, handler)
        signal.signal(signal.SIGUSR1, handler)
        signal.signal(signal.SIGWINCH, handler)

        process = subprocess.Popen([executable, 'start', '-DFOREGROUND'],
                preexec_fn=os.setpgrp)

        process.wait()

    else:
        os.execl(executable, executable, 'start', '-DFOREGROUND') 
Example #18
Source File: __init__.py    From scylla with Apache License 2.0 5 votes vote down vote up
def cmd_setup_server(params):
    formatter = optparse.IndentedHelpFormatter()
    formatter.set_long_opt_delimiter(' ')

    usage = '%prog setup-server script [options]'
    parser = optparse.OptionParser(usage=usage, option_list=option_list,
            formatter=formatter)

    (options, args) = parser.parse_args(params)

    _cmd_setup_server('setup-server', args, vars(options)) 
Example #19
Source File: parser.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #20
Source File: parser.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #21
Source File: parser.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #22
Source File: parser.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #23
Source File: parser.py    From pySINDy with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #24
Source File: parser.py    From pySINDy with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #25
Source File: baseparser.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #26
Source File: baseparser.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #27
Source File: baseparser.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #28
Source File: baseparser.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
Example #29
Source File: baseparser.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
Example #30
Source File: baseparser.py    From recruit with Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs)