Did I find the right examples for you? yes no

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)
Parses a configuration file.

Parameters
----------
filename : str, optional, default: None
    If a filename is provided, reads the configuration file, and returns
    the options. If None, returns the default options.

Returns
-------(more...)

        def parse(filename=None):
    """
    Parses a configuration file.

    Parameters
    ----------
    filename : str, optional, default: None
        If a filename is provided, reads the configuration file, and returns
        the options. If None, returns the default options.

    Returns
    -------
    options : dict
    """
    options = get_default_options()
    if filename is None:
        return options

    if not os.path.exists(filename):
        raise IOError("File %s doesn't existe" % filename)

    config = ConfigParser.ConfigParser()
    config.readfp(open(filename))
    for key in options.iterkeys():
        try:
            options[key] = type(options[key])(
                config.get("all", key))
        except ConfigParser.NoOptionError:
            pass
    return options
        


src/p/a/pastis-0.0/pastis/algorithms.py   pastis(Download)
 
from . import write
from .config import parse
 
 
        config_file = None
 
    options = parse(config_file)
 
    random_state = np.random.RandomState(seed=options["seed"])
        config_file = None
 
    options = parse(config_file)
    run_mds(directory)
 
        config_file = None
 
    options = parse(config_file)
    run_mds(directory)
    shutil.copy(
        config_file = None
 
    options = parse(config_file)
    alpha, beta = options["alpha"], options["beta"]
    run_mds(directory)

src/p/k/pkglib-HEAD/pkglib/pkglib/manage.py   pkglib(Download)
 
from pkglib import CONFIG
from config import parse
import util
import pyenv