Permalink
Browse files

Use DottedObjectName traits in zmq and parallel modules.

  • Loading branch information...
1 parent 352cd71 commit aeca882c81b8cc68453062a64a1a9ff7c7fbdef0 @takluyver committed Jun 21, 2011
@@ -37,7 +37,8 @@
from IPython.core.profiledir import ProfileDir
from IPython.utils.daemonize import daemonize
from IPython.utils.importstring import import_item
-from IPython.utils.traitlets import Int, Unicode, Bool, CFloat, Dict, List
+from IPython.utils.traitlets import (Int, Unicode, Bool, CFloat, Dict, List,
+ DottedObjectName)
from IPython.parallel.apps.baseapp import (
BaseParallelApplication,
@@ -198,7 +199,7 @@ def _classes_default(self):
n = Int(2, config=True,
help="The number of engines to start.")
- engine_launcher_class = Unicode('LocalEngineSetLauncher',
+ engine_launcher_class = DottedObjectName('LocalEngineSetLauncher',
config=True,
help="The class for launching a set of Engines."
)
@@ -330,7 +331,7 @@ def _classes_default(self,):
delay = CFloat(1., config=True,
help="delay (in s) between starting the controller and the engines")
- controller_launcher_class = Unicode('LocalControllerLauncher',
+ controller_launcher_class = DottedObjectName('LocalControllerLauncher',
config=True,
help="The class for launching a Controller."
)
@@ -30,7 +30,7 @@
# internal:
from IPython.utils.importstring import import_item
from IPython.utils.traitlets import (
- HasTraits, Instance, Int, Unicode, Dict, Set, Tuple, Bytes
+ HasTraits, Instance, Int, Unicode, Dict, Set, Tuple, Bytes, DottedObjectName
)
from IPython.parallel import error, util
@@ -179,8 +179,8 @@ def _notifier_port_default(self):
monitor_url = Unicode('')
- db_class = Unicode('IPython.parallel.controller.dictdb.DictDB', config=True,
- help="""The class to use for the DB backend""")
+ db_class = DottedObjectName('IPython.parallel.controller.dictdb.DictDB',
+ config=True, help="""The class to use for the DB backend""")
# not configurable
db = Instance('IPython.parallel.controller.dictdb.BaseDB')
View
@@ -30,7 +30,8 @@
)
from IPython.utils import io
from IPython.utils.localinterfaces import LOCALHOST
-from IPython.utils.traitlets import Any, Instance, Dict, Unicode, Int, Bool
+from IPython.utils.traitlets import (Any, Instance, Dict, Unicode, Int, Bool,
+ DottedObjectName)
from IPython.utils.importstring import import_item
# local imports
from IPython.zmq.heartbeat import Heartbeat
@@ -75,7 +76,7 @@ class KernelApp(BaseIPythonApplication):
flags = Dict(kernel_flags)
classes = [Session]
# the kernel class, as an importstring
- kernel_class = Unicode('IPython.zmq.pykernel.Kernel')
+ kernel_class = DottedObjectName('IPython.zmq.pykernel.Kernel')
kernel = Any()
poller = Any() # don't restrict this even though current pollers are all Threads
heartbeat = Instance(Heartbeat)
@@ -93,10 +94,10 @@ class KernelApp(BaseIPythonApplication):
# streams, etc.
no_stdout = Bool(False, config=True, help="redirect stdout to the null device")
no_stderr = Bool(False, config=True, help="redirect stderr to the null device")
- outstream_class = Unicode('IPython.zmq.iostream.OutStream', config=True,
- help="The importstring for the OutStream factory")
- displayhook_class = Unicode('IPython.zmq.displayhook.DisplayHook', config=True,
- help="The importstring for the DisplayHook factory")
+ outstream_class = DottedObjectName('IPython.zmq.iostream.OutStream',
+ config=True, help="The importstring for the OutStream factory")
+ displayhook_class = DottedObjectName('IPython.zmq.displayhook.DisplayHook',
+ config=True, help="The importstring for the DisplayHook factory")
# polling
parent = Int(0, config=True,
View
@@ -47,7 +47,8 @@
from IPython.config.configurable import Configurable, LoggingConfigurable
from IPython.utils.importstring import import_item
from IPython.utils.jsonutil import extract_dates, squash_dates, date_default
-from IPython.utils.traitlets import Bytes, Unicode, Bool, Any, Instance, Set
+from IPython.utils.traitlets import (Bytes, Unicode, Bool, Any, Instance, Set,
+ DottedObjectName)
#-----------------------------------------------------------------------------
# utility functions
@@ -211,7 +212,7 @@ class Session(Configurable):
debug=Bool(False, config=True, help="""Debug output in the Session""")
- packer = Unicode('json',config=True,
+ packer = DottedObjectName('json',config=True,
help="""The name of the packer for serializing messages.
Should be one of 'json', 'pickle', or an import name
for a custom callable serializer.""")
@@ -225,7 +226,7 @@ def _packer_changed(self, name, old, new):
else:
self.pack = import_item(str(new))
- unpacker = Unicode('json', config=True,
+ unpacker = DottedObjectName('json', config=True,
help="""The name of the unpacker for unserializing messages.
Only used with custom functions for `packer`.""")
def _unpacker_changed(self, name, old, new):

0 comments on commit aeca882

Please sign in to comment.