Show More
@@ -14,6 +14,7 b'' | |||
|
14 | 14 | from __future__ import absolute_import |
|
15 | 15 | |
|
16 | 16 | # Standard library imports |
|
17 | import re | |
|
17 | 18 | import signal |
|
18 | 19 | import sys |
|
19 | 20 | import time |
@@ -140,7 +141,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||
|
140 | 141 | #-------------------------------------------------------------------------- |
|
141 | 142 | |
|
142 | 143 | def format_kernel_cmd(self, **kw): |
|
143 |
""" |
|
|
144 | """replace templated args (e.g. {connection_file})""" | |
|
144 | 145 | if self.kernel_cmd: |
|
145 | 146 | cmd = self.kernel_cmd |
|
146 | 147 | else: |
@@ -150,7 +151,13 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||
|
150 | 151 | ) |
|
151 | 152 | ns = dict(connection_file=self.connection_file) |
|
152 | 153 | ns.update(self._launch_args) |
|
153 | return [ c.format(**ns) for c in cmd ] | |
|
154 | ||
|
155 | pat = re.compile(r'\{([A-Za-z0-9_]+)\}') | |
|
156 | def from_ns(match): | |
|
157 | """Get the key out of ns if it's there, otherwise no change.""" | |
|
158 | return ns.get(match.group(1), match.group()) | |
|
159 | ||
|
160 | return [ pat.sub(from_ns, arg) for arg in cmd ] | |
|
154 | 161 | |
|
155 | 162 | def _launch_kernel(self, kernel_cmd, **kw): |
|
156 | 163 | """actually launch the kernel |
General Comments 0
You need to be logged in to leave comments.
Login now