Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(19)  |  Call(11)  |  Derive(0)  |  Import(8)
Augments the parser with option to set value for the list of variables.
    

        def vars_to_optparser(variables, parser=None):
    """Augments the parser with option to set value for the list of variables.
    """
    if parser is None:
        parser = optparse.OptionParser()

    for var in variables:
        if not VALID_OPTION_NAME.match(var.name):
            continue
        parser.add_option(
            "--%s" % var.name.lower().replace('_', '-'),
            dest=var.name,
            help=var.full_description,
            metavar=var.name.split('_')[-1].upper())
    return parser
        


src/p/y/PySeqsee-0.1.2/farg/third_party/skeleton/core.py   PySeqsee(Download)
import weakref
 
from skeleton.utils import (
    get_loggger, get_file_mode, vars_to_optparser, prompt)
 
        parser.set_default('verbose_', logging.ERROR)
 
        parser = vars_to_optparser(self.variables, parser=parser)
        return parser
 

src/s/k/skeleton_stu-0.6.3/skeleton/core.py   skeleton_stu(Download)
import weakref
 
from skeleton.utils import (
    get_loggger, get_file_mode, vars_to_optparser, prompt)
 
        parser.set_default('verbose_', logging.ERROR)
 
        parser = vars_to_optparser(self.variables, parser=parser)
        return parser
 

src/s/k/skeleton-0.6/skeleton/core.py   skeleton(Download)
import weakref
 
from skeleton.utils import (
    get_loggger, get_file_mode, vars_to_optparser, prompt)
 
        parser.set_default('verbose_', logging.ERROR)
 
        parser = vars_to_optparser(self.variables, parser=parser)
        return parser
 

src/p/y/PySeqsee-HEAD/farg/third_party/skeleton/core.py   PySeqsee(Download)
import weakref
 
from skeleton.utils import (
    get_loggger, get_file_mode, vars_to_optparser, prompt)
 
        parser.set_default('verbose_', logging.ERROR)
 
        parser = vars_to_optparser(self.variables, parser=parser)
        return parser
 

src/s/k/skeleton-HEAD/skeleton/core.py   skeleton(Download)
import weakref
 
from skeleton.utils import (
    get_loggger, get_file_mode, vars_to_optparser, prompt)
 
        parser.set_default('verbose_', logging.ERROR)
 
        parser = vars_to_optparser(self.variables, parser=parser)
        return parser
 

src/s/k/skeleton_stu-0.6.3/skeleton/tests/test_utils.py   skeleton_stu(Download)
from skeleton.core import Var
from skeleton.tests.utils import TestCase, TempDir
from skeleton.utils import insert_into_file, vars_to_optparser
 
 
 
        """
        parser = vars_to_optparser([Var('Foo'), Var('foo_bar')])
        self.assertEqual(parser.get_option('--foo').dest, 'Foo')
        self.assertEqual(parser.get_option('--foo-bar').dest, 'foo_bar')
 
    def test_default_metavar(self):
        """Tests option's metavar"""
        parser = vars_to_optparser([Var('Foo'), Var('bar_name')])

src/s/k/skeleton-0.6/skeleton/tests/test_utils.py   skeleton(Download)
from skeleton.core import Var
from skeleton.tests.utils import TestCase, TempDir
from skeleton.utils import insert_into_file, vars_to_optparser
 
 
 
        """
        parser = vars_to_optparser([Var('Foo'), Var('foo_bar')])
        self.assertEqual(parser.get_option('--foo').dest, 'Foo')
        self.assertEqual(parser.get_option('--foo-bar').dest, 'foo_bar')
 
    def test_default_metavar(self):
        """Tests option's metavar"""
        parser = vars_to_optparser([Var('Foo'), Var('bar_name')])

src/s/k/skeleton-HEAD/skeleton/tests/test_utils.py   skeleton(Download)
from skeleton.core import Var
from skeleton.tests.utils import TestCase, TempDir
from skeleton.utils import insert_into_file, vars_to_optparser
 
 
 
        """
        parser = vars_to_optparser([Var('Foo'), Var('foo_bar')])
        self.assertEqual(parser.get_option('--foo').dest, 'Foo')
        self.assertEqual(parser.get_option('--foo-bar').dest, 'foo_bar')
 
    def test_default_metavar(self):
        """Tests option's metavar"""
        parser = vars_to_optparser([Var('Foo'), Var('bar_name')])