本文整理汇总了Python中traitlets.config.application.boolean_flag函数的典型用法代码示例。如果您正苦于以下问题:Python boolean_flag函数的具体用法?Python boolean_flag怎么用?Python boolean_flag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了boolean_flag函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rpt_add
for line in self.app.shell.user_ns['_ih']:
rpt_add(line)
rpt_add('\n*** Last line of input (may not be in above history):\n')
rpt_add(self.app.shell._last_input_line+'\n')
except:
pass
return ''.join(report)
#-----------------------------------------------------------------------------
# Aliases and Flags
#-----------------------------------------------------------------------------
flags = dict(base_flags)
flags.update(shell_flags)
frontend_flags = {}
addflag = lambda *args: frontend_flags.update(boolean_flag(*args))
addflag('autoedit-syntax', 'TerminalInteractiveShell.autoedit_syntax',
'Turn on auto editing of files with syntax errors.',
'Turn off auto editing of files with syntax errors.'
)
addflag('simple-prompt', 'TerminalInteractiveShell.simple_prompt',
"Force simple minimal prompt using `raw_input`",
"Use a rich interactive prompt with prompt_toolkit",
)
addflag('banner', 'TerminalIPythonApp.display_banner',
"Display a banner upon starting IPython.",
"Don't display a banner upon starting IPython."
)
addflag('confirm-exit', 'TerminalInteractiveShell.confirm_exit',
"""Set to confirm when you try to exit IPython with an EOF (Control-D
示例2: dict
MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
very large, so you may want to disable it if you have a slow internet
connection, or for offline use of the notebook.
When disabled, equations etc. will appear as their untransformed TeX source.
"""
)
flags['allow-root']=(
{'NotebookApp' : {'allow_root' : True}},
"Allow the notebook to be run from root user."
)
# Add notebook manager flags
flags.update(boolean_flag('script', 'FileContentsManager.save_script',
'DEPRECATED, IGNORED',
'DEPRECATED, IGNORED'))
aliases = dict(base_aliases)
aliases.update({
'ip': 'NotebookApp.ip',
'port': 'NotebookApp.port',
'port-retries': 'NotebookApp.port_retries',
'transport': 'KernelManager.transport',
'keyfile': 'NotebookApp.keyfile',
'certfile': 'NotebookApp.certfile',
'client-ca': 'NotebookApp.client_ca',
'notebook-dir': 'NotebookApp.notebook_dir',
'browser': 'NotebookApp.browser',
'pylab': 'NotebookApp.pylab',
示例3: dict
#-----------------------------------------------------------------------------
flags = {}
# the flags that are specific to the frontend
# these must be scrubbed before being passed to the kernel,
# or it will raise an error on unrecognized flags
app_flags = {
'existing' : ({'JupyterConsoleApp' : {'existing' : 'kernel*.json'}},
"Connect to an existing kernel. If no argument specified, guess most recent"),
}
app_flags.update(boolean_flag(
'confirm-exit', 'JupyterConsoleApp.confirm_exit',
"""Set to display confirmation dialog on exit. You can always use 'exit' or 'quit',
to force a direct exit without any confirmation.
""",
"""Don't prompt the user when exiting. This will terminate the kernel
if it is owned by the frontend, and leave it alive if it is external.
"""
))
flags.update(app_flags)
aliases = {}
# also scrub aliases from the frontend
app_aliases = dict(
ip = 'JupyterConsoleApp.ip',
transport = 'JupyterConsoleApp.transport',
hb = 'JupyterConsoleApp.hb_port',
shell = 'JupyterConsoleApp.shell_port',
iopub = 'JupyterConsoleApp.iopub_port',
示例4: tuple
Unicode, Instance, List, Bool, CaselessStrEnum
)
from IPython.lib.inputhook import guis
#-----------------------------------------------------------------------------
# Aliases and Flags
#-----------------------------------------------------------------------------
gui_keys = tuple(sorted([ key for key in guis if key is not None ]))
backend_keys = sorted(pylabtools.backends.keys())
backend_keys.insert(0, 'auto')
shell_flags = {}
addflag = lambda *args: shell_flags.update(boolean_flag(*args))
addflag('autoindent', 'InteractiveShell.autoindent',
'Turn on autoindenting.', 'Turn off autoindenting.'
)
addflag('automagic', 'InteractiveShell.automagic',
"""Turn on the auto calling of magic commands. Type %%magic at the
IPython prompt for more information.""",
'Turn off the auto calling of magic commands.'
)
addflag('pdb', 'InteractiveShell.pdb',
"Enable auto calling the pdb debugger after every exception.",
"Disable auto calling the pdb debugger after every exception."
)
# pydb flag doesn't do any config, as core.debugger switches on import,
# which is before parsing. This just allows the flag to be passed.
shell_flags.update(dict(
示例5: dict
_examples = """
jupyter qtconsole # start the qtconsole
"""
# -----------------------------------------------------------------------------
# Aliases and Flags
# -----------------------------------------------------------------------------
# FIXME: workaround bug in jupyter_client < 4.1 excluding base_flags,aliases
flags = dict(base_flags)
qt_flags = {"plain": ({"JupyterQtConsoleApp": {"plain": True}}, "Disable rich text support.")}
qt_flags.update(
boolean_flag(
"banner",
"JupyterQtConsoleApp.display_banner",
"Display a banner upon starting the QtConsole.",
"Don't display a banner upon starting the QtConsole.",
)
)
# and app_flags from the Console Mixin
qt_flags.update(app_flags)
# add frontend flags to the full set
flags.update(qt_flags)
# start with copy of base jupyter aliases
aliases = dict(base_aliases)
qt_aliases = dict(
style="JupyterWidget.syntax_style",
stylesheet="JupyterQtConsoleApp.stylesheet",
editor="JupyterWidget.editor",
示例6: dict
_examples = """
nexpy # start the GUI application
"""
#-----------------------------------------------------------------------------
# Aliases and Flags
#-----------------------------------------------------------------------------
flags = dict(base_flags)
qt_flags = {
'plain' : ({'NXConsoleApp' : {'plain' : True}},
"Disable rich text support."),
}
qt_flags.update(boolean_flag(
'banner', 'NXConsoleApp.display_banner',
"Display a banner upon starting the QtConsole.",
"Don't display a banner upon starting the QtConsole."
))
# and app_flags from the Console Mixin
qt_flags.update(app_flags)
# add frontend flags to the full set
flags.update(qt_flags)
# start with copy of base jupyter aliases
aliases = dict(base_aliases)
qt_aliases = dict(
style = 'JupyterWidget.syntax_style',
stylesheet = 'NXConsoleApp.stylesheet',
editor = 'JupyterWidget.editor',
示例7: dict
"DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.",
)
flags["no-mathjax"] = (
{"NotebookApp": {"enable_mathjax": False}},
"""Disable MathJax
MathJax is the javascript library IPython uses to render math/LaTeX. It is
very large, so you may want to disable it if you have a slow internet
connection, or for offline use of the notebook.
When disabled, equations etc. will appear as their untransformed TeX source.
""",
)
# Add notebook manager flags
flags.update(boolean_flag("script", "FileContentsManager.save_script", "DEPRECATED, IGNORED", "DEPRECATED, IGNORED"))
aliases = dict(base_aliases)
aliases.update(
{
"ip": "NotebookApp.ip",
"port": "NotebookApp.port",
"port-retries": "NotebookApp.port_retries",
"transport": "KernelManager.transport",
"keyfile": "NotebookApp.keyfile",
"certfile": "NotebookApp.certfile",
"notebook-dir": "NotebookApp.notebook_dir",
"browser": "NotebookApp.browser",
"pylab": "NotebookApp.pylab",
}