Show More
@@ -1,1 +1,5 b'' | |||||
|
1 | # FIXME: import IPython first, to avoid circular imports | |||
|
2 | # this shouldn't be needed after finishing the big split | |||
|
3 | import IPython | |||
|
4 | ||||
1 | from .traitlets import * |
|
5 | from .traitlets import * |
@@ -16,12 +16,12 b' from collections import defaultdict' | |||||
16 |
|
16 | |||
17 | from decorator import decorator |
|
17 | from decorator import decorator | |
18 |
|
18 | |||
19 |
from |
|
19 | from traitlets.config.configurable import SingletonConfigurable | |
20 |
from |
|
20 | from traitlets.config.loader import ( | |
21 | KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, JSONFileConfigLoader |
|
21 | KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, JSONFileConfigLoader | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
24 |
from |
|
24 | from traitlets.traitlets import ( | |
25 | Unicode, List, Enum, Dict, Instance, TraitError |
|
25 | Unicode, List, Enum, Dict, Instance, TraitError | |
26 | ) |
|
26 | ) | |
27 | from IPython.utils.importstring import import_item |
|
27 | from IPython.utils.importstring import import_item | |
@@ -227,7 +227,7 b' class Application(SingletonConfigurable):' | |||||
227 | # and the second being the help string for the subcommand |
|
227 | # and the second being the help string for the subcommand | |
228 | subcommands = Dict() |
|
228 | subcommands = Dict() | |
229 | # parse_command_line will initialize a subapp, if requested |
|
229 | # parse_command_line will initialize a subapp, if requested | |
230 |
subapp = Instance(' |
|
230 | subapp = Instance('traitlets.config.application.Application', allow_none=True) | |
231 |
|
231 | |||
232 | # extra command-line arguments that don't set config values |
|
232 | # extra command-line arguments that don't set config values | |
233 | extra_args = List(Unicode) |
|
233 | extra_args = List(Unicode) |
@@ -10,7 +10,7 b' import logging' | |||||
10 | from copy import deepcopy |
|
10 | from copy import deepcopy | |
11 |
|
11 | |||
12 | from .loader import Config, LazyConfigValue |
|
12 | from .loader import Config, LazyConfigValue | |
13 |
from |
|
13 | from traitlets.traitlets import HasTraits, Instance | |
14 | from IPython.utils.text import indent, wrap_paragraphs |
|
14 | from IPython.utils.text import indent, wrap_paragraphs | |
15 | from IPython.utils.py3compat import iteritems |
|
15 | from IPython.utils.py3compat import iteritems | |
16 |
|
16 | |||
@@ -34,7 +34,7 b' class MultipleInstanceError(ConfigurableError):' | |||||
34 | class Configurable(HasTraits): |
|
34 | class Configurable(HasTraits): | |
35 |
|
35 | |||
36 | config = Instance(Config, (), {}) |
|
36 | config = Instance(Config, (), {}) | |
37 |
parent = Instance(' |
|
37 | parent = Instance('traitlets.config.configurable.Configurable', allow_none=True) | |
38 |
|
38 | |||
39 | def __init__(self, **kwargs): |
|
39 | def __init__(self, **kwargs): | |
40 | """Create a configurable given a config config. |
|
40 | """Create a configurable given a config config. | |
@@ -329,7 +329,7 b' class SingletonConfigurable(Configurable):' | |||||
329 |
|
329 | |||
330 | Create a singleton class using instance, and retrieve it:: |
|
330 | Create a singleton class using instance, and retrieve it:: | |
331 |
|
331 | |||
332 |
>>> from |
|
332 | >>> from traitlets.config.configurable import SingletonConfigurable | |
333 | >>> class Foo(SingletonConfigurable): pass |
|
333 | >>> class Foo(SingletonConfigurable): pass | |
334 | >>> foo = Foo.instance() |
|
334 | >>> foo = Foo.instance() | |
335 | >>> foo == Foo.instance() |
|
335 | >>> foo == Foo.instance() |
@@ -17,7 +17,7 b' from IPython.utils.path import filefind, get_ipython_dir' | |||||
17 | from IPython.utils import py3compat |
|
17 | from IPython.utils import py3compat | |
18 | from IPython.utils.encoding import DEFAULT_ENCODING |
|
18 | from IPython.utils.encoding import DEFAULT_ENCODING | |
19 | from IPython.utils.py3compat import unicode_type, iteritems |
|
19 | from IPython.utils.py3compat import unicode_type, iteritems | |
20 |
from |
|
20 | from traitlets.traitlets import HasTraits, List, Any | |
21 |
|
21 | |||
22 | #----------------------------------------------------------------------------- |
|
22 | #----------------------------------------------------------------------------- | |
23 | # Exceptions |
|
23 | # Exceptions | |
@@ -330,7 +330,7 b' class ConfigLoader(object):' | |||||
330 | """A base class for config loaders. |
|
330 | """A base class for config loaders. | |
331 |
|
331 | |||
332 | log : instance of :class:`logging.Logger` to use. |
|
332 | log : instance of :class:`logging.Logger` to use. | |
333 |
By default loger of :meth:` |
|
333 | By default loger of :meth:`traitlets.config.application.Application.instance()` | |
334 | will be used |
|
334 | will be used | |
335 |
|
335 | |||
336 | Examples |
|
336 | Examples | |
@@ -558,7 +558,7 b' class KeyValueConfigLoader(CommandLineConfigLoader):' | |||||
558 | Examples |
|
558 | Examples | |
559 | -------- |
|
559 | -------- | |
560 |
|
560 | |||
561 |
>>> from |
|
561 | >>> from traitlets.config.loader import KeyValueConfigLoader | |
562 | >>> cl = KeyValueConfigLoader() |
|
562 | >>> cl = KeyValueConfigLoader() | |
563 | >>> d = cl.load_config(["--A.name='brian'","--B.number=0"]) |
|
563 | >>> d = cl.load_config(["--A.name='brian'","--B.number=0"]) | |
564 | >>> sorted(d.items()) |
|
564 | >>> sorted(d.items()) |
@@ -7,9 +7,9 b' import io' | |||||
7 | import json |
|
7 | import json | |
8 | import os |
|
8 | import os | |
9 |
|
9 | |||
10 |
from |
|
10 | from traitlets.config import LoggingConfigurable | |
11 | from IPython.utils.py3compat import PY3 |
|
11 | from IPython.utils.py3compat import PY3 | |
12 |
from |
|
12 | from traitlets.traitlets import Unicode | |
13 |
|
13 | |||
14 |
|
14 | |||
15 | def recursive_update(target, new): |
|
15 | def recursive_update(target, new): |
@@ -1,6 +1,6 b'' | |||||
1 | # coding: utf-8 |
|
1 | # coding: utf-8 | |
2 | """ |
|
2 | """ | |
3 |
Tests for |
|
3 | Tests for traitlets.config.application.Application | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | # Copyright (c) IPython Development Team. |
|
6 | # Copyright (c) IPython Development Team. | |
@@ -15,15 +15,15 b' pjoin = os.path.join' | |||||
15 |
|
15 | |||
16 | import nose.tools as nt |
|
16 | import nose.tools as nt | |
17 |
|
17 | |||
18 |
from |
|
18 | from traitlets.config.configurable import Configurable | |
19 |
from |
|
19 | from traitlets.config.loader import Config | |
20 |
|
20 | |||
21 |
from |
|
21 | from traitlets.config.application import ( | |
22 | Application |
|
22 | Application | |
23 | ) |
|
23 | ) | |
24 |
|
24 | |||
25 | from IPython.utils.tempdir import TemporaryDirectory |
|
25 | from IPython.utils.tempdir import TemporaryDirectory | |
26 |
from |
|
26 | from traitlets.traitlets import ( | |
27 | Bool, Unicode, Integer, List, Dict |
|
27 | Bool, Unicode, Integer, List, Dict | |
28 | ) |
|
28 | ) | |
29 |
|
29 |
@@ -1,21 +1,21 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 |
"""Tests for |
|
2 | """Tests for traitlets.config.configurable""" | |
3 |
|
3 | |||
4 | # Copyright (c) IPython Development Team. |
|
4 | # Copyright (c) IPython Development Team. | |
5 | # Distributed under the terms of the Modified BSD License. |
|
5 | # Distributed under the terms of the Modified BSD License. | |
6 |
|
6 | |||
7 | from unittest import TestCase |
|
7 | from unittest import TestCase | |
8 |
|
8 | |||
9 |
from |
|
9 | from traitlets.config.configurable import ( | |
10 | Configurable, |
|
10 | Configurable, | |
11 | SingletonConfigurable |
|
11 | SingletonConfigurable | |
12 | ) |
|
12 | ) | |
13 |
|
13 | |||
14 |
from |
|
14 | from traitlets.traitlets import ( | |
15 | Integer, Float, Unicode, List, Dict, Set, |
|
15 | Integer, Float, Unicode, List, Dict, Set, | |
16 | ) |
|
16 | ) | |
17 |
|
17 | |||
18 |
from |
|
18 | from traitlets.config.loader import Config | |
19 | from IPython.utils.py3compat import PY3 |
|
19 | from IPython.utils.py3compat import PY3 | |
20 |
|
20 | |||
21 |
|
21 |
@@ -1,5 +1,5 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 |
"""Tests for |
|
2 | """Tests for traitlets.config.loader""" | |
3 |
|
3 | |||
4 | # Copyright (c) IPython Development Team. |
|
4 | # Copyright (c) IPython Development Team. | |
5 | # Distributed under the terms of the Modified BSD License. |
|
5 | # Distributed under the terms of the Modified BSD License. | |
@@ -18,7 +18,7 b' import nose.tools as nt' | |||||
18 |
|
18 | |||
19 |
|
19 | |||
20 |
|
20 | |||
21 |
from |
|
21 | from traitlets.config.loader import ( | |
22 | Config, |
|
22 | Config, | |
23 | LazyConfigValue, |
|
23 | LazyConfigValue, | |
24 | PyFileConfigLoader, |
|
24 | PyFileConfigLoader, |
@@ -53,10 +53,10 b' except:' | |||||
53 | ClassTypes = (type,) |
|
53 | ClassTypes = (type,) | |
54 | from warnings import warn |
|
54 | from warnings import warn | |
55 |
|
55 | |||
56 | from .getargspec import getargspec |
|
|||
57 | from .importstring import import_item |
|
|||
58 | from IPython.utils import py3compat |
|
56 | from IPython.utils import py3compat | |
59 | from IPython.utils import eventful |
|
57 | from IPython.utils import eventful | |
|
58 | from IPython.utils.getargspec import getargspec | |||
|
59 | from IPython.utils.importstring import import_item | |||
60 | from IPython.utils.py3compat import iteritems, string_types |
|
60 | from IPython.utils.py3compat import iteritems, string_types | |
61 | from IPython.testing.skipdoctest import skip_doctest |
|
61 | from IPython.testing.skipdoctest import skip_doctest | |
62 |
|
62 |
General Comments 0
You need to be logged in to leave comments.
Login now