Inheritance diagram for IPython.config.loader:
A simple configuration system.
Bases: IPython.config.loader.CommandLineConfigLoader
A loader that uses the argparse module to load from the command line.
Create a config loader for use with argparse.
Parameters : | argv : optional, list
parser_args : tuple
parser_kw : dict
|
---|---|
Returns : | config : Config
|
Parse command line arguments and return as a Config object.
Parameters : | args : optional, list
|
---|
Bases: IPython.config.loader.ConfigLoaderError
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: argparse.ArgumentParser
Simple argparse subclass that prints help to stdout by default.
Prints a usage message incorporating the message to stderr and exits.
If you override this in a subclass, it should not return – it should either exit or raise an exception.
Bases: IPython.config.loader.ConfigLoader
A config loader for command line arguments.
As we add more command line based loaders, the common logic should go here.
A base class for config loaders.
Examples
>>> cl = ConfigLoader()
>>> config = cl.load_config()
>>> config
{}
Load a config from somewhere, return a Config instance.
Usually, this will cause self.config to be set and then returned. However, in most cases, ConfigLoader.clear() should be called to erase any previous state.
Bases: dict
An attribute based dict that can do smart merges.
D.clear() -> None. Remove all items from D.
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
D.items() -> list of D’s (key, value) pairs, as 2-tuples
D.iteritems() -> an iterator over the (key, value) items of D
D.iterkeys() -> an iterator over the keys of D
D.itervalues() -> an iterator over the values of D
D.keys() -> list of D’s keys
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
D.values() -> list of D’s values
D.viewitems() -> a set-like object providing a view on D’s items
D.viewkeys() -> a set-like object providing a view on D’s keys
D.viewvalues() -> an object providing a view on D’s values
Bases: IPython.config.loader.ConfigError
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: object
A object for loading configurations from just about anywhere.
The resulting configuration is packaged as a Struct.
Notes
A ConfigLoader does one thing: load a config from a source (file, command line arguments) and returns the data as a Struct. There are lots of things that ConfigLoader does not do. It does not implement complex logic for finding config files. It does not handle default values or merge multiple configs. These things need to be handled elsewhere.
A base class for config loaders.
Examples
>>> cl = ConfigLoader()
>>> config = cl.load_config()
>>> config
{}
Load a config from somewhere, return a Config instance.
Usually, this will cause self.config to be set and then returned. However, in most cases, ConfigLoader.clear() should be called to erase any previous state.
Bases: IPython.config.loader.ConfigError
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: IPython.config.loader.ConfigLoader
A base class for file based configurations.
As we add more file based config loaders, the common logic should go here.
A base class for config loaders.
Examples
>>> cl = ConfigLoader()
>>> config = cl.load_config()
>>> config
{}
Load a config from somewhere, return a Config instance.
Usually, this will cause self.config to be set and then returned. However, in most cases, ConfigLoader.clear() should be called to erase any previous state.
Bases: IPython.config.loader.ArgParseConfigLoader
A config loader that loads aliases and flags with argparse, but will use KVLoader for the rest. This allows better parsing of common args, such as ipython -c ‘print 5’, but still gets arbitrary config with ipython –InteractiveShell.use_readline=False
Create a config loader for use with argparse.
Parameters : | argv : optional, list
parser_args : tuple
parser_kw : dict
|
---|---|
Returns : | config : Config
|
Parse command line arguments and return as a Config object.
Parameters : | args : optional, list
|
---|
Bases: IPython.config.loader.CommandLineConfigLoader
A config loader that loads key value pairs from the command line.
This allows command line options to be gives in the following form:
ipython --profile="foo" --InteractiveShell.autocall=False
Create a key value pair config loader.
Parameters : | argv : list
aliases : dict
flags : dict
|
---|---|
Returns : | config : Config
|
Examples
>>> from IPython.config.loader import KeyValueConfigLoader
>>> cl = KeyValueConfigLoader()
>>> cl.load_config(["--A.name='brian'","--B.number=0"])
{'A': {'name': 'brian'}, 'B': {'number': 0}}
Parse the configuration and generate the Config object.
After loading, any arguments that are not key-value or flags will be stored in self.extra_args - a list of unparsed command-line arguments. This is used for arguments such as input files or subcommands.
Parameters : | argv : list, optional
aliases : dict
flags : dict
|
---|
Bases: IPython.config.loader.FileConfigLoader
A config loader for pure python files.
This calls execfile on a plain python file and looks for attributes that are all caps. These attribute are added to the config Struct.
Build a config loader for a filename and path.
Parameters : | filename : str
path : str, list, tuple
|
---|
Load the config from a file and return it as a Struct.