mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-07-01 14:07:48 +00:00
first commit
This commit is contained in:
1
.venv/Lib/site-packages/jupyter_core/__init__.py
Normal file
1
.venv/Lib/site-packages/jupyter_core/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from .version import __version__, version_info # noqa
|
4
.venv/Lib/site-packages/jupyter_core/__main__.py
Normal file
4
.venv/Lib/site-packages/jupyter_core/__main__.py
Normal file
@ -0,0 +1,4 @@
|
||||
"""Launch the root jupyter command"""
|
||||
from .command import main
|
||||
|
||||
main()
|
275
.venv/Lib/site-packages/jupyter_core/application.py
Normal file
275
.venv/Lib/site-packages/jupyter_core/application.py
Normal file
@ -0,0 +1,275 @@
|
||||
"""
|
||||
A base Application class for Jupyter applications.
|
||||
|
||||
All Jupyter applications should inherit from this.
|
||||
"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from copy import deepcopy
|
||||
from shutil import which
|
||||
|
||||
from traitlets import Bool, List, Unicode, observe
|
||||
from traitlets.config.application import Application, catch_config_error
|
||||
from traitlets.config.loader import ConfigFileNotFound
|
||||
|
||||
from .paths import (
|
||||
allow_insecure_writes,
|
||||
issue_insecure_write_warning,
|
||||
jupyter_config_dir,
|
||||
jupyter_config_path,
|
||||
jupyter_data_dir,
|
||||
jupyter_path,
|
||||
jupyter_runtime_dir,
|
||||
)
|
||||
from .utils import ensure_dir_exists
|
||||
|
||||
# aliases and flags
|
||||
|
||||
base_aliases = {}
|
||||
if isinstance(Application.aliases, dict):
|
||||
# traitlets 5
|
||||
base_aliases.update(Application.aliases)
|
||||
_jupyter_aliases = {
|
||||
"log-level": "Application.log_level",
|
||||
"config": "JupyterApp.config_file",
|
||||
}
|
||||
base_aliases.update(_jupyter_aliases)
|
||||
|
||||
base_flags = {}
|
||||
if isinstance(Application.flags, dict):
|
||||
# traitlets 5
|
||||
base_flags.update(Application.flags)
|
||||
_jupyter_flags = {
|
||||
"debug": (
|
||||
{"Application": {"log_level": logging.DEBUG}},
|
||||
"set log level to logging.DEBUG (maximize logging output)",
|
||||
),
|
||||
"generate-config": ({"JupyterApp": {"generate_config": True}}, "generate default config file"),
|
||||
"y": (
|
||||
{"JupyterApp": {"answer_yes": True}},
|
||||
"Answer yes to any questions instead of prompting.",
|
||||
),
|
||||
}
|
||||
base_flags.update(_jupyter_flags)
|
||||
|
||||
|
||||
class NoStart(Exception):
|
||||
"""Exception to raise when an application shouldn't start"""
|
||||
|
||||
|
||||
class JupyterApp(Application):
|
||||
"""Base class for Jupyter applications"""
|
||||
|
||||
name = "jupyter" # override in subclasses
|
||||
description = "A Jupyter Application"
|
||||
|
||||
aliases = base_aliases
|
||||
flags = base_flags
|
||||
|
||||
def _log_level_default(self):
|
||||
return logging.INFO
|
||||
|
||||
jupyter_path = List(Unicode())
|
||||
|
||||
def _jupyter_path_default(self):
|
||||
return jupyter_path()
|
||||
|
||||
config_dir = Unicode()
|
||||
|
||||
def _config_dir_default(self):
|
||||
return jupyter_config_dir()
|
||||
|
||||
@property
|
||||
def config_file_paths(self):
|
||||
path = jupyter_config_path()
|
||||
if self.config_dir not in path:
|
||||
path.insert(0, self.config_dir)
|
||||
path.insert(0, os.getcwd())
|
||||
return path
|
||||
|
||||
data_dir = Unicode()
|
||||
|
||||
def _data_dir_default(self):
|
||||
d = jupyter_data_dir()
|
||||
ensure_dir_exists(d, mode=0o700)
|
||||
return d
|
||||
|
||||
runtime_dir = Unicode()
|
||||
|
||||
def _runtime_dir_default(self):
|
||||
rd = jupyter_runtime_dir()
|
||||
ensure_dir_exists(rd, mode=0o700)
|
||||
return rd
|
||||
|
||||
@observe("runtime_dir")
|
||||
def _runtime_dir_changed(self, change):
|
||||
ensure_dir_exists(change["new"], mode=0o700)
|
||||
|
||||
generate_config = Bool(False, config=True, help="""Generate default config file.""")
|
||||
|
||||
config_file_name = Unicode(config=True, help="Specify a config file to load.")
|
||||
|
||||
def _config_file_name_default(self):
|
||||
if not self.name:
|
||||
return ""
|
||||
return self.name.replace("-", "_") + "_config"
|
||||
|
||||
config_file = Unicode(
|
||||
config=True,
|
||||
help="""Full path of a config file.""",
|
||||
)
|
||||
|
||||
answer_yes = Bool(False, config=True, help="""Answer yes to any prompts.""")
|
||||
|
||||
def write_default_config(self):
|
||||
"""Write our default config to a .py config file"""
|
||||
if self.config_file:
|
||||
config_file = self.config_file
|
||||
else:
|
||||
config_file = os.path.join(self.config_dir, self.config_file_name + ".py")
|
||||
|
||||
if os.path.exists(config_file) and not self.answer_yes:
|
||||
answer = ""
|
||||
|
||||
def ask():
|
||||
prompt = "Overwrite %s with default config? [y/N]" % config_file
|
||||
try:
|
||||
return input(prompt).lower() or "n"
|
||||
except KeyboardInterrupt:
|
||||
print("") # empty line
|
||||
return "n"
|
||||
|
||||
answer = ask()
|
||||
while not answer.startswith(("y", "n")):
|
||||
print("Please answer 'yes' or 'no'")
|
||||
answer = ask()
|
||||
if answer.startswith("n"):
|
||||
return
|
||||
|
||||
config_text = self.generate_config_file()
|
||||
if isinstance(config_text, bytes):
|
||||
config_text = config_text.decode("utf8")
|
||||
print("Writing default config to: %s" % config_file)
|
||||
ensure_dir_exists(os.path.abspath(os.path.dirname(config_file)), 0o700)
|
||||
with open(config_file, mode="w", encoding="utf-8") as f:
|
||||
f.write(config_text)
|
||||
|
||||
def migrate_config(self):
|
||||
"""Migrate config/data from IPython 3"""
|
||||
if os.path.exists(os.path.join(self.config_dir, "migrated")):
|
||||
# already migrated
|
||||
return
|
||||
|
||||
from .migrate import get_ipython_dir, migrate
|
||||
|
||||
# No IPython dir, nothing to migrate
|
||||
if not os.path.exists(get_ipython_dir()):
|
||||
return
|
||||
|
||||
migrate()
|
||||
|
||||
def load_config_file(self, suppress_errors=True):
|
||||
"""Load the config file.
|
||||
|
||||
By default, errors in loading config are handled, and a warning
|
||||
printed on screen. For testing, the suppress_errors option is set
|
||||
to False, so errors will make tests fail.
|
||||
"""
|
||||
self.log.debug("Searching %s for config files", self.config_file_paths)
|
||||
base_config = "jupyter_config"
|
||||
try:
|
||||
super().load_config_file(
|
||||
base_config,
|
||||
path=self.config_file_paths,
|
||||
)
|
||||
except ConfigFileNotFound:
|
||||
# ignore errors loading parent
|
||||
self.log.debug("Config file %s not found", base_config)
|
||||
|
||||
if self.config_file:
|
||||
path, config_file_name = os.path.split(self.config_file)
|
||||
else:
|
||||
path = self.config_file_paths
|
||||
config_file_name = self.config_file_name
|
||||
|
||||
if not config_file_name or (config_file_name == base_config):
|
||||
return
|
||||
|
||||
try:
|
||||
super().load_config_file(config_file_name, path=path)
|
||||
except ConfigFileNotFound:
|
||||
self.log.debug("Config file not found, skipping: %s", config_file_name)
|
||||
except Exception:
|
||||
# Reraise errors for testing purposes, or if set in
|
||||
# self.raise_config_file_errors
|
||||
if (not suppress_errors) or self.raise_config_file_errors:
|
||||
raise
|
||||
self.log.warning("Error loading config file: %s" % config_file_name, exc_info=True)
|
||||
|
||||
# subcommand-related
|
||||
def _find_subcommand(self, name):
|
||||
name = f"{self.name}-{name}"
|
||||
return which(name)
|
||||
|
||||
@property
|
||||
def _dispatching(self):
|
||||
"""Return whether we are dispatching to another command
|
||||
|
||||
or running ourselves.
|
||||
"""
|
||||
return bool(self.generate_config or self.subapp or self.subcommand)
|
||||
|
||||
subcommand = Unicode()
|
||||
|
||||
@catch_config_error
|
||||
def initialize(self, argv=None):
|
||||
# don't hook up crash handler before parsing command-line
|
||||
if argv is None:
|
||||
argv = sys.argv[1:]
|
||||
if argv:
|
||||
subc = self._find_subcommand(argv[0])
|
||||
if subc:
|
||||
self.argv = argv
|
||||
self.subcommand = subc
|
||||
return
|
||||
self.parse_command_line(argv)
|
||||
cl_config = deepcopy(self.config)
|
||||
if self._dispatching:
|
||||
return
|
||||
self.migrate_config()
|
||||
self.load_config_file()
|
||||
# enforce cl-opts override configfile opts:
|
||||
self.update_config(cl_config)
|
||||
if allow_insecure_writes:
|
||||
issue_insecure_write_warning()
|
||||
|
||||
def start(self):
|
||||
"""Start the whole thing"""
|
||||
if self.subcommand:
|
||||
os.execv(self.subcommand, [self.subcommand] + self.argv[1:])
|
||||
raise NoStart()
|
||||
|
||||
if self.subapp:
|
||||
self.subapp.start()
|
||||
raise NoStart()
|
||||
|
||||
if self.generate_config:
|
||||
self.write_default_config()
|
||||
raise NoStart()
|
||||
|
||||
@classmethod
|
||||
def launch_instance(cls, argv=None, **kwargs):
|
||||
"""Launch an instance of a Jupyter Application"""
|
||||
try:
|
||||
return super().launch_instance(argv=argv, **kwargs)
|
||||
except NoStart:
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
JupyterApp.launch_instance()
|
338
.venv/Lib/site-packages/jupyter_core/command.py
Normal file
338
.venv/Lib/site-packages/jupyter_core/command.py
Normal file
@ -0,0 +1,338 @@
|
||||
"""The root `jupyter` command.
|
||||
|
||||
This does nothing other than dispatch to subcommands or output path info.
|
||||
"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import json
|
||||
import os
|
||||
import site
|
||||
import sys
|
||||
import sysconfig
|
||||
from shutil import which
|
||||
from subprocess import Popen
|
||||
|
||||
from . import paths
|
||||
from .version import __version__
|
||||
|
||||
|
||||
class JupyterParser(argparse.ArgumentParser):
|
||||
@property # type:ignore[override]
|
||||
def epilog(self):
|
||||
"""Add subcommands to epilog on request
|
||||
|
||||
Avoids searching PATH for subcommands unless help output is requested.
|
||||
"""
|
||||
return "Available subcommands: %s" % " ".join(list_subcommands())
|
||||
|
||||
@epilog.setter
|
||||
def epilog(self, x):
|
||||
"""Ignore epilog set in Parser.__init__"""
|
||||
pass
|
||||
|
||||
|
||||
def jupyter_parser():
|
||||
parser = JupyterParser(
|
||||
description="Jupyter: Interactive Computing",
|
||||
)
|
||||
group = parser.add_mutually_exclusive_group(required=False)
|
||||
# don't use argparse's version action because it prints to stderr on py2
|
||||
group.add_argument(
|
||||
"--version", action="store_true", help="show the versions of core jupyter packages and exit"
|
||||
)
|
||||
group.add_argument("subcommand", type=str, nargs="?", help="the subcommand to launch")
|
||||
|
||||
group.add_argument("--config-dir", action="store_true", help="show Jupyter config dir")
|
||||
group.add_argument("--data-dir", action="store_true", help="show Jupyter data dir")
|
||||
group.add_argument("--runtime-dir", action="store_true", help="show Jupyter runtime dir")
|
||||
group.add_argument(
|
||||
"--paths",
|
||||
action="store_true",
|
||||
help="show all Jupyter paths. Add --json for machine-readable format.",
|
||||
)
|
||||
parser.add_argument("--json", action="store_true", help="output paths as machine-readable json")
|
||||
parser.add_argument("--debug", action="store_true", help="output debug information about paths")
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def list_subcommands():
|
||||
"""List all jupyter subcommands
|
||||
|
||||
searches PATH for `jupyter-name`
|
||||
|
||||
Returns a list of jupyter's subcommand names, without the `jupyter-` prefix.
|
||||
Nested children (e.g. jupyter-sub-subsub) are not included.
|
||||
"""
|
||||
subcommand_tuples = set()
|
||||
# construct a set of `('foo', 'bar') from `jupyter-foo-bar`
|
||||
for d in _path_with_self():
|
||||
try:
|
||||
names = os.listdir(d)
|
||||
except OSError:
|
||||
continue
|
||||
for name in names:
|
||||
if name.startswith("jupyter-"):
|
||||
if sys.platform.startswith("win"):
|
||||
# remove file-extension on Windows
|
||||
name = os.path.splitext(name)[0]
|
||||
subcommand_tuples.add(tuple(name.split("-")[1:]))
|
||||
# build a set of subcommand strings, excluding subcommands whose parents are defined
|
||||
subcommands = set()
|
||||
# Only include `jupyter-foo-bar` if `jupyter-foo` is not already present
|
||||
for sub_tup in subcommand_tuples:
|
||||
if not any(sub_tup[:i] in subcommand_tuples for i in range(1, len(sub_tup))):
|
||||
subcommands.add("-".join(sub_tup))
|
||||
return sorted(subcommands)
|
||||
|
||||
|
||||
def _execvp(cmd, argv):
|
||||
"""execvp, except on Windows where it uses Popen
|
||||
|
||||
Python provides execvp on Windows, but its behavior is problematic (Python bug#9148).
|
||||
"""
|
||||
if sys.platform.startswith("win"):
|
||||
# PATH is ignored when shell=False,
|
||||
# so rely on shutil.which
|
||||
cmd_path = which(cmd)
|
||||
if cmd_path is None:
|
||||
raise OSError("%r not found" % cmd, errno.ENOENT)
|
||||
p = Popen([cmd_path] + argv[1:])
|
||||
# Don't raise KeyboardInterrupt in the parent process.
|
||||
# Set this after spawning, to avoid subprocess inheriting handler.
|
||||
import signal
|
||||
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
p.wait()
|
||||
sys.exit(p.returncode)
|
||||
else:
|
||||
os.execvp(cmd, argv)
|
||||
|
||||
|
||||
def _jupyter_abspath(subcommand):
|
||||
"""This method get the abspath of a specified jupyter-subcommand with no
|
||||
changes on ENV.
|
||||
"""
|
||||
# get env PATH with self
|
||||
search_path = os.pathsep.join(_path_with_self())
|
||||
# get the abs path for the jupyter-<subcommand>
|
||||
jupyter_subcommand = f"jupyter-{subcommand}"
|
||||
abs_path = which(jupyter_subcommand, path=search_path)
|
||||
if abs_path is None:
|
||||
raise Exception(f"\nJupyter command `{jupyter_subcommand}` not found.")
|
||||
|
||||
if not os.access(abs_path, os.X_OK):
|
||||
raise Exception(f"\nJupyter command `{jupyter_subcommand}` is not executable.")
|
||||
|
||||
return abs_path
|
||||
|
||||
|
||||
def _path_with_self():
|
||||
"""Put `jupyter`'s dir at the front of PATH
|
||||
|
||||
Ensures that /path/to/jupyter subcommand
|
||||
will do /path/to/jupyter-subcommand
|
||||
even if /other/jupyter-subcommand is ahead of it on PATH
|
||||
"""
|
||||
path_list = (os.environ.get("PATH") or os.defpath).split(os.pathsep)
|
||||
|
||||
# Insert the "scripts" directory for this Python installation
|
||||
# This allows the "jupyter" command to be relocated, while still
|
||||
# finding subcommands that have been installed in the default
|
||||
# location.
|
||||
# We put the scripts directory at the *end* of PATH, so that
|
||||
# if the user explicitly overrides a subcommand, that override
|
||||
# still takes effect.
|
||||
try:
|
||||
bindir = sysconfig.get_path("scripts")
|
||||
except KeyError:
|
||||
# The Python environment does not specify a "scripts" location
|
||||
pass
|
||||
else:
|
||||
path_list.append(bindir)
|
||||
|
||||
scripts = [sys.argv[0]]
|
||||
if os.path.islink(scripts[0]):
|
||||
# include realpath, if `jupyter` is a symlink
|
||||
scripts.append(os.path.realpath(scripts[0]))
|
||||
|
||||
for script in scripts:
|
||||
bindir = os.path.dirname(script)
|
||||
if os.path.isdir(bindir) and os.access(script, os.X_OK): # only if it's a script
|
||||
# ensure executable's dir is on PATH
|
||||
# avoids missing subcommands when jupyter is run via absolute path
|
||||
path_list.insert(0, bindir)
|
||||
return path_list
|
||||
|
||||
|
||||
def main():
|
||||
parser = jupyter_parser()
|
||||
if len(sys.argv) > 1 and not sys.argv[1].startswith("-"):
|
||||
# Don't parse if a subcommand is given
|
||||
# Avoids argparse gobbling up args passed to subcommand, such as `-h`.
|
||||
subcommand = sys.argv[1]
|
||||
else:
|
||||
args, opts = parser.parse_known_args()
|
||||
subcommand = args.subcommand
|
||||
if args.version:
|
||||
print("Selected Jupyter core packages...")
|
||||
for package in [
|
||||
"IPython",
|
||||
"ipykernel",
|
||||
"ipywidgets",
|
||||
"jupyter_client",
|
||||
"jupyter_core",
|
||||
"jupyter_server",
|
||||
"jupyterlab",
|
||||
"nbclient",
|
||||
"nbconvert",
|
||||
"nbformat",
|
||||
"notebook",
|
||||
"qtconsole",
|
||||
"traitlets",
|
||||
]:
|
||||
try:
|
||||
if package == "jupyter_core": # We're already here
|
||||
version = __version__
|
||||
else:
|
||||
mod = __import__(package)
|
||||
version = mod.__version__
|
||||
except ImportError:
|
||||
version = "not installed"
|
||||
print(f"{package:<17}:", version)
|
||||
return
|
||||
if args.json and not args.paths:
|
||||
sys.exit("--json is only used with --paths")
|
||||
if args.debug and not args.paths:
|
||||
sys.exit("--debug is only used with --paths")
|
||||
if args.debug and args.json:
|
||||
sys.exit("--debug cannot be used with --json")
|
||||
if args.config_dir:
|
||||
print(paths.jupyter_config_dir())
|
||||
return
|
||||
if args.data_dir:
|
||||
print(paths.jupyter_data_dir())
|
||||
return
|
||||
if args.runtime_dir:
|
||||
print(paths.jupyter_runtime_dir())
|
||||
return
|
||||
if args.paths:
|
||||
data = {}
|
||||
data["runtime"] = [paths.jupyter_runtime_dir()]
|
||||
data["config"] = paths.jupyter_config_path()
|
||||
data["data"] = paths.jupyter_path()
|
||||
if args.json:
|
||||
print(json.dumps(data))
|
||||
else:
|
||||
if args.debug:
|
||||
env = os.environ
|
||||
|
||||
if paths.envset("JUPYTER_PREFER_ENV_PATH"):
|
||||
print(
|
||||
"JUPYTER_PREFER_ENV_PATH is set, making the environment-level path preferred over the user-level path for data and config"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_PREFER_ENV_PATH is not set, making the user-level path preferred over the environment-level path for data and config"
|
||||
)
|
||||
|
||||
# config path list
|
||||
if env.get("JUPYTER_NO_CONFIG"):
|
||||
print(
|
||||
"JUPYTER_NO_CONFIG is set, making the config path list only a single temporary directory"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_NO_CONFIG is not set, so we use the full path list for config"
|
||||
)
|
||||
|
||||
if env.get("JUPYTER_CONFIG_PATH"):
|
||||
print(
|
||||
f"JUPYTER_CONFIG_PATH is set to '{env.get('JUPYTER_CONFIG_PATH')}', which is prepended to the config path list (unless JUPYTER_NO_CONFIG is set)"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_CONFIG_PATH is not set, so we do not prepend anything to the config paths"
|
||||
)
|
||||
|
||||
if env.get("JUPYTER_CONFIG_DIR"):
|
||||
print(
|
||||
f"JUPYTER_CONFIG_DIR is set to '{env.get('JUPYTER_CONFIG_DIR')}', overriding the default user-level config directory"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_CONFIG_DIR is not set, so we use the default user-level config directory"
|
||||
)
|
||||
|
||||
if site.ENABLE_USER_SITE:
|
||||
print(
|
||||
f"Python's site.ENABLE_USER_SITE is True, so we add the user site directory '{site.getuserbase()}'"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
f"Python's site.ENABLE_USER_SITE is not True, so we do not add the Python site user directory '{site.getuserbase()}'"
|
||||
)
|
||||
|
||||
# data path list
|
||||
if env.get("JUPYTER_PATH"):
|
||||
print(
|
||||
f"JUPYTER_PATH is set to '{env.get('JUPYTER_PATH')}', which is prepended to the data paths"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_PATH is not set, so we do not prepend anything to the data paths"
|
||||
)
|
||||
|
||||
if env.get("JUPYTER_DATA_DIR"):
|
||||
print(
|
||||
f"JUPYTER_DATA_DIR is set to '{env.get('JUPYTER_DATA_DIR')}', overriding the default user-level data directory"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_DATA_DIR is not set, so we use the default user-level data directory"
|
||||
)
|
||||
|
||||
# runtime directory
|
||||
if env.get("JUPYTER_RUNTIME_DIR"):
|
||||
print(
|
||||
f"JUPYTER_RUNTIME_DIR is set to '{env.get('JUPYTER_RUNTIME_DIR')}', overriding the default runtime directory"
|
||||
)
|
||||
else:
|
||||
print(
|
||||
"JUPYTER_RUNTIME_DIR is not set, so we use the default runtime directory"
|
||||
)
|
||||
|
||||
print()
|
||||
|
||||
for name in sorted(data):
|
||||
path = data[name]
|
||||
print("%s:" % name)
|
||||
for p in path:
|
||||
print(" " + p)
|
||||
return
|
||||
|
||||
if not subcommand:
|
||||
parser.print_help(file=sys.stderr)
|
||||
sys.exit("\nPlease specify a subcommand or one of the optional arguments.")
|
||||
|
||||
try:
|
||||
command = _jupyter_abspath(subcommand)
|
||||
except Exception as e:
|
||||
parser.print_help(file=sys.stderr)
|
||||
# special-case alias of "jupyter help" to "jupyter --help"
|
||||
if subcommand == "help":
|
||||
return
|
||||
sys.exit(e)
|
||||
|
||||
try:
|
||||
_execvp(command, [command] + sys.argv[2:])
|
||||
except OSError as e:
|
||||
sys.exit(f"Error executing Jupyter command {subcommand!r}: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
274
.venv/Lib/site-packages/jupyter_core/migrate.py
Normal file
274
.venv/Lib/site-packages/jupyter_core/migrate.py
Normal file
@ -0,0 +1,274 @@
|
||||
"""Migrating IPython < 4.0 to Jupyter
|
||||
|
||||
This *copies* configuration and resources to their new locations in Jupyter
|
||||
|
||||
Migrations:
|
||||
|
||||
- .ipython/
|
||||
- nbextensions -> JUPYTER_DATA_DIR/nbextensions
|
||||
- kernels -> JUPYTER_DATA_DIR/kernels
|
||||
- .ipython/profile_default/
|
||||
- static/custom -> .jupyter/custom
|
||||
- nbconfig -> .jupyter/nbconfig
|
||||
- security/
|
||||
- notebook_secret, notebook_cookie_secret, nbsignatures.db -> JUPYTER_DATA_DIR
|
||||
- ipython_{notebook,nbconvert,qtconsole}_config.py -> .jupyter/jupyter_{name}_config.py
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
|
||||
from traitlets.config import JSONFileConfigLoader, PyFileConfigLoader
|
||||
from traitlets.log import get_logger
|
||||
|
||||
from .application import JupyterApp
|
||||
from .paths import jupyter_config_dir, jupyter_data_dir
|
||||
from .utils import ensure_dir_exists
|
||||
|
||||
pjoin = os.path.join
|
||||
|
||||
migrations = {
|
||||
pjoin("{ipython_dir}", "nbextensions"): pjoin("{jupyter_data}", "nbextensions"),
|
||||
pjoin("{ipython_dir}", "kernels"): pjoin("{jupyter_data}", "kernels"),
|
||||
pjoin("{profile}", "nbconfig"): pjoin("{jupyter_config}", "nbconfig"),
|
||||
}
|
||||
|
||||
custom_src_t = pjoin("{profile}", "static", "custom")
|
||||
custom_dst_t = pjoin("{jupyter_config}", "custom")
|
||||
|
||||
for security_file in ("notebook_secret", "notebook_cookie_secret", "nbsignatures.db"):
|
||||
src = pjoin("{profile}", "security", security_file)
|
||||
dst = pjoin("{jupyter_data}", security_file)
|
||||
migrations[src] = dst
|
||||
|
||||
config_migrations = ["notebook", "nbconvert", "qtconsole"]
|
||||
|
||||
regex = re.compile
|
||||
|
||||
config_substitutions = {
|
||||
regex(r"\bIPythonQtConsoleApp\b"): "JupyterQtConsoleApp",
|
||||
regex(r"\bIPythonWidget\b"): "JupyterWidget",
|
||||
regex(r"\bRichIPythonWidget\b"): "RichJupyterWidget",
|
||||
regex(r"\bIPython\.html\b"): "notebook",
|
||||
regex(r"\bIPython\.nbconvert\b"): "nbconvert",
|
||||
}
|
||||
|
||||
|
||||
def get_ipython_dir():
|
||||
"""Return the IPython directory location.
|
||||
|
||||
Not imported from IPython because the IPython implementation
|
||||
ensures that a writable directory exists,
|
||||
creating a temporary directory if not.
|
||||
We don't want to trigger that when checking if migration should happen.
|
||||
|
||||
We only need to support the IPython < 4 behavior for migration,
|
||||
so importing for forward-compatibility and edge cases is not important.
|
||||
"""
|
||||
return os.environ.get("IPYTHONDIR", os.path.expanduser("~/.ipython"))
|
||||
|
||||
|
||||
def migrate_dir(src, dst):
|
||||
"""Migrate a directory from src to dst"""
|
||||
log = get_logger()
|
||||
if not os.listdir(src):
|
||||
log.debug("No files in %s" % src)
|
||||
return False
|
||||
if os.path.exists(dst):
|
||||
if os.listdir(dst):
|
||||
# already exists, non-empty
|
||||
log.debug("%s already exists" % dst)
|
||||
return False
|
||||
else:
|
||||
os.rmdir(dst)
|
||||
log.info(f"Copying {src} -> {dst}")
|
||||
ensure_dir_exists(os.path.dirname(dst))
|
||||
shutil.copytree(src, dst, symlinks=True)
|
||||
return True
|
||||
|
||||
|
||||
def migrate_file(src, dst, substitutions=None):
|
||||
"""Migrate a single file from src to dst
|
||||
|
||||
substitutions is an optional dict of {regex: replacement} for performing replacements on the file.
|
||||
"""
|
||||
log = get_logger()
|
||||
if os.path.exists(dst):
|
||||
# already exists
|
||||
log.debug("%s already exists" % dst)
|
||||
return False
|
||||
log.info(f"Copying {src} -> {dst}")
|
||||
ensure_dir_exists(os.path.dirname(dst))
|
||||
shutil.copy(src, dst)
|
||||
if substitutions:
|
||||
with open(dst, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
for pat, replacement in substitutions.items():
|
||||
text = pat.sub(replacement, text)
|
||||
with open(dst, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
return True
|
||||
|
||||
|
||||
def migrate_one(src, dst):
|
||||
"""Migrate one item
|
||||
|
||||
dispatches to migrate_dir/_file
|
||||
"""
|
||||
log = get_logger()
|
||||
if os.path.isfile(src):
|
||||
return migrate_file(src, dst)
|
||||
elif os.path.isdir(src):
|
||||
return migrate_dir(src, dst)
|
||||
else:
|
||||
log.debug("Nothing to migrate for %s" % src)
|
||||
return False
|
||||
|
||||
|
||||
def migrate_static_custom(src, dst):
|
||||
"""Migrate non-empty custom.js,css from src to dst
|
||||
|
||||
src, dst are 'custom' directories containing custom.{js,css}
|
||||
"""
|
||||
log = get_logger()
|
||||
migrated = False
|
||||
|
||||
custom_js = pjoin(src, "custom.js")
|
||||
custom_css = pjoin(src, "custom.css")
|
||||
# check if custom_js is empty:
|
||||
custom_js_empty = True
|
||||
if os.path.isfile(custom_js):
|
||||
with open(custom_js, encoding="utf-8") as f:
|
||||
js = f.read().strip()
|
||||
for line in js.splitlines():
|
||||
if not (line.isspace() or line.strip().startswith(("/*", "*", "//"))):
|
||||
custom_js_empty = False
|
||||
break
|
||||
|
||||
# check if custom_css is empty:
|
||||
custom_css_empty = True
|
||||
if os.path.isfile(custom_css):
|
||||
with open(custom_css, encoding="utf-8") as f:
|
||||
css = f.read().strip()
|
||||
custom_css_empty = css.startswith("/*") and css.endswith("*/")
|
||||
|
||||
if custom_js_empty:
|
||||
log.debug("Ignoring empty %s" % custom_js)
|
||||
if custom_css_empty:
|
||||
log.debug("Ignoring empty %s" % custom_css)
|
||||
|
||||
if custom_js_empty and custom_css_empty:
|
||||
# nothing to migrate
|
||||
return False
|
||||
ensure_dir_exists(dst)
|
||||
|
||||
if not custom_js_empty or not custom_css_empty:
|
||||
ensure_dir_exists(dst)
|
||||
|
||||
if not custom_js_empty:
|
||||
if migrate_file(custom_js, pjoin(dst, "custom.js")):
|
||||
migrated = True
|
||||
if not custom_css_empty:
|
||||
if migrate_file(custom_css, pjoin(dst, "custom.css")):
|
||||
migrated = True
|
||||
|
||||
return migrated
|
||||
|
||||
|
||||
def migrate_config(name, env):
|
||||
"""Migrate a config file
|
||||
|
||||
Includes substitutions for updated configurable names.
|
||||
"""
|
||||
log = get_logger()
|
||||
src_base = pjoin("{profile}", "ipython_{name}_config").format(name=name, **env)
|
||||
dst_base = pjoin("{jupyter_config}", "jupyter_{name}_config").format(name=name, **env)
|
||||
loaders = {
|
||||
".py": PyFileConfigLoader,
|
||||
".json": JSONFileConfigLoader,
|
||||
}
|
||||
migrated = []
|
||||
for ext in (".py", ".json"):
|
||||
src = src_base + ext
|
||||
dst = dst_base + ext
|
||||
if os.path.exists(src):
|
||||
cfg = loaders[ext](src).load_config()
|
||||
if cfg:
|
||||
if migrate_file(src, dst, substitutions=config_substitutions):
|
||||
migrated.append(src)
|
||||
else:
|
||||
# don't migrate empty config files
|
||||
log.debug("Not migrating empty config file: %s" % src)
|
||||
return migrated
|
||||
|
||||
|
||||
def migrate():
|
||||
"""Migrate IPython configuration to Jupyter"""
|
||||
env = {
|
||||
"jupyter_data": jupyter_data_dir(),
|
||||
"jupyter_config": jupyter_config_dir(),
|
||||
"ipython_dir": get_ipython_dir(),
|
||||
"profile": os.path.join(get_ipython_dir(), "profile_default"),
|
||||
}
|
||||
migrated = False
|
||||
for src_t, dst_t in migrations.items():
|
||||
src = src_t.format(**env)
|
||||
dst = dst_t.format(**env)
|
||||
if os.path.exists(src):
|
||||
if migrate_one(src, dst):
|
||||
migrated = True
|
||||
|
||||
for name in config_migrations:
|
||||
if migrate_config(name, env):
|
||||
migrated = True
|
||||
|
||||
custom_src = custom_src_t.format(**env)
|
||||
custom_dst = custom_dst_t.format(**env)
|
||||
|
||||
if os.path.exists(custom_src):
|
||||
if migrate_static_custom(custom_src, custom_dst):
|
||||
migrated = True
|
||||
|
||||
# write a marker to avoid re-running migration checks
|
||||
ensure_dir_exists(env["jupyter_config"])
|
||||
with open(os.path.join(env["jupyter_config"], "migrated"), "w", encoding="utf-8") as f:
|
||||
f.write(datetime.utcnow().isoformat())
|
||||
|
||||
return migrated
|
||||
|
||||
|
||||
class JupyterMigrate(JupyterApp):
|
||||
name = "jupyter-migrate"
|
||||
description = """
|
||||
Migrate configuration and data from .ipython prior to 4.0 to Jupyter locations.
|
||||
|
||||
This migrates:
|
||||
|
||||
- config files in the default profile
|
||||
- kernels in ~/.ipython/kernels
|
||||
- notebook javascript extensions in ~/.ipython/extensions
|
||||
- custom.js/css to .jupyter/custom
|
||||
|
||||
to their new Jupyter locations.
|
||||
|
||||
All files are copied, not moved.
|
||||
If the destinations already exist, nothing will be done.
|
||||
"""
|
||||
|
||||
def start(self):
|
||||
if not migrate():
|
||||
self.log.info("Found nothing to migrate.")
|
||||
|
||||
|
||||
main = JupyterMigrate.launch_instance
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
921
.venv/Lib/site-packages/jupyter_core/paths.py
Normal file
921
.venv/Lib/site-packages/jupyter_core/paths.py
Normal file
@ -0,0 +1,921 @@
|
||||
"""Path utility functions."""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
# Derived from IPython.utils.path, which is
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
|
||||
import errno
|
||||
import os
|
||||
import site
|
||||
import stat
|
||||
import sys
|
||||
import tempfile
|
||||
import warnings
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
pjoin = os.path.join
|
||||
|
||||
# UF_HIDDEN is a stat flag not defined in the stat module.
|
||||
# It is used by BSD to indicate hidden files.
|
||||
UF_HIDDEN = getattr(stat, "UF_HIDDEN", 32768)
|
||||
|
||||
|
||||
def envset(name):
|
||||
"""Return True if the given environment variable is set
|
||||
|
||||
An environment variable is considered set if it is assigned to a value
|
||||
other than 'no', 'n', 'false', 'off', '0', or '0.0' (case insensitive)
|
||||
"""
|
||||
return os.environ.get(name, "no").lower() not in ["no", "n", "false", "off", "0", "0.0"]
|
||||
|
||||
|
||||
def get_home_dir():
|
||||
"""Get the real path of the home directory"""
|
||||
homedir = os.path.expanduser("~")
|
||||
# Next line will make things work even when /home/ is a symlink to
|
||||
# /usr/home as it is on FreeBSD, for example
|
||||
homedir = str(Path(homedir).resolve())
|
||||
return homedir
|
||||
|
||||
|
||||
_dtemps: dict = {}
|
||||
|
||||
|
||||
def _mkdtemp_once(name):
|
||||
"""Make or reuse a temporary directory.
|
||||
|
||||
If this is called with the same name in the same process, it will return
|
||||
the same directory.
|
||||
"""
|
||||
try:
|
||||
return _dtemps[name]
|
||||
except KeyError:
|
||||
d = _dtemps[name] = tempfile.mkdtemp(prefix=name + "-")
|
||||
return d
|
||||
|
||||
|
||||
def jupyter_config_dir():
|
||||
"""Get the Jupyter config directory for this platform and user.
|
||||
|
||||
Returns JUPYTER_CONFIG_DIR if defined, else ~/.jupyter
|
||||
"""
|
||||
|
||||
env = os.environ
|
||||
if env.get("JUPYTER_NO_CONFIG"):
|
||||
return _mkdtemp_once("jupyter-clean-cfg")
|
||||
|
||||
if env.get("JUPYTER_CONFIG_DIR"):
|
||||
return env["JUPYTER_CONFIG_DIR"]
|
||||
|
||||
home_dir = get_home_dir()
|
||||
return pjoin(home_dir, ".jupyter")
|
||||
|
||||
|
||||
def jupyter_data_dir():
|
||||
"""Get the config directory for Jupyter data files for this platform and user.
|
||||
|
||||
These are non-transient, non-configuration files.
|
||||
|
||||
Returns JUPYTER_DATA_DIR if defined, else a platform-appropriate path.
|
||||
"""
|
||||
env = os.environ
|
||||
|
||||
if env.get("JUPYTER_DATA_DIR"):
|
||||
return env["JUPYTER_DATA_DIR"]
|
||||
|
||||
home = get_home_dir()
|
||||
|
||||
if sys.platform == "darwin":
|
||||
return os.path.join(home, "Library", "Jupyter")
|
||||
elif os.name == "nt":
|
||||
appdata = os.environ.get("APPDATA", None)
|
||||
if appdata:
|
||||
return str(Path(appdata, "jupyter").resolve())
|
||||
else:
|
||||
return pjoin(jupyter_config_dir(), "data")
|
||||
else:
|
||||
# Linux, non-OS X Unix, AIX, etc.
|
||||
xdg = env.get("XDG_DATA_HOME", None)
|
||||
if not xdg:
|
||||
xdg = pjoin(home, ".local", "share")
|
||||
return pjoin(xdg, "jupyter")
|
||||
|
||||
|
||||
def jupyter_runtime_dir():
|
||||
"""Return the runtime dir for transient jupyter files.
|
||||
|
||||
Returns JUPYTER_RUNTIME_DIR if defined.
|
||||
|
||||
The default is now (data_dir)/runtime on all platforms;
|
||||
we no longer use XDG_RUNTIME_DIR after various problems.
|
||||
"""
|
||||
env = os.environ
|
||||
|
||||
if env.get("JUPYTER_RUNTIME_DIR"):
|
||||
return env["JUPYTER_RUNTIME_DIR"]
|
||||
|
||||
return pjoin(jupyter_data_dir(), "runtime")
|
||||
|
||||
|
||||
if os.name == "nt":
|
||||
programdata = os.environ.get("PROGRAMDATA", None)
|
||||
if programdata:
|
||||
SYSTEM_JUPYTER_PATH = [pjoin(programdata, "jupyter")]
|
||||
else: # PROGRAMDATA is not defined by default on XP.
|
||||
SYSTEM_JUPYTER_PATH = [os.path.join(sys.prefix, "share", "jupyter")]
|
||||
else:
|
||||
SYSTEM_JUPYTER_PATH = [
|
||||
"/usr/local/share/jupyter",
|
||||
"/usr/share/jupyter",
|
||||
]
|
||||
|
||||
ENV_JUPYTER_PATH = [os.path.join(sys.prefix, "share", "jupyter")]
|
||||
|
||||
|
||||
def jupyter_path(*subdirs):
|
||||
"""Return a list of directories to search for data files
|
||||
|
||||
JUPYTER_PATH environment variable has highest priority.
|
||||
|
||||
If the JUPYTER_PREFER_ENV_PATH environment variable is set, the environment-level
|
||||
directories will have priority over user-level directories.
|
||||
|
||||
If the Python site.ENABLE_USER_SITE variable is True, we also add the
|
||||
appropriate Python user site subdirectory to the user-level directories.
|
||||
|
||||
|
||||
If ``*subdirs`` are given, that subdirectory will be added to each element.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> jupyter_path()
|
||||
['~/.local/jupyter', '/usr/local/share/jupyter']
|
||||
>>> jupyter_path('kernels')
|
||||
['~/.local/jupyter/kernels', '/usr/local/share/jupyter/kernels']
|
||||
"""
|
||||
|
||||
paths: list = []
|
||||
|
||||
# highest priority is explicit environment variable
|
||||
if os.environ.get("JUPYTER_PATH"):
|
||||
paths.extend(p.rstrip(os.sep) for p in os.environ["JUPYTER_PATH"].split(os.pathsep))
|
||||
|
||||
# Next is environment or user, depending on the JUPYTER_PREFER_ENV_PATH flag
|
||||
user = [jupyter_data_dir()]
|
||||
if site.ENABLE_USER_SITE:
|
||||
# Check if site.getuserbase() exists to be compatible with virtualenv,
|
||||
# which often does not have this method.
|
||||
userbase: Optional[str]
|
||||
if hasattr(site, "getuserbase"):
|
||||
userbase = site.getuserbase()
|
||||
else:
|
||||
userbase = site.USER_BASE
|
||||
|
||||
if userbase:
|
||||
userdir = os.path.join(userbase, "share", "jupyter")
|
||||
if userdir not in user:
|
||||
user.append(userdir)
|
||||
|
||||
env = [p for p in ENV_JUPYTER_PATH if p not in SYSTEM_JUPYTER_PATH]
|
||||
|
||||
if envset("JUPYTER_PREFER_ENV_PATH"):
|
||||
paths.extend(env)
|
||||
paths.extend(user)
|
||||
else:
|
||||
paths.extend(user)
|
||||
paths.extend(env)
|
||||
|
||||
# finally, system
|
||||
paths.extend(SYSTEM_JUPYTER_PATH)
|
||||
|
||||
# add subdir, if requested
|
||||
if subdirs:
|
||||
paths = [pjoin(p, *subdirs) for p in paths]
|
||||
return paths
|
||||
|
||||
|
||||
if os.name == "nt":
|
||||
programdata = os.environ.get("PROGRAMDATA", None)
|
||||
if programdata:
|
||||
SYSTEM_CONFIG_PATH = [os.path.join(programdata, "jupyter")]
|
||||
else: # PROGRAMDATA is not defined by default on XP.
|
||||
SYSTEM_CONFIG_PATH = []
|
||||
else:
|
||||
SYSTEM_CONFIG_PATH = [
|
||||
"/usr/local/etc/jupyter",
|
||||
"/etc/jupyter",
|
||||
]
|
||||
|
||||
ENV_CONFIG_PATH = [os.path.join(sys.prefix, "etc", "jupyter")]
|
||||
|
||||
|
||||
def jupyter_config_path():
|
||||
"""Return the search path for Jupyter config files as a list.
|
||||
|
||||
If the JUPYTER_PREFER_ENV_PATH environment variable is set, the
|
||||
environment-level directories will have priority over user-level
|
||||
directories.
|
||||
|
||||
If the Python site.ENABLE_USER_SITE variable is True, we also add the
|
||||
appropriate Python user site subdirectory to the user-level directories.
|
||||
"""
|
||||
if os.environ.get("JUPYTER_NO_CONFIG"):
|
||||
# jupyter_config_dir makes a blank config when JUPYTER_NO_CONFIG is set.
|
||||
return [jupyter_config_dir()]
|
||||
|
||||
paths: list = []
|
||||
|
||||
# highest priority is explicit environment variable
|
||||
if os.environ.get("JUPYTER_CONFIG_PATH"):
|
||||
paths.extend(p.rstrip(os.sep) for p in os.environ["JUPYTER_CONFIG_PATH"].split(os.pathsep))
|
||||
|
||||
# Next is environment or user, depending on the JUPYTER_PREFER_ENV_PATH flag
|
||||
user = [jupyter_config_dir()]
|
||||
if site.ENABLE_USER_SITE:
|
||||
userbase: Optional[str]
|
||||
# Check if site.getuserbase() exists to be compatible with virtualenv,
|
||||
# which often does not have this method.
|
||||
if hasattr(site, "getuserbase"):
|
||||
userbase = site.getuserbase()
|
||||
else:
|
||||
userbase = site.USER_BASE
|
||||
|
||||
if userbase:
|
||||
userdir = os.path.join(userbase, "etc", "jupyter")
|
||||
if userdir not in user:
|
||||
user.append(userdir)
|
||||
|
||||
env = [p for p in ENV_CONFIG_PATH if p not in SYSTEM_CONFIG_PATH]
|
||||
|
||||
if envset("JUPYTER_PREFER_ENV_PATH"):
|
||||
paths.extend(env)
|
||||
paths.extend(user)
|
||||
else:
|
||||
paths.extend(user)
|
||||
paths.extend(env)
|
||||
|
||||
# Finally, system path
|
||||
paths.extend(SYSTEM_CONFIG_PATH)
|
||||
return paths
|
||||
|
||||
|
||||
def exists(path):
|
||||
"""Replacement for `os.path.exists` which works for host mapped volumes
|
||||
on Windows containers
|
||||
"""
|
||||
try:
|
||||
os.lstat(path)
|
||||
except OSError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def is_file_hidden_win(abs_path, stat_res=None):
|
||||
"""Is a file hidden?
|
||||
|
||||
This only checks the file itself; it should be called in combination with
|
||||
checking the directory containing the file.
|
||||
|
||||
Use is_hidden() instead to check the file and its parent directories.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
abs_path : unicode
|
||||
The absolute path to check.
|
||||
stat_res : os.stat_result, optional
|
||||
The result of calling stat() on abs_path. If not passed, this function
|
||||
will call stat() internally.
|
||||
"""
|
||||
if os.path.basename(abs_path).startswith("."):
|
||||
return True
|
||||
|
||||
if stat_res is None:
|
||||
try:
|
||||
stat_res = os.stat(abs_path)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
return False
|
||||
raise
|
||||
|
||||
try:
|
||||
if stat_res.st_file_attributes & stat.FILE_ATTRIBUTE_HIDDEN: # type:ignore[attr-defined]
|
||||
return True
|
||||
except AttributeError:
|
||||
# allow AttributeError on PyPy for Windows
|
||||
# 'stat_result' object has no attribute 'st_file_attributes'
|
||||
# https://foss.heptapod.net/pypy/pypy/-/issues/3469
|
||||
warnings.warn(
|
||||
"hidden files are not detectable on this system, so no file will be marked as hidden."
|
||||
)
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def is_file_hidden_posix(abs_path, stat_res=None):
|
||||
"""Is a file hidden?
|
||||
|
||||
This only checks the file itself; it should be called in combination with
|
||||
checking the directory containing the file.
|
||||
|
||||
Use is_hidden() instead to check the file and its parent directories.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
abs_path : unicode
|
||||
The absolute path to check.
|
||||
stat_res : os.stat_result, optional
|
||||
The result of calling stat() on abs_path. If not passed, this function
|
||||
will call stat() internally.
|
||||
"""
|
||||
if os.path.basename(abs_path).startswith("."):
|
||||
return True
|
||||
|
||||
if stat_res is None or stat.S_ISLNK(stat_res.st_mode):
|
||||
try:
|
||||
stat_res = os.stat(abs_path)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
return False
|
||||
raise
|
||||
|
||||
# check that dirs can be listed
|
||||
if stat.S_ISDIR(stat_res.st_mode):
|
||||
# use x-access, not actual listing, in case of slow/large listings
|
||||
if not os.access(abs_path, os.X_OK | os.R_OK):
|
||||
return True
|
||||
|
||||
# check UF_HIDDEN
|
||||
if getattr(stat_res, "st_flags", 0) & UF_HIDDEN:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
if sys.platform == "win32":
|
||||
is_file_hidden = is_file_hidden_win
|
||||
else:
|
||||
is_file_hidden = is_file_hidden_posix
|
||||
|
||||
|
||||
def is_hidden(abs_path, abs_root=""):
|
||||
"""Is a file hidden or contained in a hidden directory?
|
||||
|
||||
This will start with the rightmost path element and work backwards to the
|
||||
given root to see if a path is hidden or in a hidden directory. Hidden is
|
||||
determined by either name starting with '.' or the UF_HIDDEN flag as
|
||||
reported by stat.
|
||||
|
||||
If abs_path is the same directory as abs_root, it will be visible even if
|
||||
that is a hidden folder. This only checks the visibility of files
|
||||
and directories *within* abs_root.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
abs_path : unicode
|
||||
The absolute path to check for hidden directories.
|
||||
abs_root : unicode
|
||||
The absolute path of the root directory in which hidden directories
|
||||
should be checked for.
|
||||
"""
|
||||
if os.path.normpath(abs_path) == os.path.normpath(abs_root):
|
||||
return False
|
||||
|
||||
if is_file_hidden(abs_path):
|
||||
return True
|
||||
|
||||
if not abs_root:
|
||||
abs_root = abs_path.split(os.sep, 1)[0] + os.sep
|
||||
inside_root = abs_path[len(abs_root) :]
|
||||
if any(part.startswith(".") for part in inside_root.split(os.sep)):
|
||||
return True
|
||||
|
||||
# check UF_HIDDEN on any location up to root.
|
||||
# is_file_hidden() already checked the file, so start from its parent dir
|
||||
path = os.path.dirname(abs_path)
|
||||
while path and path.startswith(abs_root) and path != abs_root:
|
||||
if not exists(path):
|
||||
path = os.path.dirname(path)
|
||||
continue
|
||||
try:
|
||||
# may fail on Windows junctions
|
||||
st = os.lstat(path)
|
||||
except OSError:
|
||||
return True
|
||||
if getattr(st, "st_flags", 0) & UF_HIDDEN:
|
||||
return True
|
||||
path = os.path.dirname(path)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def win32_restrict_file_to_user(fname):
|
||||
"""Secure a windows file to read-only access for the user.
|
||||
Follows guidance from win32 library creator:
|
||||
http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html
|
||||
|
||||
This method should be executed against an already generated file which
|
||||
has no secrets written to it yet.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
fname : unicode
|
||||
The path to the file to secure
|
||||
"""
|
||||
try:
|
||||
import win32api # type:ignore[import]
|
||||
except ImportError:
|
||||
return _win32_restrict_file_to_user_ctypes(fname)
|
||||
|
||||
import ntsecuritycon as con # type:ignore[import]
|
||||
import win32security # type:ignore[import]
|
||||
|
||||
# everyone, _domain, _type = win32security.LookupAccountName("", "Everyone")
|
||||
admins = win32security.CreateWellKnownSid(win32security.WinBuiltinAdministratorsSid)
|
||||
user, _domain, _type = win32security.LookupAccountName(
|
||||
"", win32api.GetUserNameEx(win32api.NameSamCompatible)
|
||||
)
|
||||
|
||||
sd = win32security.GetFileSecurity(fname, win32security.DACL_SECURITY_INFORMATION)
|
||||
|
||||
dacl = win32security.ACL()
|
||||
# dacl.AddAccessAllowedAce(win32security.ACL_REVISION, con.FILE_ALL_ACCESS, everyone)
|
||||
dacl.AddAccessAllowedAce(
|
||||
win32security.ACL_REVISION,
|
||||
con.FILE_GENERIC_READ | con.FILE_GENERIC_WRITE | con.DELETE,
|
||||
user,
|
||||
)
|
||||
dacl.AddAccessAllowedAce(win32security.ACL_REVISION, con.FILE_ALL_ACCESS, admins)
|
||||
|
||||
sd.SetSecurityDescriptorDacl(1, dacl, 0)
|
||||
win32security.SetFileSecurity(fname, win32security.DACL_SECURITY_INFORMATION, sd)
|
||||
|
||||
|
||||
def _win32_restrict_file_to_user_ctypes(fname):
|
||||
"""Secure a windows file to read-only access for the user.
|
||||
|
||||
Follows guidance from win32 library creator:
|
||||
http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html
|
||||
|
||||
This method should be executed against an already generated file which
|
||||
has no secrets written to it yet.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
fname : unicode
|
||||
The path to the file to secure
|
||||
"""
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
|
||||
advapi32 = ctypes.WinDLL("advapi32", use_last_error=True) # type:ignore[attr-defined]
|
||||
secur32 = ctypes.WinDLL("secur32", use_last_error=True) # type:ignore[attr-defined]
|
||||
|
||||
NameSamCompatible = 2
|
||||
WinBuiltinAdministratorsSid = 26
|
||||
DACL_SECURITY_INFORMATION = 4
|
||||
ACL_REVISION = 2
|
||||
ERROR_INSUFFICIENT_BUFFER = 122
|
||||
ERROR_MORE_DATA = 234
|
||||
|
||||
SYNCHRONIZE = 0x100000
|
||||
DELETE = 0x00010000
|
||||
STANDARD_RIGHTS_REQUIRED = 0xF0000
|
||||
STANDARD_RIGHTS_READ = 0x20000
|
||||
STANDARD_RIGHTS_WRITE = 0x20000
|
||||
FILE_READ_DATA = 1
|
||||
FILE_READ_EA = 8
|
||||
FILE_READ_ATTRIBUTES = 128
|
||||
FILE_WRITE_DATA = 2
|
||||
FILE_APPEND_DATA = 4
|
||||
FILE_WRITE_EA = 16
|
||||
FILE_WRITE_ATTRIBUTES = 256
|
||||
FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF
|
||||
FILE_GENERIC_READ = (
|
||||
STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE
|
||||
)
|
||||
FILE_GENERIC_WRITE = (
|
||||
STANDARD_RIGHTS_WRITE
|
||||
| FILE_WRITE_DATA
|
||||
| FILE_WRITE_ATTRIBUTES
|
||||
| FILE_WRITE_EA
|
||||
| FILE_APPEND_DATA
|
||||
| SYNCHRONIZE
|
||||
)
|
||||
|
||||
class ACL(ctypes.Structure):
|
||||
_fields_ = [
|
||||
("AclRevision", wintypes.BYTE),
|
||||
("Sbz1", wintypes.BYTE),
|
||||
("AclSize", wintypes.WORD),
|
||||
("AceCount", wintypes.WORD),
|
||||
("Sbz2", wintypes.WORD),
|
||||
]
|
||||
|
||||
PSID = ctypes.c_void_p
|
||||
PACL = ctypes.POINTER(ACL)
|
||||
PSECURITY_DESCRIPTOR = ctypes.POINTER(wintypes.BYTE)
|
||||
|
||||
def _nonzero_success(result, func, args):
|
||||
if not result:
|
||||
raise ctypes.WinError(ctypes.get_last_error()) # type:ignore[attr-defined]
|
||||
return args
|
||||
|
||||
secur32.GetUserNameExW.errcheck = _nonzero_success
|
||||
secur32.GetUserNameExW.restype = wintypes.BOOL
|
||||
secur32.GetUserNameExW.argtypes = (
|
||||
ctypes.c_int, # EXTENDED_NAME_FORMAT NameFormat
|
||||
wintypes.LPWSTR, # LPWSTR lpNameBuffer,
|
||||
wintypes.PULONG, # PULONG nSize
|
||||
)
|
||||
|
||||
advapi32.CreateWellKnownSid.errcheck = _nonzero_success
|
||||
advapi32.CreateWellKnownSid.restype = wintypes.BOOL
|
||||
advapi32.CreateWellKnownSid.argtypes = (
|
||||
wintypes.DWORD, # WELL_KNOWN_SID_TYPE WellKnownSidType
|
||||
PSID, # PSID DomainSid
|
||||
PSID, # PSID pSid
|
||||
wintypes.PDWORD, # DWORD *cbSid
|
||||
)
|
||||
|
||||
advapi32.LookupAccountNameW.errcheck = _nonzero_success
|
||||
advapi32.LookupAccountNameW.restype = wintypes.BOOL
|
||||
advapi32.LookupAccountNameW.argtypes = (
|
||||
wintypes.LPWSTR, # LPCWSTR lpSystemName
|
||||
wintypes.LPWSTR, # LPCWSTR lpAccountName
|
||||
PSID, # PSID Sid
|
||||
wintypes.LPDWORD, # LPDWORD cbSid
|
||||
wintypes.LPWSTR, # LPCWSTR ReferencedDomainName
|
||||
wintypes.LPDWORD, # LPDWORD cchReferencedDomainName
|
||||
wintypes.LPDWORD, # PSID_NAME_USE peUse
|
||||
)
|
||||
|
||||
advapi32.AddAccessAllowedAce.errcheck = _nonzero_success
|
||||
advapi32.AddAccessAllowedAce.restype = wintypes.BOOL
|
||||
advapi32.AddAccessAllowedAce.argtypes = (
|
||||
PACL, # PACL pAcl
|
||||
wintypes.DWORD, # DWORD dwAceRevision
|
||||
wintypes.DWORD, # DWORD AccessMask
|
||||
PSID, # PSID pSid
|
||||
)
|
||||
|
||||
advapi32.SetSecurityDescriptorDacl.errcheck = _nonzero_success
|
||||
advapi32.SetSecurityDescriptorDacl.restype = wintypes.BOOL
|
||||
advapi32.SetSecurityDescriptorDacl.argtypes = (
|
||||
PSECURITY_DESCRIPTOR, # PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||
wintypes.BOOL, # BOOL bDaclPresent
|
||||
PACL, # PACL pDacl
|
||||
wintypes.BOOL, # BOOL bDaclDefaulted
|
||||
)
|
||||
|
||||
advapi32.GetFileSecurityW.errcheck = _nonzero_success
|
||||
advapi32.GetFileSecurityW.restype = wintypes.BOOL
|
||||
advapi32.GetFileSecurityW.argtypes = (
|
||||
wintypes.LPCWSTR, # LPCWSTR lpFileName
|
||||
wintypes.DWORD, # SECURITY_INFORMATION RequestedInformation
|
||||
PSECURITY_DESCRIPTOR, # PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||
wintypes.DWORD, # DWORD nLength
|
||||
wintypes.LPDWORD, # LPDWORD lpnLengthNeeded
|
||||
)
|
||||
|
||||
advapi32.SetFileSecurityW.errcheck = _nonzero_success
|
||||
advapi32.SetFileSecurityW.restype = wintypes.BOOL
|
||||
advapi32.SetFileSecurityW.argtypes = (
|
||||
wintypes.LPCWSTR, # LPCWSTR lpFileName
|
||||
wintypes.DWORD, # SECURITY_INFORMATION SecurityInformation
|
||||
PSECURITY_DESCRIPTOR, # PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||
)
|
||||
|
||||
advapi32.MakeAbsoluteSD.errcheck = _nonzero_success
|
||||
advapi32.MakeAbsoluteSD.restype = wintypes.BOOL
|
||||
advapi32.MakeAbsoluteSD.argtypes = (
|
||||
PSECURITY_DESCRIPTOR, # pSelfRelativeSecurityDescriptor
|
||||
PSECURITY_DESCRIPTOR, # pAbsoluteSecurityDescriptor
|
||||
wintypes.LPDWORD, # LPDWORD lpdwAbsoluteSecurityDescriptorSize
|
||||
PACL, # PACL pDacl
|
||||
wintypes.LPDWORD, # LPDWORD lpdwDaclSize
|
||||
PACL, # PACL pSacl
|
||||
wintypes.LPDWORD, # LPDWORD lpdwSaclSize
|
||||
PSID, # PSID pOwner
|
||||
wintypes.LPDWORD, # LPDWORD lpdwOwnerSize
|
||||
PSID, # PSID pPrimaryGroup
|
||||
wintypes.LPDWORD, # LPDWORD lpdwPrimaryGroupSize
|
||||
)
|
||||
|
||||
advapi32.MakeSelfRelativeSD.errcheck = _nonzero_success
|
||||
advapi32.MakeSelfRelativeSD.restype = wintypes.BOOL
|
||||
advapi32.MakeSelfRelativeSD.argtypes = (
|
||||
PSECURITY_DESCRIPTOR, # pAbsoluteSecurityDescriptor
|
||||
PSECURITY_DESCRIPTOR, # pSelfRelativeSecurityDescriptor
|
||||
wintypes.LPDWORD, # LPDWORD lpdwBufferLength
|
||||
)
|
||||
|
||||
advapi32.InitializeAcl.errcheck = _nonzero_success
|
||||
advapi32.InitializeAcl.restype = wintypes.BOOL
|
||||
advapi32.InitializeAcl.argtypes = (
|
||||
PACL, # PACL pAcl,
|
||||
wintypes.DWORD, # DWORD nAclLength,
|
||||
wintypes.DWORD, # DWORD dwAclRevision
|
||||
)
|
||||
|
||||
def CreateWellKnownSid(WellKnownSidType):
|
||||
# return a SID for predefined aliases
|
||||
pSid = (ctypes.c_char * 1)()
|
||||
cbSid = wintypes.DWORD()
|
||||
try:
|
||||
advapi32.CreateWellKnownSid(WellKnownSidType, None, pSid, ctypes.byref(cbSid))
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_INSUFFICIENT_BUFFER: # type:ignore[attr-defined]
|
||||
raise
|
||||
pSid = (ctypes.c_char * cbSid.value)()
|
||||
advapi32.CreateWellKnownSid(WellKnownSidType, None, pSid, ctypes.byref(cbSid))
|
||||
return pSid[:]
|
||||
|
||||
def GetUserNameEx(NameFormat):
|
||||
# return the user or other security principal associated with
|
||||
# the calling thread
|
||||
nSize = ctypes.pointer(ctypes.c_ulong(0))
|
||||
try:
|
||||
secur32.GetUserNameExW(NameFormat, None, nSize)
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_MORE_DATA: # type:ignore[attr-defined]
|
||||
raise
|
||||
if not nSize.contents.value:
|
||||
return None
|
||||
lpNameBuffer = ctypes.create_unicode_buffer(nSize.contents.value)
|
||||
secur32.GetUserNameExW(NameFormat, lpNameBuffer, nSize)
|
||||
return lpNameBuffer.value
|
||||
|
||||
def LookupAccountName(lpSystemName, lpAccountName):
|
||||
# return a security identifier (SID) for an account on a system
|
||||
# and the name of the domain on which the account was found
|
||||
cbSid = wintypes.DWORD(0)
|
||||
cchReferencedDomainName = wintypes.DWORD(0)
|
||||
peUse = wintypes.DWORD(0)
|
||||
try:
|
||||
advapi32.LookupAccountNameW(
|
||||
lpSystemName,
|
||||
lpAccountName,
|
||||
None,
|
||||
ctypes.byref(cbSid),
|
||||
None,
|
||||
ctypes.byref(cchReferencedDomainName),
|
||||
ctypes.byref(peUse),
|
||||
)
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_INSUFFICIENT_BUFFER: # type:ignore[attr-defined]
|
||||
raise
|
||||
Sid = ctypes.create_unicode_buffer("", cbSid.value)
|
||||
pSid = ctypes.cast(ctypes.pointer(Sid), wintypes.LPVOID)
|
||||
lpReferencedDomainName = ctypes.create_unicode_buffer("", cchReferencedDomainName.value + 1)
|
||||
success = advapi32.LookupAccountNameW(
|
||||
lpSystemName,
|
||||
lpAccountName,
|
||||
pSid,
|
||||
ctypes.byref(cbSid),
|
||||
lpReferencedDomainName,
|
||||
ctypes.byref(cchReferencedDomainName),
|
||||
ctypes.byref(peUse),
|
||||
)
|
||||
if not success:
|
||||
raise ctypes.WinError() # type:ignore[attr-defined]
|
||||
return pSid, lpReferencedDomainName.value, peUse.value
|
||||
|
||||
def AddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid):
|
||||
# add an access-allowed access control entry (ACE)
|
||||
# to an access control list (ACL)
|
||||
advapi32.AddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid)
|
||||
|
||||
def GetFileSecurity(lpFileName, RequestedInformation):
|
||||
# return information about the security of a file or directory
|
||||
nLength = wintypes.DWORD(0)
|
||||
try:
|
||||
advapi32.GetFileSecurityW(
|
||||
lpFileName,
|
||||
RequestedInformation,
|
||||
None,
|
||||
0,
|
||||
ctypes.byref(nLength),
|
||||
)
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_INSUFFICIENT_BUFFER: # type:ignore[attr-defined]
|
||||
raise
|
||||
if not nLength.value:
|
||||
return None
|
||||
pSecurityDescriptor = (wintypes.BYTE * nLength.value)()
|
||||
advapi32.GetFileSecurityW(
|
||||
lpFileName,
|
||||
RequestedInformation,
|
||||
pSecurityDescriptor,
|
||||
nLength,
|
||||
ctypes.byref(nLength),
|
||||
)
|
||||
return pSecurityDescriptor
|
||||
|
||||
def SetFileSecurity(lpFileName, RequestedInformation, pSecurityDescriptor):
|
||||
# set the security of a file or directory object
|
||||
advapi32.SetFileSecurityW(lpFileName, RequestedInformation, pSecurityDescriptor)
|
||||
|
||||
def SetSecurityDescriptorDacl(pSecurityDescriptor, bDaclPresent, pDacl, bDaclDefaulted):
|
||||
# set information in a discretionary access control list (DACL)
|
||||
advapi32.SetSecurityDescriptorDacl(pSecurityDescriptor, bDaclPresent, pDacl, bDaclDefaulted)
|
||||
|
||||
def MakeAbsoluteSD(pSelfRelativeSecurityDescriptor):
|
||||
# return a security descriptor in absolute format
|
||||
# by using a security descriptor in self-relative format as a template
|
||||
pAbsoluteSecurityDescriptor = None
|
||||
lpdwAbsoluteSecurityDescriptorSize = wintypes.DWORD(0)
|
||||
pDacl = None
|
||||
lpdwDaclSize = wintypes.DWORD(0)
|
||||
pSacl = None
|
||||
lpdwSaclSize = wintypes.DWORD(0)
|
||||
pOwner = None
|
||||
lpdwOwnerSize = wintypes.DWORD(0)
|
||||
pPrimaryGroup = None
|
||||
lpdwPrimaryGroupSize = wintypes.DWORD(0)
|
||||
try:
|
||||
advapi32.MakeAbsoluteSD(
|
||||
pSelfRelativeSecurityDescriptor,
|
||||
pAbsoluteSecurityDescriptor,
|
||||
ctypes.byref(lpdwAbsoluteSecurityDescriptorSize),
|
||||
pDacl,
|
||||
ctypes.byref(lpdwDaclSize),
|
||||
pSacl,
|
||||
ctypes.byref(lpdwSaclSize),
|
||||
pOwner,
|
||||
ctypes.byref(lpdwOwnerSize),
|
||||
pPrimaryGroup,
|
||||
ctypes.byref(lpdwPrimaryGroupSize),
|
||||
)
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_INSUFFICIENT_BUFFER: # type:ignore[attr-defined]
|
||||
raise
|
||||
pAbsoluteSecurityDescriptor = (wintypes.BYTE * lpdwAbsoluteSecurityDescriptorSize.value)()
|
||||
pDaclData = (wintypes.BYTE * lpdwDaclSize.value)()
|
||||
pDacl = ctypes.cast(pDaclData, PACL).contents
|
||||
pSaclData = (wintypes.BYTE * lpdwSaclSize.value)()
|
||||
pSacl = ctypes.cast(pSaclData, PACL).contents
|
||||
pOwnerData = (wintypes.BYTE * lpdwOwnerSize.value)()
|
||||
pOwner = ctypes.cast(pOwnerData, PSID)
|
||||
pPrimaryGroupData = (wintypes.BYTE * lpdwPrimaryGroupSize.value)()
|
||||
pPrimaryGroup = ctypes.cast(pPrimaryGroupData, PSID)
|
||||
advapi32.MakeAbsoluteSD(
|
||||
pSelfRelativeSecurityDescriptor,
|
||||
pAbsoluteSecurityDescriptor,
|
||||
ctypes.byref(lpdwAbsoluteSecurityDescriptorSize),
|
||||
pDacl,
|
||||
ctypes.byref(lpdwDaclSize),
|
||||
pSacl,
|
||||
ctypes.byref(lpdwSaclSize),
|
||||
pOwner,
|
||||
lpdwOwnerSize,
|
||||
pPrimaryGroup,
|
||||
ctypes.byref(lpdwPrimaryGroupSize),
|
||||
)
|
||||
return pAbsoluteSecurityDescriptor
|
||||
|
||||
def MakeSelfRelativeSD(pAbsoluteSecurityDescriptor):
|
||||
# return a security descriptor in self-relative format
|
||||
# by using a security descriptor in absolute format as a template
|
||||
pSelfRelativeSecurityDescriptor = None
|
||||
lpdwBufferLength = wintypes.DWORD(0)
|
||||
try:
|
||||
advapi32.MakeSelfRelativeSD(
|
||||
pAbsoluteSecurityDescriptor,
|
||||
pSelfRelativeSecurityDescriptor,
|
||||
ctypes.byref(lpdwBufferLength),
|
||||
)
|
||||
except OSError as e:
|
||||
if e.winerror != ERROR_INSUFFICIENT_BUFFER: # type:ignore[attr-defined]
|
||||
raise
|
||||
pSelfRelativeSecurityDescriptor = (wintypes.BYTE * lpdwBufferLength.value)()
|
||||
advapi32.MakeSelfRelativeSD(
|
||||
pAbsoluteSecurityDescriptor,
|
||||
pSelfRelativeSecurityDescriptor,
|
||||
ctypes.byref(lpdwBufferLength),
|
||||
)
|
||||
return pSelfRelativeSecurityDescriptor
|
||||
|
||||
def NewAcl():
|
||||
# return a new, initialized ACL (access control list) structure
|
||||
nAclLength = 32767 # TODO: calculate this: ctypes.sizeof(ACL) + ?
|
||||
acl_data = ctypes.create_string_buffer(nAclLength)
|
||||
pAcl = ctypes.cast(acl_data, PACL).contents
|
||||
advapi32.InitializeAcl(pAcl, nAclLength, ACL_REVISION)
|
||||
return pAcl
|
||||
|
||||
SidAdmins = CreateWellKnownSid(WinBuiltinAdministratorsSid)
|
||||
SidUser = LookupAccountName("", GetUserNameEx(NameSamCompatible))[0]
|
||||
|
||||
Acl = NewAcl()
|
||||
AddAccessAllowedAce(Acl, ACL_REVISION, FILE_ALL_ACCESS, SidAdmins)
|
||||
AddAccessAllowedAce(
|
||||
Acl,
|
||||
ACL_REVISION,
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE | DELETE,
|
||||
SidUser,
|
||||
)
|
||||
|
||||
SelfRelativeSD = GetFileSecurity(fname, DACL_SECURITY_INFORMATION)
|
||||
AbsoluteSD = MakeAbsoluteSD(SelfRelativeSD)
|
||||
SetSecurityDescriptorDacl(AbsoluteSD, 1, Acl, 0)
|
||||
SelfRelativeSD = MakeSelfRelativeSD(AbsoluteSD)
|
||||
|
||||
SetFileSecurity(fname, DACL_SECURITY_INFORMATION, SelfRelativeSD)
|
||||
|
||||
|
||||
def get_file_mode(fname):
|
||||
"""Retrieves the file mode corresponding to fname in a filesystem-tolerant manner.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
fname : unicode
|
||||
The path to the file to get mode from
|
||||
|
||||
"""
|
||||
# Some filesystems (e.g., CIFS) auto-enable the execute bit on files. As a result, we
|
||||
# should tolerate the execute bit on the file's owner when validating permissions - thus
|
||||
# the missing least significant bit on the third octal digit. In addition, we also tolerate
|
||||
# the sticky bit being set, so the lsb from the fourth octal digit is also removed.
|
||||
return (
|
||||
stat.S_IMODE(os.stat(fname).st_mode) & 0o6677
|
||||
) # Use 4 octal digits since S_IMODE does the same
|
||||
|
||||
|
||||
allow_insecure_writes = os.getenv("JUPYTER_ALLOW_INSECURE_WRITES", "false").lower() in ("true", "1")
|
||||
|
||||
|
||||
@contextmanager
|
||||
def secure_write(fname, binary=False):
|
||||
"""Opens a file in the most restricted pattern available for
|
||||
writing content. This limits the file mode to `0o0600` and yields
|
||||
the resulting opened filed handle.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
fname : unicode
|
||||
The path to the file to write
|
||||
|
||||
binary: boolean
|
||||
Indicates that the file is binary
|
||||
"""
|
||||
mode = "wb" if binary else "w"
|
||||
encoding = None if binary else "utf-8"
|
||||
open_flag = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
|
||||
try:
|
||||
os.remove(fname)
|
||||
except OSError:
|
||||
# Skip any issues with the file not existing
|
||||
pass
|
||||
|
||||
if os.name == "nt":
|
||||
if allow_insecure_writes:
|
||||
# Mounted file systems can have a number of failure modes inside this block.
|
||||
# For windows machines in insecure mode we simply skip this to avoid failures :/
|
||||
issue_insecure_write_warning()
|
||||
else:
|
||||
# Python on windows does not respect the group and public bits for chmod, so we need
|
||||
# to take additional steps to secure the contents.
|
||||
# Touch file pre-emptively to avoid editing permissions in open files in Windows
|
||||
fd = os.open(fname, open_flag, 0o0600)
|
||||
os.close(fd)
|
||||
open_flag = os.O_WRONLY | os.O_TRUNC
|
||||
win32_restrict_file_to_user(fname)
|
||||
|
||||
with os.fdopen(os.open(fname, open_flag, 0o0600), mode, encoding=encoding) as f:
|
||||
if os.name != "nt":
|
||||
# Enforce that the file got the requested permissions before writing
|
||||
file_mode = get_file_mode(fname)
|
||||
if 0o0600 != file_mode:
|
||||
if allow_insecure_writes:
|
||||
issue_insecure_write_warning()
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Permissions assignment failed for secure file: '{file}'."
|
||||
" Got '{permissions}' instead of '0o0600'.".format(
|
||||
file=fname, permissions=oct(file_mode)
|
||||
)
|
||||
)
|
||||
yield f
|
||||
|
||||
|
||||
def issue_insecure_write_warning():
|
||||
def format_warning(msg, *args, **kwargs):
|
||||
return str(msg) + "\n"
|
||||
|
||||
warnings.formatwarning = format_warning # type:ignore[assignment]
|
||||
warnings.warn(
|
||||
"WARNING: Insecure writes have been enabled via environment variable "
|
||||
"'JUPYTER_ALLOW_INSECURE_WRITES'! If this is not intended, remove the "
|
||||
"variable or set its value to 'False'."
|
||||
)
|
0
.venv/Lib/site-packages/jupyter_core/py.typed
Normal file
0
.venv/Lib/site-packages/jupyter_core/py.typed
Normal file
@ -0,0 +1 @@
|
||||
var hello;
|
@ -0,0 +1,549 @@
|
||||
# Configuration file for ipython.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# InteractiveShellApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A Mixin for applications that start InteractiveShell instances.
|
||||
#
|
||||
# Provides configurables for loading extensions and executing files as part of
|
||||
# configuring a Shell environment.
|
||||
#
|
||||
# The following methods should be called by the :meth:`initialize` method of the
|
||||
# subclass:
|
||||
#
|
||||
# - :meth:`init_path`
|
||||
# - :meth:`init_shell` (to be implemented by the subclass)
|
||||
# - :meth:`init_gui_pylab`
|
||||
# - :meth:`init_extensions`
|
||||
# - :meth:`init_code`
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.InteractiveShellApp.exec_lines = []
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.InteractiveShellApp.hide_initial_ns = True
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.InteractiveShellApp.extensions = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.InteractiveShellApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.InteractiveShellApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.InteractiveShellApp.matplotlib = None
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.InteractiveShellApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.InteractiveShellApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.InteractiveShellApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.InteractiveShellApp.module_to_run = ''
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.InteractiveShellApp.extra_extension = ''
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.InteractiveShellApp.exec_files = []
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.InteractiveShellApp.pylab_import_all = True
|
||||
|
||||
# Execute the given command string.
|
||||
# c.InteractiveShellApp.code_to_run = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TerminalIPythonApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# TerminalIPythonApp will inherit config from: BaseIPythonApplication,
|
||||
# Application, InteractiveShellApp
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.TerminalIPythonApp.hide_initial_ns = True
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.TerminalIPythonApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.TerminalIPythonApp.code_to_run = ''
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.TerminalIPythonApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.TerminalIPythonApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.TerminalIPythonApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.TerminalIPythonApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.TerminalIPythonApp.module_to_run = ''
|
||||
|
||||
# Whether to display a banner upon starting IPython.
|
||||
# c.TerminalIPythonApp.display_banner = True
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.TerminalIPythonApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.TerminalIPythonApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.TerminalIPythonApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.TerminalIPythonApp.profile = 'default'
|
||||
|
||||
# If a command or file is given via the command-line, e.g. 'ipython foo.py',
|
||||
# start an interactive shell after executing the file or command.
|
||||
# c.TerminalIPythonApp.force_interact = False
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.TerminalIPythonApp.exec_files = []
|
||||
|
||||
# Start IPython quickly by skipping the loading of config files.
|
||||
# c.TerminalIPythonApp.quick = False
|
||||
|
||||
# The Logging format template
|
||||
# c.TerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.TerminalIPythonApp.copy_config_files = False
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.TerminalIPythonApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.TerminalIPythonApp.exec_lines = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.TerminalIPythonApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.TerminalIPythonApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.TerminalIPythonApp.matplotlib = None
|
||||
|
||||
# Suppress warning messages about legacy config files
|
||||
# c.TerminalIPythonApp.ignore_old_config = False
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.TerminalIPythonApp.ipython_dir = ''
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.TerminalIPythonApp.pylab_import_all = True
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TerminalInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# TerminalInteractiveShell will inherit config from: InteractiveShell
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.TerminalInteractiveShell.pdb = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.ipython_dir = ''
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.history_length = 10000
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# auto editing of files with syntax errors.
|
||||
# c.TerminalInteractiveShell.autoedit_syntax = False
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.TerminalInteractiveShell.display_page = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.debug = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_in = '\n'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.TerminalInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.TerminalInteractiveShell.cache_size = 1000
|
||||
|
||||
# Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,
|
||||
# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a
|
||||
# direct exit without any confirmation.
|
||||
# c.TerminalInteractiveShell.confirm_exit = True
|
||||
|
||||
# The shell program to be used for paging.
|
||||
# c.TerminalInteractiveShell.pager = 'less'
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.TerminalInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.TerminalInteractiveShell.logfile = ''
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.TerminalInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.quiet = False
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.TerminalInteractiveShell.multiline_history = True
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.TerminalInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_use = True
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.TerminalInteractiveShell.automagic = True
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.TerminalInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.TerminalInteractiveShell.autocall = 0
|
||||
|
||||
# Autoindent IPython code entered interactively.
|
||||
# c.TerminalInteractiveShell.autoindent = True
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.TerminalInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Set the editor used by IPython (default to $EDITOR/vi/notepad).
|
||||
# c.TerminalInteractiveShell.editor = 'mate -w'
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.TerminalInteractiveShell.color_info = True
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.TerminalInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_out2 = ''
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.TerminalInteractiveShell.banner2 = ''
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.TerminalInteractiveShell.logappend = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.TerminalInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.TerminalInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.TerminalInteractiveShell.deep_reload = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.xmode = 'Context'
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.TerminalInteractiveShell.show_rewritten_input = True
|
||||
|
||||
# Number of lines of your screen, used to control printing of very long strings.
|
||||
# Strings longer than this number of lines will be sent through a pager instead
|
||||
# of directly printed. The default value for this is 0, which means IPython
|
||||
# will auto-detect your screen size every time it needs to print certain
|
||||
# potentially long strings (this doesn't change the behavior of the 'print'
|
||||
# keyword, it's only triggered internally). If for some reason this isn't
|
||||
# working well (it needs curses support), specify it yourself. Otherwise don't
|
||||
# change the default.
|
||||
# c.TerminalInteractiveShell.screen_length = 0
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.TerminalInteractiveShell.ast_transformers = []
|
||||
|
||||
# Enable auto setting the terminal title.
|
||||
# c.TerminalInteractiveShell.term_title = False
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PromptManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# This is the primary interface for producing IPython's prompts.
|
||||
|
||||
#
|
||||
# c.PromptManager.color_scheme = 'Linux'
|
||||
|
||||
# Continuation prompt.
|
||||
# c.PromptManager.in2_template = ' .\\D.: '
|
||||
|
||||
# Input prompt. '\#' will be transformed to the prompt number
|
||||
# c.PromptManager.in_template = 'In [\\#]: '
|
||||
|
||||
# Output prompt. '\#' will be transformed to the prompt number
|
||||
# c.PromptManager.out_template = 'Out[\\#]: '
|
||||
|
||||
# If True (default), each prompt will be right-aligned with the preceding one.
|
||||
# c.PromptManager.justify = True
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# HistoryManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A class to organize all history-related functionality in one place.
|
||||
|
||||
# HistoryManager will inherit config from: HistoryAccessor
|
||||
|
||||
# Options for configuring the SQLite connection
|
||||
#
|
||||
# These options are passed as keyword args to sqlite3.connect when establishing
|
||||
# database conenctions.
|
||||
# c.HistoryManager.connection_options = {}
|
||||
|
||||
# Should the history database include output? (default: no)
|
||||
# c.HistoryManager.db_log_output = False
|
||||
|
||||
# enable the SQLite history
|
||||
#
|
||||
# set enabled=False to disable the SQLite history, in which case there will be
|
||||
# no stored history, no SQLite connection, and no background saving thread.
|
||||
# This may be necessary in some threaded environments where IPython is embedded.
|
||||
# c.HistoryManager.enabled = True
|
||||
|
||||
# Path to file to use for SQLite history database.
|
||||
#
|
||||
# By default, IPython will put the history database in the IPython profile
|
||||
# directory. If you would rather share one history among profiles, you can set
|
||||
# this value in each, so that they are consistent.
|
||||
#
|
||||
# Due to an issue with fcntl, SQLite is known to misbehave on some NFS mounts.
|
||||
# If you see IPython hanging, try setting this to something on a local disk,
|
||||
# e.g::
|
||||
#
|
||||
# ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite
|
||||
# c.HistoryManager.hist_file = ''
|
||||
|
||||
# Write to database every x commands (higher values save disk access & power).
|
||||
# Values of 1 or less effectively disable caching.
|
||||
# c.HistoryManager.db_cache_size = 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PlainTextFormatter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# The default pretty-printer.
|
||||
#
|
||||
# This uses :mod:`IPython.lib.pretty` to compute the format data of the object.
|
||||
# If the object cannot be pretty printed, :func:`repr` is used. See the
|
||||
# documentation of :mod:`IPython.lib.pretty` for details on how to write pretty
|
||||
# printers. Here is a simple example::
|
||||
#
|
||||
# def dtype_pprinter(obj, p, cycle):
|
||||
# if cycle:
|
||||
# return p.text('dtype(...)')
|
||||
# if hasattr(obj, 'fields'):
|
||||
# if obj.fields is None:
|
||||
# p.text(repr(obj))
|
||||
# else:
|
||||
# p.begin_group(7, 'dtype([')
|
||||
# for i, field in enumerate(obj.descr):
|
||||
# if i > 0:
|
||||
# p.text(',')
|
||||
# p.breakable()
|
||||
# p.pretty(field)
|
||||
# p.end_group(7, '])')
|
||||
|
||||
# PlainTextFormatter will inherit config from: BaseFormatter
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.newline = '\n'
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.max_width = 79
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.verbose = False
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.pprint = True
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.singleton_printers = {}
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.type_printers = {}
|
||||
|
||||
# Truncate large collections (lists, dicts, tuples, sets) to this size.
|
||||
#
|
||||
# Set to 0 to disable truncation.
|
||||
# c.PlainTextFormatter.max_seq_length = 1000
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.deferred_printers = {}
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.float_precision = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPCompleter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Extension of the completer class with IPython-specific features
|
||||
|
||||
# IPCompleter will inherit config from: Completer
|
||||
|
||||
# Whether to merge completion results into a single list
|
||||
#
|
||||
# If False, only the completion results from the first non-empty completer will
|
||||
# be returned.
|
||||
# c.IPCompleter.merge_completions = True
|
||||
|
||||
# Activate greedy completion
|
||||
#
|
||||
# This will enable completion on elements of lists, results of function calls,
|
||||
# etc., but can be unsafe because the code is actually evaluated on TAB.
|
||||
# c.IPCompleter.greedy = False
|
||||
|
||||
# Instruct the completer to use __all__ for the completion
|
||||
#
|
||||
# Specifically, when completing on ``object.<tab>``.
|
||||
#
|
||||
# When True: only those names in obj.__all__ will be included.
|
||||
#
|
||||
# When False [default]: the __all__ attribute is ignored
|
||||
# c.IPCompleter.limit_to__all__ = False
|
||||
|
||||
# Instruct the completer to omit private method names
|
||||
#
|
||||
# Specifically, when completing on ``object.<tab>``.
|
||||
#
|
||||
# When 2 [default]: all names that start with '_' will be excluded.
|
||||
#
|
||||
# When 1: all 'magic' names (``__foo__``) will be excluded.
|
||||
#
|
||||
# When 0: nothing will be excluded.
|
||||
# c.IPCompleter.omit__names = 2
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ScriptMagics configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Magics for talking to scripts
|
||||
#
|
||||
# This defines a base `%%script` cell magic for running a cell with a program in
|
||||
# a subprocess, and registers a few top-level magics that call %%script with
|
||||
# common interpreters.
|
||||
|
||||
# Extra script cell magics to define
|
||||
#
|
||||
# This generates simple wrappers of `%%script foo` as `%%foo`.
|
||||
#
|
||||
# If you want to add script magics that aren't on your path, specify them in
|
||||
# script_paths
|
||||
# c.ScriptMagics.script_magics = []
|
||||
|
||||
# Dict mapping short 'ruby' names to full paths, such as '/opt/secret/bin/ruby'
|
||||
#
|
||||
# Only necessary for items in script_magics where the default path will not find
|
||||
# the right interpreter.
|
||||
# c.ScriptMagics.script_paths = {}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# StoreMagics configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Lightweight persistence for python variables.
|
||||
#
|
||||
# Provides the %store magic.
|
||||
|
||||
# If True, any %store-d variables will be automatically restored when IPython
|
||||
# starts.
|
||||
# c.StoreMagics.autorestore = False
|
@ -0,0 +1,531 @@
|
||||
# Configuration file for ipython-console.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQTerminalIPythonApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# ZMQTerminalIPythonApp will inherit config from: TerminalIPythonApp,
|
||||
# BaseIPythonApplication, Application, InteractiveShellApp, IPythonConsoleApp,
|
||||
# ConnectionFileMixin
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.ZMQTerminalIPythonApp.hide_initial_ns = True
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.hb_port = 0
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.ZMQTerminalIPythonApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.ZMQTerminalIPythonApp.code_to_run = ''
|
||||
|
||||
# Path to the ssh key to use for logging in to the ssh server.
|
||||
# c.ZMQTerminalIPythonApp.sshkey = ''
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.ZMQTerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.control_port = 0
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.ZMQTerminalIPythonApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.ZMQTerminalIPythonApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.ZMQTerminalIPythonApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.ZMQTerminalIPythonApp.module_to_run = ''
|
||||
|
||||
# Whether to display a banner upon starting IPython.
|
||||
# c.ZMQTerminalIPythonApp.display_banner = True
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.ZMQTerminalIPythonApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.ZMQTerminalIPythonApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.ZMQTerminalIPythonApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.ZMQTerminalIPythonApp.profile = 'default'
|
||||
|
||||
# If a command or file is given via the command-line, e.g. 'ipython foo.py',
|
||||
# start an interactive shell after executing the file or command.
|
||||
# c.ZMQTerminalIPythonApp.force_interact = False
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_files = []
|
||||
|
||||
# Start IPython quickly by skipping the loading of config files.
|
||||
# c.ZMQTerminalIPythonApp.quick = False
|
||||
|
||||
# The Logging format template
|
||||
# c.ZMQTerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.ZMQTerminalIPythonApp.copy_config_files = False
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.stdin_port = 0
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.ZMQTerminalIPythonApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_lines = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.ZMQTerminalIPythonApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.ZMQTerminalIPythonApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.ZMQTerminalIPythonApp.matplotlib = None
|
||||
|
||||
# Suppress warning messages about legacy config files
|
||||
# c.ZMQTerminalIPythonApp.ignore_old_config = False
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.iopub_port = 0
|
||||
|
||||
#
|
||||
# c.ZMQTerminalIPythonApp.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.ZMQTerminalIPythonApp.connection_file = ''
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.ZMQTerminalIPythonApp.ipython_dir = ''
|
||||
|
||||
# The SSH server to use to connect to the kernel.
|
||||
# c.ZMQTerminalIPythonApp.sshserver = ''
|
||||
|
||||
# Set to display confirmation dialog on exit. You can always use 'exit' or
|
||||
# 'quit', to force a direct exit without any confirmation.
|
||||
# c.ZMQTerminalIPythonApp.confirm_exit = True
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.shell_port = 0
|
||||
|
||||
# The name of the default kernel to start.
|
||||
# c.ZMQTerminalIPythonApp.kernel_name = 'python'
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.ZMQTerminalIPythonApp.pylab_import_all = True
|
||||
|
||||
# Connect to an already running kernel
|
||||
# c.ZMQTerminalIPythonApp.existing = ''
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.ZMQTerminalIPythonApp.ip = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQTerminalInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A subclass of TerminalInteractiveShell that uses the 0MQ kernel
|
||||
|
||||
# ZMQTerminalInteractiveShell will inherit config from:
|
||||
# TerminalInteractiveShell, InteractiveShell
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.history_length = 10000
|
||||
|
||||
# auto editing of files with syntax errors.
|
||||
# c.ZMQTerminalInteractiveShell.autoedit_syntax = False
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.ZMQTerminalInteractiveShell.display_page = False
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.debug = False
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.ZMQTerminalInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.ZMQTerminalInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.ZMQTerminalInteractiveShell.cache_size = 1000
|
||||
|
||||
# The shell program to be used for paging.
|
||||
# c.ZMQTerminalInteractiveShell.pager = 'less'
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.ZMQTerminalInteractiveShell.logfile = ''
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.ZMQTerminalInteractiveShell.multiline_history = True
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.ZMQTerminalInteractiveShell.automagic = True
|
||||
|
||||
# Prefix to add to outputs coming from clients other than this one.
|
||||
#
|
||||
# Only relevant if include_other_output is True.
|
||||
# c.ZMQTerminalInteractiveShell.other_output_prefix = '[remote] '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.ZMQTerminalInteractiveShell.color_info = True
|
||||
|
||||
# Callable object called via 'callable' image handler with one argument, `data`,
|
||||
# which is `msg["content"]["data"]` where `msg` is the message from iopub
|
||||
# channel. For exmaple, you can find base64 encoded PNG data as
|
||||
# `data['image/png']`.
|
||||
# c.ZMQTerminalInteractiveShell.callable_image_handler = None
|
||||
|
||||
# Command to invoke an image viewer program when you are using 'stream' image
|
||||
# handler. This option is a list of string where the first element is the
|
||||
# command itself and reminders are the options for the command. Raw image data
|
||||
# is given as STDIN to the program.
|
||||
# c.ZMQTerminalInteractiveShell.stream_image_handler = []
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_out2 = ''
|
||||
|
||||
# Autoindent IPython code entered interactively.
|
||||
# c.ZMQTerminalInteractiveShell.autoindent = True
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.ZMQTerminalInteractiveShell.banner2 = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.ZMQTerminalInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.ZMQTerminalInteractiveShell.pdb = False
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_in = '\n'
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# Enable auto setting the terminal title.
|
||||
# c.ZMQTerminalInteractiveShell.term_title = False
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.ZMQTerminalInteractiveShell.deep_reload = False
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
# Whether to include output from clients other than this one sharing the same
|
||||
# kernel.
|
||||
#
|
||||
# Outputs are not displayed until enter is pressed.
|
||||
# c.ZMQTerminalInteractiveShell.include_other_output = False
|
||||
|
||||
# Preferred object representation MIME type in order. First matched MIME type
|
||||
# will be used.
|
||||
# c.ZMQTerminalInteractiveShell.mime_preference = ['image/png', 'image/jpeg', 'image/svg+xml']
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_use = True
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.ZMQTerminalInteractiveShell.autocall = 0
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.ZMQTerminalInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Handler for image type output. This is useful, for example, when connecting
|
||||
# to the kernel in which pylab inline backend is activated. There are four
|
||||
# handlers defined. 'PIL': Use Python Imaging Library to popup image; 'stream':
|
||||
# Use an external program to show the image. Image will be fed into the STDIN
|
||||
# of the program. You will need to configure `stream_image_handler`;
|
||||
# 'tempfile': Use an external program to show the image. Image will be saved in
|
||||
# a temporally file and the program is called with the temporally file. You
|
||||
# will need to configure `tempfile_image_handler`; 'callable': You can set any
|
||||
# Python callable which is called with the image data. You will need to
|
||||
# configure `callable_image_handler`.
|
||||
# c.ZMQTerminalInteractiveShell.image_handler = None
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.ZMQTerminalInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Set the editor used by IPython (default to $EDITOR/vi/notepad).
|
||||
# c.ZMQTerminalInteractiveShell.editor = 'mate -w'
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.ZMQTerminalInteractiveShell.show_rewritten_input = True
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.xmode = 'Context'
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.quiet = False
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.ZMQTerminalInteractiveShell.ast_transformers = []
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.ipython_dir = ''
|
||||
|
||||
# Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,
|
||||
# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a
|
||||
# direct exit without any confirmation.
|
||||
# c.ZMQTerminalInteractiveShell.confirm_exit = True
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.ZMQTerminalInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# Timeout for giving up on a kernel (in seconds).
|
||||
#
|
||||
# On first connect and restart, the console tests whether the kernel is running
|
||||
# and responsive by sending kernel_info_requests. This sets the timeout in
|
||||
# seconds for how long the kernel can take before being presumed dead.
|
||||
# c.ZMQTerminalInteractiveShell.kernel_timeout = 60
|
||||
|
||||
# Number of lines of your screen, used to control printing of very long strings.
|
||||
# Strings longer than this number of lines will be sent through a pager instead
|
||||
# of directly printed. The default value for this is 0, which means IPython
|
||||
# will auto-detect your screen size every time it needs to print certain
|
||||
# potentially long strings (this doesn't change the behavior of the 'print'
|
||||
# keyword, it's only triggered internally). If for some reason this isn't
|
||||
# working well (it needs curses support), specify it yourself. Otherwise don't
|
||||
# change the default.
|
||||
# c.ZMQTerminalInteractiveShell.screen_length = 0
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.ZMQTerminalInteractiveShell.logappend = ''
|
||||
|
||||
# Command to invoke an image viewer program when you are using 'tempfile' image
|
||||
# handler. This option is a list of string where the first element is the
|
||||
# command itself and reminders are the options for the command. You can use
|
||||
# {file} and {format} in the string to represent the location of the generated
|
||||
# image file and image format.
|
||||
# c.ZMQTerminalInteractiveShell.tempfile_image_handler = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# KernelManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Manages a single kernel in a subprocess on this host.
|
||||
#
|
||||
# This version starts kernels with Popen.
|
||||
|
||||
# KernelManager will inherit config from: ConnectionFileMixin
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.KernelManager.hb_port = 0
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.KernelManager.stdin_port = 0
|
||||
|
||||
#
|
||||
# c.KernelManager.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.KernelManager.connection_file = ''
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.KernelManager.control_port = 0
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.KernelManager.shell_port = 0
|
||||
|
||||
# Should we autorestart the kernel if it dies.
|
||||
# c.KernelManager.autorestart = False
|
||||
|
||||
# DEPRECATED: Use kernel_name instead.
|
||||
#
|
||||
# The Popen Command to launch the kernel. Override this if you have a custom
|
||||
# kernel. If kernel_cmd is specified in a configuration file, IPython does not
|
||||
# pass any arguments to the kernel, because it cannot make any assumptions about
|
||||
# the arguments that the kernel understands. In particular, this means that the
|
||||
# kernel does not receive the option --debug if it given on the IPython command
|
||||
# line.
|
||||
# c.KernelManager.kernel_cmd = []
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.KernelManager.ip = ''
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.KernelManager.iopub_port = 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Session configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Object for handling serialization and sending of messages.
|
||||
#
|
||||
# The Session object handles building messages and sending them with ZMQ sockets
|
||||
# or ZMQStream objects. Objects can communicate with each other over the
|
||||
# network via Session objects, and only need to work with the dict-based IPython
|
||||
# message spec. The Session will handle serialization/deserialization, security,
|
||||
# and metadata.
|
||||
#
|
||||
# Sessions support configurable serialization via packer/unpacker traits, and
|
||||
# signing with HMAC digests via the key/keyfile traits.
|
||||
#
|
||||
# Parameters ----------
|
||||
#
|
||||
# debug : bool
|
||||
# whether to trigger extra debugging statements
|
||||
# packer/unpacker : str : 'json', 'pickle' or import_string
|
||||
# importstrings for methods to serialize message parts. If just
|
||||
# 'json' or 'pickle', predefined JSON and pickle packers will be used.
|
||||
# Otherwise, the entire importstring must be used.
|
||||
#
|
||||
# The functions must accept at least valid JSON input, and output *bytes*.
|
||||
#
|
||||
# For example, to use msgpack:
|
||||
# packer = 'msgpack.packb', unpacker='msgpack.unpackb'
|
||||
# pack/unpack : callables
|
||||
# You can also set the pack/unpack callables for serialization directly.
|
||||
# session : bytes
|
||||
# the ID of this Session object. The default is to generate a new UUID.
|
||||
# username : unicode
|
||||
# username added to message headers. The default is to ask the OS.
|
||||
# key : bytes
|
||||
# The key used to initialize an HMAC signature. If unset, messages
|
||||
# will not be signed or checked.
|
||||
# keyfile : filepath
|
||||
# The file containing a key. If this is set, `key` will be initialized
|
||||
# to the contents of the file.
|
||||
|
||||
# The digest scheme used to construct the message signatures. Must have the form
|
||||
# 'hmac-HASH'.
|
||||
# c.Session.signature_scheme = 'hmac-sha256'
|
||||
|
||||
# The maximum number of digests to remember.
|
||||
#
|
||||
# The digest history will be culled when it exceeds this value.
|
||||
# c.Session.digest_history_size = 65536
|
||||
|
||||
# The name of the unpacker for unserializing messages. Only used with custom
|
||||
# functions for `packer`.
|
||||
# c.Session.unpacker = 'json'
|
||||
|
||||
# The name of the packer for serializing messages. Should be one of 'json',
|
||||
# 'pickle', or an import name for a custom callable serializer.
|
||||
# c.Session.packer = 'json'
|
||||
|
||||
# Username for the Session. Default is your system username.
|
||||
# c.Session.username = 'minrk'
|
||||
|
||||
# Debug output in the Session
|
||||
# c.Session.debug = False
|
||||
|
||||
# path to file containing execution key.
|
||||
# c.Session.keyfile = ''
|
||||
|
||||
# The maximum number of items for a container to be introspected for custom
|
||||
# serialization. Containers larger than this are pickled outright.
|
||||
# c.Session.item_threshold = 64
|
||||
|
||||
# Threshold (in bytes) beyond which an object's buffer should be extracted to
|
||||
# avoid pickling.
|
||||
# c.Session.buffer_threshold = 1024
|
||||
|
||||
# The UUID identifying this session.
|
||||
# c.Session.session = ''
|
||||
|
||||
# Threshold (in bytes) beyond which a buffer should be sent without copying.
|
||||
# c.Session.copy_threshold = 65536
|
||||
|
||||
# execution key, for signing messages.
|
||||
# c.Session.key = b''
|
||||
|
||||
# Metadata dictionary, which serves as the default top-level metadata dict for
|
||||
# each message.
|
||||
# c.Session.metadata = {}
|
@ -0,0 +1,408 @@
|
||||
# Configuration file for ipython-kernel.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPKernelApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# IPython: an enhanced interactive Python shell.
|
||||
|
||||
# IPKernelApp will inherit config from: BaseIPythonApplication, Application,
|
||||
# InteractiveShellApp, ConnectionFileMixin
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.IPKernelApp.hide_initial_ns = True
|
||||
|
||||
# The importstring for the DisplayHook factory
|
||||
# c.IPKernelApp.displayhook_class = 'IPython.kernel.zmq.displayhook.ZMQDisplayHook'
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.IPKernelApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.IPKernelApp.code_to_run = ''
|
||||
|
||||
# redirect stderr to the null device
|
||||
# c.IPKernelApp.no_stderr = False
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.IPKernelApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# Whether to create profile dir if it doesn't exist
|
||||
# c.IPKernelApp.auto_create = False
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.IPKernelApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.IPKernelApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.IPKernelApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.IPKernelApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.IPKernelApp.module_to_run = ''
|
||||
|
||||
# The importstring for the OutStream factory
|
||||
# c.IPKernelApp.outstream_class = 'IPython.kernel.zmq.iostream.OutStream'
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.IPKernelApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.IPKernelApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.IPKernelApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.IPKernelApp.profile = 'default'
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.IPKernelApp.exec_files = []
|
||||
|
||||
# The Logging format template
|
||||
# c.IPKernelApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.IPKernelApp.copy_config_files = False
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.stdin_port = 0
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.IPKernelApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.IPKernelApp.exec_lines = []
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.control_port = 0
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.IPKernelApp.hb_port = 0
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.IPKernelApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.IPKernelApp.file_to_run = ''
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.IPKernelApp.ipython_dir = ''
|
||||
|
||||
# kill this process if its parent dies. On Windows, the argument specifies the
|
||||
# HANDLE of the parent process, otherwise it is simply boolean.
|
||||
# c.IPKernelApp.parent_handle = 0
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.IPKernelApp.matplotlib = None
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.IPKernelApp.iopub_port = 0
|
||||
|
||||
# redirect stdout to the null device
|
||||
# c.IPKernelApp.no_stdout = False
|
||||
|
||||
#
|
||||
# c.IPKernelApp.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.IPKernelApp.connection_file = ''
|
||||
|
||||
# The Kernel subclass to be used.
|
||||
#
|
||||
# This should allow easy re-use of the IPKernelApp entry point to configure and
|
||||
# launch kernels other than IPython's own.
|
||||
# c.IPKernelApp.kernel_class = <class 'IPython.kernel.zmq.ipkernel.IPythonKernel'>
|
||||
|
||||
# ONLY USED ON WINDOWS Interrupt this process when the parent is signaled.
|
||||
# c.IPKernelApp.interrupt = 0
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.shell_port = 0
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.IPKernelApp.pylab_import_all = True
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.IPKernelApp.ip = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPythonKernel configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# IPythonKernel will inherit config from: Kernel
|
||||
|
||||
#
|
||||
# c.IPythonKernel._execute_sleep = 0.0005
|
||||
|
||||
# Whether to use appnope for compatiblity with OS X App Nap.
|
||||
#
|
||||
# Only affects OS X >= 10.9.
|
||||
# c.IPythonKernel._darwin_app_nap = True
|
||||
|
||||
#
|
||||
# c.IPythonKernel._poll_interval = 0.05
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A subclass of InteractiveShell for ZMQ.
|
||||
|
||||
# ZMQInteractiveShell will inherit config from: InteractiveShell
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.ZMQInteractiveShell.pdb = False
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.ipython_dir = ''
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.history_length = 10000
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.ZMQInteractiveShell.display_page = False
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.ZMQInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_in = '\n'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.ZMQInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.ZMQInteractiveShell.cache_size = 1000
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.ZMQInteractiveShell.logfile = ''
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.ZMQInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.debug = False
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.quiet = False
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.ZMQInteractiveShell.multiline_history = True
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.ZMQInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.ZMQInteractiveShell.automagic = True
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.ZMQInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.ZMQInteractiveShell.autocall = 0
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.ZMQInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.ZMQInteractiveShell.color_info = True
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.ZMQInteractiveShell.show_rewritten_input = True
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.xmode = 'Context'
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_out2 = ''
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.ZMQInteractiveShell.banner2 = ''
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.ZMQInteractiveShell.logappend = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.ZMQInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.ZMQInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.ZMQInteractiveShell.deep_reload = False
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.ZMQInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.ZMQInteractiveShell.ast_transformers = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Session configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Object for handling serialization and sending of messages.
|
||||
#
|
||||
# The Session object handles building messages and sending them with ZMQ sockets
|
||||
# or ZMQStream objects. Objects can communicate with each other over the
|
||||
# network via Session objects, and only need to work with the dict-based IPython
|
||||
# message spec. The Session will handle serialization/deserialization, security,
|
||||
# and metadata.
|
||||
#
|
||||
# Sessions support configurable serialization via packer/unpacker traits, and
|
||||
# signing with HMAC digests via the key/keyfile traits.
|
||||
#
|
||||
# Parameters ----------
|
||||
#
|
||||
# debug : bool
|
||||
# whether to trigger extra debugging statements
|
||||
# packer/unpacker : str : 'json', 'pickle' or import_string
|
||||
# importstrings for methods to serialize message parts. If just
|
||||
# 'json' or 'pickle', predefined JSON and pickle packers will be used.
|
||||
# Otherwise, the entire importstring must be used.
|
||||
#
|
||||
# The functions must accept at least valid JSON input, and output *bytes*.
|
||||
#
|
||||
# For example, to use msgpack:
|
||||
# packer = 'msgpack.packb', unpacker='msgpack.unpackb'
|
||||
# pack/unpack : callables
|
||||
# You can also set the pack/unpack callables for serialization directly.
|
||||
# session : bytes
|
||||
# the ID of this Session object. The default is to generate a new UUID.
|
||||
# username : unicode
|
||||
# username added to message headers. The default is to ask the OS.
|
||||
# key : bytes
|
||||
# The key used to initialize an HMAC signature. If unset, messages
|
||||
# will not be signed or checked.
|
||||
# keyfile : filepath
|
||||
# The file containing a key. If this is set, `key` will be initialized
|
||||
# to the contents of the file.
|
||||
|
||||
# The digest scheme used to construct the message signatures. Must have the form
|
||||
# 'hmac-HASH'.
|
||||
# c.Session.signature_scheme = 'hmac-sha256'
|
||||
|
||||
# The maximum number of digests to remember.
|
||||
#
|
||||
# The digest history will be culled when it exceeds this value.
|
||||
# c.Session.digest_history_size = 65536
|
||||
|
||||
# The name of the unpacker for unserializing messages. Only used with custom
|
||||
# functions for `packer`.
|
||||
# c.Session.unpacker = 'json'
|
||||
|
||||
# The name of the packer for serializing messages. Should be one of 'json',
|
||||
# 'pickle', or an import name for a custom callable serializer.
|
||||
# c.Session.packer = 'json'
|
||||
|
||||
# Username for the Session. Default is your system username.
|
||||
# c.Session.username = 'minrk'
|
||||
|
||||
# Debug output in the Session
|
||||
# c.Session.debug = False
|
||||
|
||||
# path to file containing execution key.
|
||||
# c.Session.keyfile = ''
|
||||
|
||||
# The maximum number of items for a container to be introspected for custom
|
||||
# serialization. Containers larger than this are pickled outright.
|
||||
# c.Session.item_threshold = 64
|
||||
|
||||
# Threshold (in bytes) beyond which an object's buffer should be extracted to
|
||||
# avoid pickling.
|
||||
# c.Session.buffer_threshold = 1024
|
||||
|
||||
# The UUID identifying this session.
|
||||
# c.Session.session = ''
|
||||
|
||||
# Threshold (in bytes) beyond which a buffer should be sent without copying.
|
||||
# c.Session.copy_threshold = 65536
|
||||
|
||||
# execution key, for signing messages.
|
||||
# c.Session.key = b''
|
||||
|
||||
# Metadata dictionary, which serves as the default top-level metadata dict for
|
||||
# each message.
|
||||
# c.Session.metadata = {}
|
@ -0,0 +1 @@
|
||||
c.NbConvertApp.post_processors = []
|
@ -0,0 +1 @@
|
||||
c.NotebookApp.open_browser = False
|
@ -0,0 +1,7 @@
|
||||
/*
|
||||
Placeholder for custom user CSS
|
||||
|
||||
mainly to be overridden in profile/static/custom/custom.css
|
||||
|
||||
This will always be an empty file in IPython
|
||||
*/
|
@ -0,0 +1,82 @@
|
||||
// leave at least 2 line with only a star on it below, or doc generation fails
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Placeholder for custom user javascript
|
||||
* mainly to be overridden in profile/static/custom/custom.js
|
||||
* This will always be an empty file in IPython
|
||||
*
|
||||
* User could add any javascript in the `profile/static/custom/custom.js` file.
|
||||
* It will be executed by the ipython notebook at load time.
|
||||
*
|
||||
* Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
|
||||
*
|
||||
*
|
||||
* The object available at load time depend on the version of IPython in use.
|
||||
* there is no guaranties of API stability.
|
||||
*
|
||||
* The example below explain the principle, and might not be valid.
|
||||
*
|
||||
* Instances are created after the loading of this file and might need to be accessed using events:
|
||||
* define([
|
||||
* 'base/js/namespace',
|
||||
* 'base/js/events'
|
||||
* ], function(IPython, events) {
|
||||
* events.on("app_initialized.NotebookApp", function () {
|
||||
* IPython.keyboard_manager....
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 1:__
|
||||
*
|
||||
* Create a custom button in toolbar that execute `%qtconsole` in kernel
|
||||
* and hence open a qtconsole attached to the same kernel as the current notebook
|
||||
*
|
||||
* define([
|
||||
* 'base/js/namespace',
|
||||
* 'base/js/events'
|
||||
* ], function(IPython, events) {
|
||||
* events.on('app_initialized.NotebookApp', function(){
|
||||
* IPython.toolbar.add_buttons_group([
|
||||
* {
|
||||
* 'label' : 'run qtconsole',
|
||||
* 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
|
||||
* 'callback': function () {
|
||||
* IPython.notebook.kernel.execute('%qtconsole')
|
||||
* }
|
||||
* }
|
||||
* // add more button here if needed.
|
||||
* ]);
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 2:__
|
||||
*
|
||||
* At the completion of the dashboard loading, load an unofficial javascript extension
|
||||
* that is installed in profile/static/custom/
|
||||
*
|
||||
* define([
|
||||
* 'base/js/events'
|
||||
* ], function(events) {
|
||||
* events.on('app_initialized.DashboardApp', function(){
|
||||
* require(['custom/unofficial_extension.js'])
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 3:__
|
||||
*
|
||||
* Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
|
||||
* to load custom script into the notebook.
|
||||
*
|
||||
* // to load the metadata ui extension example.
|
||||
* $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
|
||||
* // or
|
||||
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
|
||||
* $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
|
||||
*
|
||||
*
|
||||
* @module IPython
|
||||
* @namespace IPython
|
||||
* @class customjs
|
||||
* @static
|
||||
*/
|
@ -0,0 +1,549 @@
|
||||
# Configuration file for ipython.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# InteractiveShellApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A Mixin for applications that start InteractiveShell instances.
|
||||
#
|
||||
# Provides configurables for loading extensions and executing files as part of
|
||||
# configuring a Shell environment.
|
||||
#
|
||||
# The following methods should be called by the :meth:`initialize` method of the
|
||||
# subclass:
|
||||
#
|
||||
# - :meth:`init_path`
|
||||
# - :meth:`init_shell` (to be implemented by the subclass)
|
||||
# - :meth:`init_gui_pylab`
|
||||
# - :meth:`init_extensions`
|
||||
# - :meth:`init_code`
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.InteractiveShellApp.exec_lines = []
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.InteractiveShellApp.hide_initial_ns = True
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.InteractiveShellApp.extensions = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.InteractiveShellApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.InteractiveShellApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.InteractiveShellApp.matplotlib = None
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.InteractiveShellApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.InteractiveShellApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.InteractiveShellApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.InteractiveShellApp.module_to_run = ''
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.InteractiveShellApp.extra_extension = ''
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.InteractiveShellApp.exec_files = []
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.InteractiveShellApp.pylab_import_all = True
|
||||
|
||||
# Execute the given command string.
|
||||
# c.InteractiveShellApp.code_to_run = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TerminalIPythonApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# TerminalIPythonApp will inherit config from: BaseIPythonApplication,
|
||||
# Application, InteractiveShellApp
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.TerminalIPythonApp.hide_initial_ns = True
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.TerminalIPythonApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.TerminalIPythonApp.code_to_run = ''
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.TerminalIPythonApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.TerminalIPythonApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.TerminalIPythonApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.TerminalIPythonApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.TerminalIPythonApp.module_to_run = ''
|
||||
|
||||
# Whether to display a banner upon starting IPython.
|
||||
# c.TerminalIPythonApp.display_banner = True
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.TerminalIPythonApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.TerminalIPythonApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.TerminalIPythonApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.TerminalIPythonApp.profile = 'default'
|
||||
|
||||
# If a command or file is given via the command-line, e.g. 'ipython foo.py',
|
||||
# start an interactive shell after executing the file or command.
|
||||
# c.TerminalIPythonApp.force_interact = False
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.TerminalIPythonApp.exec_files = []
|
||||
|
||||
# Start IPython quickly by skipping the loading of config files.
|
||||
# c.TerminalIPythonApp.quick = False
|
||||
|
||||
# The Logging format template
|
||||
# c.TerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.TerminalIPythonApp.copy_config_files = False
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.TerminalIPythonApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.TerminalIPythonApp.exec_lines = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.TerminalIPythonApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.TerminalIPythonApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.TerminalIPythonApp.matplotlib = None
|
||||
|
||||
# Suppress warning messages about legacy config files
|
||||
# c.TerminalIPythonApp.ignore_old_config = False
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.TerminalIPythonApp.ipython_dir = ''
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.TerminalIPythonApp.pylab_import_all = True
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TerminalInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# TerminalInteractiveShell will inherit config from: InteractiveShell
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.TerminalInteractiveShell.pdb = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.ipython_dir = ''
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.history_length = 10000
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# auto editing of files with syntax errors.
|
||||
# c.TerminalInteractiveShell.autoedit_syntax = False
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.TerminalInteractiveShell.display_page = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.debug = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_in = '\n'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.TerminalInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.TerminalInteractiveShell.cache_size = 1000
|
||||
|
||||
# Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,
|
||||
# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a
|
||||
# direct exit without any confirmation.
|
||||
# c.TerminalInteractiveShell.confirm_exit = True
|
||||
|
||||
# The shell program to be used for paging.
|
||||
# c.TerminalInteractiveShell.pager = 'less'
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.TerminalInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.TerminalInteractiveShell.logfile = ''
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.TerminalInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.quiet = False
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.TerminalInteractiveShell.multiline_history = True
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.TerminalInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_use = True
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.TerminalInteractiveShell.automagic = True
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.TerminalInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.TerminalInteractiveShell.autocall = 0
|
||||
|
||||
# Autoindent IPython code entered interactively.
|
||||
# c.TerminalInteractiveShell.autoindent = True
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.TerminalInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Set the editor used by IPython (default to $EDITOR/vi/notepad).
|
||||
# c.TerminalInteractiveShell.editor = 'mate -w'
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.TerminalInteractiveShell.color_info = True
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.TerminalInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.separate_out2 = ''
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.TerminalInteractiveShell.banner2 = ''
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.TerminalInteractiveShell.logappend = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.TerminalInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.TerminalInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.TerminalInteractiveShell.deep_reload = False
|
||||
|
||||
#
|
||||
# c.TerminalInteractiveShell.xmode = 'Context'
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.TerminalInteractiveShell.show_rewritten_input = True
|
||||
|
||||
# Number of lines of your screen, used to control printing of very long strings.
|
||||
# Strings longer than this number of lines will be sent through a pager instead
|
||||
# of directly printed. The default value for this is 0, which means IPython
|
||||
# will auto-detect your screen size every time it needs to print certain
|
||||
# potentially long strings (this doesn't change the behavior of the 'print'
|
||||
# keyword, it's only triggered internally). If for some reason this isn't
|
||||
# working well (it needs curses support), specify it yourself. Otherwise don't
|
||||
# change the default.
|
||||
# c.TerminalInteractiveShell.screen_length = 0
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.TerminalInteractiveShell.ast_transformers = []
|
||||
|
||||
# Enable auto setting the terminal title.
|
||||
# c.TerminalInteractiveShell.term_title = False
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PromptManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# This is the primary interface for producing IPython's prompts.
|
||||
|
||||
#
|
||||
# c.PromptManager.color_scheme = 'Linux'
|
||||
|
||||
# Continuation prompt.
|
||||
# c.PromptManager.in2_template = ' .\\D.: '
|
||||
|
||||
# Input prompt. '\#' will be transformed to the prompt number
|
||||
# c.PromptManager.in_template = 'In [\\#]: '
|
||||
|
||||
# Output prompt. '\#' will be transformed to the prompt number
|
||||
# c.PromptManager.out_template = 'Out[\\#]: '
|
||||
|
||||
# If True (default), each prompt will be right-aligned with the preceding one.
|
||||
# c.PromptManager.justify = True
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# HistoryManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A class to organize all history-related functionality in one place.
|
||||
|
||||
# HistoryManager will inherit config from: HistoryAccessor
|
||||
|
||||
# Options for configuring the SQLite connection
|
||||
#
|
||||
# These options are passed as keyword args to sqlite3.connect when establishing
|
||||
# database conenctions.
|
||||
# c.HistoryManager.connection_options = {}
|
||||
|
||||
# Should the history database include output? (default: no)
|
||||
# c.HistoryManager.db_log_output = False
|
||||
|
||||
# enable the SQLite history
|
||||
#
|
||||
# set enabled=False to disable the SQLite history, in which case there will be
|
||||
# no stored history, no SQLite connection, and no background saving thread.
|
||||
# This may be necessary in some threaded environments where IPython is embedded.
|
||||
# c.HistoryManager.enabled = True
|
||||
|
||||
# Path to file to use for SQLite history database.
|
||||
#
|
||||
# By default, IPython will put the history database in the IPython profile
|
||||
# directory. If you would rather share one history among profiles, you can set
|
||||
# this value in each, so that they are consistent.
|
||||
#
|
||||
# Due to an issue with fcntl, SQLite is known to misbehave on some NFS mounts.
|
||||
# If you see IPython hanging, try setting this to something on a local disk,
|
||||
# e.g::
|
||||
#
|
||||
# ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite
|
||||
# c.HistoryManager.hist_file = ''
|
||||
|
||||
# Write to database every x commands (higher values save disk access & power).
|
||||
# Values of 1 or less effectively disable caching.
|
||||
# c.HistoryManager.db_cache_size = 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PlainTextFormatter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# The default pretty-printer.
|
||||
#
|
||||
# This uses :mod:`IPython.lib.pretty` to compute the format data of the object.
|
||||
# If the object cannot be pretty printed, :func:`repr` is used. See the
|
||||
# documentation of :mod:`IPython.lib.pretty` for details on how to write pretty
|
||||
# printers. Here is a simple example::
|
||||
#
|
||||
# def dtype_pprinter(obj, p, cycle):
|
||||
# if cycle:
|
||||
# return p.text('dtype(...)')
|
||||
# if hasattr(obj, 'fields'):
|
||||
# if obj.fields is None:
|
||||
# p.text(repr(obj))
|
||||
# else:
|
||||
# p.begin_group(7, 'dtype([')
|
||||
# for i, field in enumerate(obj.descr):
|
||||
# if i > 0:
|
||||
# p.text(',')
|
||||
# p.breakable()
|
||||
# p.pretty(field)
|
||||
# p.end_group(7, '])')
|
||||
|
||||
# PlainTextFormatter will inherit config from: BaseFormatter
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.newline = '\n'
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.max_width = 79
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.verbose = False
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.pprint = True
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.singleton_printers = {}
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.type_printers = {}
|
||||
|
||||
# Truncate large collections (lists, dicts, tuples, sets) to this size.
|
||||
#
|
||||
# Set to 0 to disable truncation.
|
||||
# c.PlainTextFormatter.max_seq_length = 1000
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.deferred_printers = {}
|
||||
|
||||
#
|
||||
# c.PlainTextFormatter.float_precision = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPCompleter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Extension of the completer class with IPython-specific features
|
||||
|
||||
# IPCompleter will inherit config from: Completer
|
||||
|
||||
# Whether to merge completion results into a single list
|
||||
#
|
||||
# If False, only the completion results from the first non-empty completer will
|
||||
# be returned.
|
||||
# c.IPCompleter.merge_completions = True
|
||||
|
||||
# Activate greedy completion
|
||||
#
|
||||
# This will enable completion on elements of lists, results of function calls,
|
||||
# etc., but can be unsafe because the code is actually evaluated on TAB.
|
||||
# c.IPCompleter.greedy = False
|
||||
|
||||
# Instruct the completer to use __all__ for the completion
|
||||
#
|
||||
# Specifically, when completing on ``object.<tab>``.
|
||||
#
|
||||
# When True: only those names in obj.__all__ will be included.
|
||||
#
|
||||
# When False [default]: the __all__ attribute is ignored
|
||||
# c.IPCompleter.limit_to__all__ = False
|
||||
|
||||
# Instruct the completer to omit private method names
|
||||
#
|
||||
# Specifically, when completing on ``object.<tab>``.
|
||||
#
|
||||
# When 2 [default]: all names that start with '_' will be excluded.
|
||||
#
|
||||
# When 1: all 'magic' names (``__foo__``) will be excluded.
|
||||
#
|
||||
# When 0: nothing will be excluded.
|
||||
# c.IPCompleter.omit__names = 2
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ScriptMagics configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Magics for talking to scripts
|
||||
#
|
||||
# This defines a base `%%script` cell magic for running a cell with a program in
|
||||
# a subprocess, and registers a few top-level magics that call %%script with
|
||||
# common interpreters.
|
||||
|
||||
# Extra script cell magics to define
|
||||
#
|
||||
# This generates simple wrappers of `%%script foo` as `%%foo`.
|
||||
#
|
||||
# If you want to add script magics that aren't on your path, specify them in
|
||||
# script_paths
|
||||
# c.ScriptMagics.script_magics = []
|
||||
|
||||
# Dict mapping short 'ruby' names to full paths, such as '/opt/secret/bin/ruby'
|
||||
#
|
||||
# Only necessary for items in script_magics where the default path will not find
|
||||
# the right interpreter.
|
||||
# c.ScriptMagics.script_paths = {}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# StoreMagics configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Lightweight persistence for python variables.
|
||||
#
|
||||
# Provides the %store magic.
|
||||
|
||||
# If True, any %store-d variables will be automatically restored when IPython
|
||||
# starts.
|
||||
# c.StoreMagics.autorestore = False
|
@ -0,0 +1,531 @@
|
||||
# Configuration file for ipython-console.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQTerminalIPythonApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# ZMQTerminalIPythonApp will inherit config from: TerminalIPythonApp,
|
||||
# BaseIPythonApplication, Application, InteractiveShellApp, IPythonConsoleApp,
|
||||
# ConnectionFileMixin
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.ZMQTerminalIPythonApp.hide_initial_ns = True
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.hb_port = 0
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.ZMQTerminalIPythonApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.ZMQTerminalIPythonApp.code_to_run = ''
|
||||
|
||||
# Path to the ssh key to use for logging in to the ssh server.
|
||||
# c.ZMQTerminalIPythonApp.sshkey = ''
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.ZMQTerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.control_port = 0
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.ZMQTerminalIPythonApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.ZMQTerminalIPythonApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.ZMQTerminalIPythonApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.ZMQTerminalIPythonApp.module_to_run = ''
|
||||
|
||||
# Whether to display a banner upon starting IPython.
|
||||
# c.ZMQTerminalIPythonApp.display_banner = True
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.ZMQTerminalIPythonApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.ZMQTerminalIPythonApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.ZMQTerminalIPythonApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.ZMQTerminalIPythonApp.profile = 'default'
|
||||
|
||||
# If a command or file is given via the command-line, e.g. 'ipython foo.py',
|
||||
# start an interactive shell after executing the file or command.
|
||||
# c.ZMQTerminalIPythonApp.force_interact = False
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_files = []
|
||||
|
||||
# Start IPython quickly by skipping the loading of config files.
|
||||
# c.ZMQTerminalIPythonApp.quick = False
|
||||
|
||||
# The Logging format template
|
||||
# c.ZMQTerminalIPythonApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.ZMQTerminalIPythonApp.copy_config_files = False
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.stdin_port = 0
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.ZMQTerminalIPythonApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.ZMQTerminalIPythonApp.exec_lines = []
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.ZMQTerminalIPythonApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.ZMQTerminalIPythonApp.file_to_run = ''
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.ZMQTerminalIPythonApp.matplotlib = None
|
||||
|
||||
# Suppress warning messages about legacy config files
|
||||
# c.ZMQTerminalIPythonApp.ignore_old_config = False
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.iopub_port = 0
|
||||
|
||||
#
|
||||
# c.ZMQTerminalIPythonApp.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.ZMQTerminalIPythonApp.connection_file = ''
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.ZMQTerminalIPythonApp.ipython_dir = ''
|
||||
|
||||
# The SSH server to use to connect to the kernel.
|
||||
# c.ZMQTerminalIPythonApp.sshserver = ''
|
||||
|
||||
# Set to display confirmation dialog on exit. You can always use 'exit' or
|
||||
# 'quit', to force a direct exit without any confirmation.
|
||||
# c.ZMQTerminalIPythonApp.confirm_exit = True
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.ZMQTerminalIPythonApp.shell_port = 0
|
||||
|
||||
# The name of the default kernel to start.
|
||||
# c.ZMQTerminalIPythonApp.kernel_name = 'python'
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.ZMQTerminalIPythonApp.pylab_import_all = True
|
||||
|
||||
# Connect to an already running kernel
|
||||
# c.ZMQTerminalIPythonApp.existing = ''
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.ZMQTerminalIPythonApp.ip = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQTerminalInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A subclass of TerminalInteractiveShell that uses the 0MQ kernel
|
||||
|
||||
# ZMQTerminalInteractiveShell will inherit config from:
|
||||
# TerminalInteractiveShell, InteractiveShell
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.history_length = 10000
|
||||
|
||||
# auto editing of files with syntax errors.
|
||||
# c.ZMQTerminalInteractiveShell.autoedit_syntax = False
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.ZMQTerminalInteractiveShell.display_page = False
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.debug = False
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.ZMQTerminalInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.ZMQTerminalInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.ZMQTerminalInteractiveShell.cache_size = 1000
|
||||
|
||||
# The shell program to be used for paging.
|
||||
# c.ZMQTerminalInteractiveShell.pager = 'less'
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.ZMQTerminalInteractiveShell.logfile = ''
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.ZMQTerminalInteractiveShell.multiline_history = True
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.ZMQTerminalInteractiveShell.automagic = True
|
||||
|
||||
# Prefix to add to outputs coming from clients other than this one.
|
||||
#
|
||||
# Only relevant if include_other_output is True.
|
||||
# c.ZMQTerminalInteractiveShell.other_output_prefix = '[remote] '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.ZMQTerminalInteractiveShell.color_info = True
|
||||
|
||||
# Callable object called via 'callable' image handler with one argument, `data`,
|
||||
# which is `msg["content"]["data"]` where `msg` is the message from iopub
|
||||
# channel. For exmaple, you can find base64 encoded PNG data as
|
||||
# `data['image/png']`.
|
||||
# c.ZMQTerminalInteractiveShell.callable_image_handler = None
|
||||
|
||||
# Command to invoke an image viewer program when you are using 'stream' image
|
||||
# handler. This option is a list of string where the first element is the
|
||||
# command itself and reminders are the options for the command. Raw image data
|
||||
# is given as STDIN to the program.
|
||||
# c.ZMQTerminalInteractiveShell.stream_image_handler = []
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_out2 = ''
|
||||
|
||||
# Autoindent IPython code entered interactively.
|
||||
# c.ZMQTerminalInteractiveShell.autoindent = True
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.ZMQTerminalInteractiveShell.banner2 = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.ZMQTerminalInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.ZMQTerminalInteractiveShell.pdb = False
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.separate_in = '\n'
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# Enable auto setting the terminal title.
|
||||
# c.ZMQTerminalInteractiveShell.term_title = False
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.ZMQTerminalInteractiveShell.deep_reload = False
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.ZMQTerminalInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
# Whether to include output from clients other than this one sharing the same
|
||||
# kernel.
|
||||
#
|
||||
# Outputs are not displayed until enter is pressed.
|
||||
# c.ZMQTerminalInteractiveShell.include_other_output = False
|
||||
|
||||
# Preferred object representation MIME type in order. First matched MIME type
|
||||
# will be used.
|
||||
# c.ZMQTerminalInteractiveShell.mime_preference = ['image/png', 'image/jpeg', 'image/svg+xml']
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.readline_use = True
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.ZMQTerminalInteractiveShell.autocall = 0
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.ZMQTerminalInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Handler for image type output. This is useful, for example, when connecting
|
||||
# to the kernel in which pylab inline backend is activated. There are four
|
||||
# handlers defined. 'PIL': Use Python Imaging Library to popup image; 'stream':
|
||||
# Use an external program to show the image. Image will be fed into the STDIN
|
||||
# of the program. You will need to configure `stream_image_handler`;
|
||||
# 'tempfile': Use an external program to show the image. Image will be saved in
|
||||
# a temporally file and the program is called with the temporally file. You
|
||||
# will need to configure `tempfile_image_handler`; 'callable': You can set any
|
||||
# Python callable which is called with the image data. You will need to
|
||||
# configure `callable_image_handler`.
|
||||
# c.ZMQTerminalInteractiveShell.image_handler = None
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.ZMQTerminalInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Set the editor used by IPython (default to $EDITOR/vi/notepad).
|
||||
# c.ZMQTerminalInteractiveShell.editor = 'mate -w'
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.ZMQTerminalInteractiveShell.show_rewritten_input = True
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.xmode = 'Context'
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.quiet = False
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.ZMQTerminalInteractiveShell.ast_transformers = []
|
||||
|
||||
#
|
||||
# c.ZMQTerminalInteractiveShell.ipython_dir = ''
|
||||
|
||||
# Set to confirm when you try to exit IPython with an EOF (Control-D in Unix,
|
||||
# Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a
|
||||
# direct exit without any confirmation.
|
||||
# c.ZMQTerminalInteractiveShell.confirm_exit = True
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.ZMQTerminalInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# Timeout for giving up on a kernel (in seconds).
|
||||
#
|
||||
# On first connect and restart, the console tests whether the kernel is running
|
||||
# and responsive by sending kernel_info_requests. This sets the timeout in
|
||||
# seconds for how long the kernel can take before being presumed dead.
|
||||
# c.ZMQTerminalInteractiveShell.kernel_timeout = 60
|
||||
|
||||
# Number of lines of your screen, used to control printing of very long strings.
|
||||
# Strings longer than this number of lines will be sent through a pager instead
|
||||
# of directly printed. The default value for this is 0, which means IPython
|
||||
# will auto-detect your screen size every time it needs to print certain
|
||||
# potentially long strings (this doesn't change the behavior of the 'print'
|
||||
# keyword, it's only triggered internally). If for some reason this isn't
|
||||
# working well (it needs curses support), specify it yourself. Otherwise don't
|
||||
# change the default.
|
||||
# c.ZMQTerminalInteractiveShell.screen_length = 0
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.ZMQTerminalInteractiveShell.logappend = ''
|
||||
|
||||
# Command to invoke an image viewer program when you are using 'tempfile' image
|
||||
# handler. This option is a list of string where the first element is the
|
||||
# command itself and reminders are the options for the command. You can use
|
||||
# {file} and {format} in the string to represent the location of the generated
|
||||
# image file and image format.
|
||||
# c.ZMQTerminalInteractiveShell.tempfile_image_handler = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# KernelManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Manages a single kernel in a subprocess on this host.
|
||||
#
|
||||
# This version starts kernels with Popen.
|
||||
|
||||
# KernelManager will inherit config from: ConnectionFileMixin
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.KernelManager.hb_port = 0
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.KernelManager.stdin_port = 0
|
||||
|
||||
#
|
||||
# c.KernelManager.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.KernelManager.connection_file = ''
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.KernelManager.control_port = 0
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.KernelManager.shell_port = 0
|
||||
|
||||
# Should we autorestart the kernel if it dies.
|
||||
# c.KernelManager.autorestart = False
|
||||
|
||||
# DEPRECATED: Use kernel_name instead.
|
||||
#
|
||||
# The Popen Command to launch the kernel. Override this if you have a custom
|
||||
# kernel. If kernel_cmd is specified in a configuration file, IPython does not
|
||||
# pass any arguments to the kernel, because it cannot make any assumptions about
|
||||
# the arguments that the kernel understands. In particular, this means that the
|
||||
# kernel does not receive the option --debug if it given on the IPython command
|
||||
# line.
|
||||
# c.KernelManager.kernel_cmd = []
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.KernelManager.ip = ''
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.KernelManager.iopub_port = 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Session configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Object for handling serialization and sending of messages.
|
||||
#
|
||||
# The Session object handles building messages and sending them with ZMQ sockets
|
||||
# or ZMQStream objects. Objects can communicate with each other over the
|
||||
# network via Session objects, and only need to work with the dict-based IPython
|
||||
# message spec. The Session will handle serialization/deserialization, security,
|
||||
# and metadata.
|
||||
#
|
||||
# Sessions support configurable serialization via packer/unpacker traits, and
|
||||
# signing with HMAC digests via the key/keyfile traits.
|
||||
#
|
||||
# Parameters ----------
|
||||
#
|
||||
# debug : bool
|
||||
# whether to trigger extra debugging statements
|
||||
# packer/unpacker : str : 'json', 'pickle' or import_string
|
||||
# importstrings for methods to serialize message parts. If just
|
||||
# 'json' or 'pickle', predefined JSON and pickle packers will be used.
|
||||
# Otherwise, the entire importstring must be used.
|
||||
#
|
||||
# The functions must accept at least valid JSON input, and output *bytes*.
|
||||
#
|
||||
# For example, to use msgpack:
|
||||
# packer = 'msgpack.packb', unpacker='msgpack.unpackb'
|
||||
# pack/unpack : callables
|
||||
# You can also set the pack/unpack callables for serialization directly.
|
||||
# session : bytes
|
||||
# the ID of this Session object. The default is to generate a new UUID.
|
||||
# username : unicode
|
||||
# username added to message headers. The default is to ask the OS.
|
||||
# key : bytes
|
||||
# The key used to initialize an HMAC signature. If unset, messages
|
||||
# will not be signed or checked.
|
||||
# keyfile : filepath
|
||||
# The file containing a key. If this is set, `key` will be initialized
|
||||
# to the contents of the file.
|
||||
|
||||
# The digest scheme used to construct the message signatures. Must have the form
|
||||
# 'hmac-HASH'.
|
||||
# c.Session.signature_scheme = 'hmac-sha256'
|
||||
|
||||
# The maximum number of digests to remember.
|
||||
#
|
||||
# The digest history will be culled when it exceeds this value.
|
||||
# c.Session.digest_history_size = 65536
|
||||
|
||||
# The name of the unpacker for unserializing messages. Only used with custom
|
||||
# functions for `packer`.
|
||||
# c.Session.unpacker = 'json'
|
||||
|
||||
# The name of the packer for serializing messages. Should be one of 'json',
|
||||
# 'pickle', or an import name for a custom callable serializer.
|
||||
# c.Session.packer = 'json'
|
||||
|
||||
# Username for the Session. Default is your system username.
|
||||
# c.Session.username = 'minrk'
|
||||
|
||||
# Debug output in the Session
|
||||
# c.Session.debug = False
|
||||
|
||||
# path to file containing execution key.
|
||||
# c.Session.keyfile = ''
|
||||
|
||||
# The maximum number of items for a container to be introspected for custom
|
||||
# serialization. Containers larger than this are pickled outright.
|
||||
# c.Session.item_threshold = 64
|
||||
|
||||
# Threshold (in bytes) beyond which an object's buffer should be extracted to
|
||||
# avoid pickling.
|
||||
# c.Session.buffer_threshold = 1024
|
||||
|
||||
# The UUID identifying this session.
|
||||
# c.Session.session = ''
|
||||
|
||||
# Threshold (in bytes) beyond which a buffer should be sent without copying.
|
||||
# c.Session.copy_threshold = 65536
|
||||
|
||||
# execution key, for signing messages.
|
||||
# c.Session.key = b''
|
||||
|
||||
# Metadata dictionary, which serves as the default top-level metadata dict for
|
||||
# each message.
|
||||
# c.Session.metadata = {}
|
@ -0,0 +1,408 @@
|
||||
# Configuration file for ipython-kernel.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPKernelApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# IPython: an enhanced interactive Python shell.
|
||||
|
||||
# IPKernelApp will inherit config from: BaseIPythonApplication, Application,
|
||||
# InteractiveShellApp, ConnectionFileMixin
|
||||
|
||||
# Should variables loaded at startup (by startup files, exec_lines, etc.) be
|
||||
# hidden from tools like %who?
|
||||
# c.IPKernelApp.hide_initial_ns = True
|
||||
|
||||
# The importstring for the DisplayHook factory
|
||||
# c.IPKernelApp.displayhook_class = 'IPython.kernel.zmq.displayhook.ZMQDisplayHook'
|
||||
|
||||
# A list of dotted module names of IPython extensions to load.
|
||||
# c.IPKernelApp.extensions = []
|
||||
|
||||
# Execute the given command string.
|
||||
# c.IPKernelApp.code_to_run = ''
|
||||
|
||||
# redirect stderr to the null device
|
||||
# c.IPKernelApp.no_stderr = False
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.IPKernelApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# Whether to create profile dir if it doesn't exist
|
||||
# c.IPKernelApp.auto_create = False
|
||||
|
||||
# Reraise exceptions encountered loading IPython extensions?
|
||||
# c.IPKernelApp.reraise_ipython_extension_failures = False
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.IPKernelApp.log_level = 30
|
||||
|
||||
# Run the file referenced by the PYTHONSTARTUP environment variable at IPython
|
||||
# startup.
|
||||
# c.IPKernelApp.exec_PYTHONSTARTUP = True
|
||||
|
||||
# Pre-load matplotlib and numpy for interactive use, selecting a particular
|
||||
# matplotlib backend and loop integration.
|
||||
# c.IPKernelApp.pylab = None
|
||||
|
||||
# Run the module as a script.
|
||||
# c.IPKernelApp.module_to_run = ''
|
||||
|
||||
# The importstring for the OutStream factory
|
||||
# c.IPKernelApp.outstream_class = 'IPython.kernel.zmq.iostream.OutStream'
|
||||
|
||||
# dotted module name of an IPython extension to load.
|
||||
# c.IPKernelApp.extra_extension = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.IPKernelApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.IPKernelApp.overwrite = False
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.IPKernelApp.profile = 'default'
|
||||
|
||||
# List of files to run at IPython startup.
|
||||
# c.IPKernelApp.exec_files = []
|
||||
|
||||
# The Logging format template
|
||||
# c.IPKernelApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.IPKernelApp.copy_config_files = False
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.stdin_port = 0
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.IPKernelApp.extra_config_file = ''
|
||||
|
||||
# lines of code to run at IPython startup.
|
||||
# c.IPKernelApp.exec_lines = []
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.control_port = 0
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.IPKernelApp.hb_port = 0
|
||||
|
||||
# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'osx',
|
||||
# 'pyglet', 'qt', 'qt5', 'tk', 'wx').
|
||||
# c.IPKernelApp.gui = None
|
||||
|
||||
# A file to be run
|
||||
# c.IPKernelApp.file_to_run = ''
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.IPKernelApp.ipython_dir = ''
|
||||
|
||||
# kill this process if its parent dies. On Windows, the argument specifies the
|
||||
# HANDLE of the parent process, otherwise it is simply boolean.
|
||||
# c.IPKernelApp.parent_handle = 0
|
||||
|
||||
# Configure matplotlib for interactive use with the default matplotlib backend.
|
||||
# c.IPKernelApp.matplotlib = None
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.IPKernelApp.iopub_port = 0
|
||||
|
||||
# redirect stdout to the null device
|
||||
# c.IPKernelApp.no_stdout = False
|
||||
|
||||
#
|
||||
# c.IPKernelApp.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.IPKernelApp.connection_file = ''
|
||||
|
||||
# The Kernel subclass to be used.
|
||||
#
|
||||
# This should allow easy re-use of the IPKernelApp entry point to configure and
|
||||
# launch kernels other than IPython's own.
|
||||
# c.IPKernelApp.kernel_class = <class 'IPython.kernel.zmq.ipkernel.IPythonKernel'>
|
||||
|
||||
# ONLY USED ON WINDOWS Interrupt this process when the parent is signaled.
|
||||
# c.IPKernelApp.interrupt = 0
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.IPKernelApp.shell_port = 0
|
||||
|
||||
# If true, IPython will populate the user namespace with numpy, pylab, etc. and
|
||||
# an ``import *`` is done from numpy and pylab, when using pylab mode.
|
||||
#
|
||||
# When False, pylab mode should not import any names into the user namespace.
|
||||
# c.IPKernelApp.pylab_import_all = True
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.IPKernelApp.ip = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# IPythonKernel configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# IPythonKernel will inherit config from: Kernel
|
||||
|
||||
#
|
||||
# c.IPythonKernel._execute_sleep = 0.0005
|
||||
|
||||
# Whether to use appnope for compatiblity with OS X App Nap.
|
||||
#
|
||||
# Only affects OS X >= 10.9.
|
||||
# c.IPythonKernel._darwin_app_nap = True
|
||||
|
||||
#
|
||||
# c.IPythonKernel._poll_interval = 0.05
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ZMQInteractiveShell configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A subclass of InteractiveShell for ZMQ.
|
||||
|
||||
# ZMQInteractiveShell will inherit config from: InteractiveShell
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.object_info_string_level = 0
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_out = ''
|
||||
|
||||
# Automatically call the pdb debugger after every exception.
|
||||
# c.ZMQInteractiveShell.pdb = False
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.ipython_dir = ''
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.history_length = 10000
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.readline_remove_delims = '-/~'
|
||||
|
||||
# If True, anything that would be passed to the pager will be displayed as
|
||||
# regular output instead.
|
||||
# c.ZMQInteractiveShell.display_page = False
|
||||
|
||||
# Deprecated, use PromptManager.in2_template
|
||||
# c.ZMQInteractiveShell.prompt_in2 = ' .\\D.: '
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_in = '\n'
|
||||
|
||||
# Start logging to the default log file in overwrite mode. Use `logappend` to
|
||||
# specify a log file to **append** logs to.
|
||||
# c.ZMQInteractiveShell.logstart = False
|
||||
|
||||
# Set the size of the output cache. The default is 1000, you can change it
|
||||
# permanently in your config file. Setting it to 0 completely disables the
|
||||
# caching system, and the minimum value accepted is 20 (if you provide a value
|
||||
# less than 20, it is reset to 0 and a warning is issued). This limit is
|
||||
# defined because otherwise you'll spend more time re-flushing a too small cache
|
||||
# than working
|
||||
# c.ZMQInteractiveShell.cache_size = 1000
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.wildcards_case_sensitive = True
|
||||
|
||||
# The name of the logfile to use.
|
||||
# c.ZMQInteractiveShell.logfile = ''
|
||||
|
||||
# 'all', 'last', 'last_expr' or 'none', specifying which nodes should be run
|
||||
# interactively (displaying output from expressions).
|
||||
# c.ZMQInteractiveShell.ast_node_interactivity = 'last_expr'
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.debug = False
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.quiet = False
|
||||
|
||||
# Save multi-line entries as one entry in readline history
|
||||
# c.ZMQInteractiveShell.multiline_history = True
|
||||
|
||||
# Deprecated, use PromptManager.in_template
|
||||
# c.ZMQInteractiveShell.prompt_in1 = 'In [\\#]: '
|
||||
|
||||
# Enable magic commands to be called without the leading %.
|
||||
# c.ZMQInteractiveShell.automagic = True
|
||||
|
||||
# The part of the banner to be printed before the profile
|
||||
# c.ZMQInteractiveShell.banner1 = 'Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41) \nType "copyright", "credits" or "license" for more information.\n\nIPython 3.1.0 -- An enhanced Interactive Python.\nAnaconda is brought to you by Continuum Analytics.\nPlease check out: http://continuum.io/thanks and https://binstar.org\n? -> Introduction and overview of IPython\'s features.\n%quickref -> Quick reference.\nhelp -> Python\'s own help system.\nobject? -> Details about \'object\', use \'object??\' for extra details.\n'
|
||||
|
||||
# Make IPython automatically call any callable object even if you didn't type
|
||||
# explicit parentheses. For example, 'str 43' becomes 'str(43)' automatically.
|
||||
# The value can be '0' to disable the feature, '1' for 'smart' autocall, where
|
||||
# it is not applied if there are no more arguments on the line, and '2' for
|
||||
# 'full' autocall, where all callable objects are automatically called (even if
|
||||
# no arguments are present).
|
||||
# c.ZMQInteractiveShell.autocall = 0
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.readline_parse_and_bind = ['tab: complete', '"\\C-l": clear-screen', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard']
|
||||
|
||||
# Set the color scheme (NoColor, Linux, or LightBG).
|
||||
# c.ZMQInteractiveShell.colors = 'LightBG'
|
||||
|
||||
# Use colors for displaying information about objects. Because this information
|
||||
# is passed through a pager (like 'less'), and some pagers get confused with
|
||||
# color codes, this capability can be turned off.
|
||||
# c.ZMQInteractiveShell.color_info = True
|
||||
|
||||
# Show rewritten input, e.g. for autocall.
|
||||
# c.ZMQInteractiveShell.show_rewritten_input = True
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.xmode = 'Context'
|
||||
|
||||
#
|
||||
# c.ZMQInteractiveShell.separate_out2 = ''
|
||||
|
||||
# The part of the banner to be printed after the profile
|
||||
# c.ZMQInteractiveShell.banner2 = ''
|
||||
|
||||
# Start logging to the given file in append mode. Use `logfile` to specify a log
|
||||
# file to **overwrite** logs to.
|
||||
# c.ZMQInteractiveShell.logappend = ''
|
||||
|
||||
# Don't call post-execute functions that have failed in the past.
|
||||
# c.ZMQInteractiveShell.disable_failing_post_execute = False
|
||||
|
||||
# Deprecated, use PromptManager.out_template
|
||||
# c.ZMQInteractiveShell.prompt_out = 'Out[\\#]: '
|
||||
|
||||
# Enable deep (recursive) reloading by default. IPython can use the deep_reload
|
||||
# module which reloads changes in modules recursively (it replaces the reload()
|
||||
# function, so you don't need to change anything to use it). deep_reload()
|
||||
# forces a full reload of modules whose code may have changed, which the default
|
||||
# reload() function does not. When deep_reload is off, IPython will use the
|
||||
# normal reload(), but deep_reload will still be available as dreload().
|
||||
# c.ZMQInteractiveShell.deep_reload = False
|
||||
|
||||
# Deprecated, use PromptManager.justify
|
||||
# c.ZMQInteractiveShell.prompts_pad_left = True
|
||||
|
||||
# A list of ast.NodeTransformer subclass instances, which will be applied to
|
||||
# user input before code is run.
|
||||
# c.ZMQInteractiveShell.ast_transformers = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Session configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Object for handling serialization and sending of messages.
|
||||
#
|
||||
# The Session object handles building messages and sending them with ZMQ sockets
|
||||
# or ZMQStream objects. Objects can communicate with each other over the
|
||||
# network via Session objects, and only need to work with the dict-based IPython
|
||||
# message spec. The Session will handle serialization/deserialization, security,
|
||||
# and metadata.
|
||||
#
|
||||
# Sessions support configurable serialization via packer/unpacker traits, and
|
||||
# signing with HMAC digests via the key/keyfile traits.
|
||||
#
|
||||
# Parameters ----------
|
||||
#
|
||||
# debug : bool
|
||||
# whether to trigger extra debugging statements
|
||||
# packer/unpacker : str : 'json', 'pickle' or import_string
|
||||
# importstrings for methods to serialize message parts. If just
|
||||
# 'json' or 'pickle', predefined JSON and pickle packers will be used.
|
||||
# Otherwise, the entire importstring must be used.
|
||||
#
|
||||
# The functions must accept at least valid JSON input, and output *bytes*.
|
||||
#
|
||||
# For example, to use msgpack:
|
||||
# packer = 'msgpack.packb', unpacker='msgpack.unpackb'
|
||||
# pack/unpack : callables
|
||||
# You can also set the pack/unpack callables for serialization directly.
|
||||
# session : bytes
|
||||
# the ID of this Session object. The default is to generate a new UUID.
|
||||
# username : unicode
|
||||
# username added to message headers. The default is to ask the OS.
|
||||
# key : bytes
|
||||
# The key used to initialize an HMAC signature. If unset, messages
|
||||
# will not be signed or checked.
|
||||
# keyfile : filepath
|
||||
# The file containing a key. If this is set, `key` will be initialized
|
||||
# to the contents of the file.
|
||||
|
||||
# The digest scheme used to construct the message signatures. Must have the form
|
||||
# 'hmac-HASH'.
|
||||
# c.Session.signature_scheme = 'hmac-sha256'
|
||||
|
||||
# The maximum number of digests to remember.
|
||||
#
|
||||
# The digest history will be culled when it exceeds this value.
|
||||
# c.Session.digest_history_size = 65536
|
||||
|
||||
# The name of the unpacker for unserializing messages. Only used with custom
|
||||
# functions for `packer`.
|
||||
# c.Session.unpacker = 'json'
|
||||
|
||||
# The name of the packer for serializing messages. Should be one of 'json',
|
||||
# 'pickle', or an import name for a custom callable serializer.
|
||||
# c.Session.packer = 'json'
|
||||
|
||||
# Username for the Session. Default is your system username.
|
||||
# c.Session.username = 'minrk'
|
||||
|
||||
# Debug output in the Session
|
||||
# c.Session.debug = False
|
||||
|
||||
# path to file containing execution key.
|
||||
# c.Session.keyfile = ''
|
||||
|
||||
# The maximum number of items for a container to be introspected for custom
|
||||
# serialization. Containers larger than this are pickled outright.
|
||||
# c.Session.item_threshold = 64
|
||||
|
||||
# Threshold (in bytes) beyond which an object's buffer should be extracted to
|
||||
# avoid pickling.
|
||||
# c.Session.buffer_threshold = 1024
|
||||
|
||||
# The UUID identifying this session.
|
||||
# c.Session.session = ''
|
||||
|
||||
# Threshold (in bytes) beyond which a buffer should be sent without copying.
|
||||
# c.Session.copy_threshold = 65536
|
||||
|
||||
# execution key, for signing messages.
|
||||
# c.Session.key = b''
|
||||
|
||||
# Metadata dictionary, which serves as the default top-level metadata dict for
|
||||
# each message.
|
||||
# c.Session.metadata = {}
|
@ -0,0 +1,971 @@
|
||||
# Configuration file for ipython-nbconvert.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NbConvertApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# This application is used to convert notebook files (*.ipynb) to various other
|
||||
# formats.
|
||||
#
|
||||
# WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES.
|
||||
|
||||
# NbConvertApp will inherit config from: BaseIPythonApplication, Application
|
||||
|
||||
# List of notebooks to convert. Wildcards are supported. Filenames passed
|
||||
# positionally will be added to the list.
|
||||
# c.NbConvertApp.notebooks = []
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.NbConvertApp.profile = 'default'
|
||||
|
||||
# The export format to be used.
|
||||
# c.NbConvertApp.export_format = 'html'
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.NbConvertApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# overwrite base name use for output files. can only be used when converting one
|
||||
# notebook at a time.
|
||||
# c.NbConvertApp.output_base = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.NbConvertApp.verbose_crash = False
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.NbConvertApp.extra_config_file = ''
|
||||
|
||||
# Writer class used to write the results of the conversion
|
||||
# c.NbConvertApp.writer_class = 'FilesWriter'
|
||||
|
||||
# PostProcessor class used to write the results of the conversion
|
||||
# c.NbConvertApp.postprocessor_class = ''
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.NbConvertApp.log_level = 30
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.NbConvertApp.ipython_dir = ''
|
||||
|
||||
# Whether to create profile dir if it doesn't exist
|
||||
# c.NbConvertApp.auto_create = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.NbConvertApp.overwrite = False
|
||||
|
||||
# Whether to apply a suffix prior to the extension (only relevant when
|
||||
# converting to notebook format). The suffix is determined by the exporter, and
|
||||
# is usually '.nbconvert'.
|
||||
# c.NbConvertApp.use_output_suffix = True
|
||||
|
||||
# The Logging format template
|
||||
# c.NbConvertApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.NbConvertApp.copy_config_files = False
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NbConvertBase configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Global configurable class for shared config
|
||||
#
|
||||
# Useful for display data priority that might be use by many transformers
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.NbConvertBase.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.NbConvertBase.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Exporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Class containing methods that sequentially run a list of preprocessors on a
|
||||
# NotebookNode object and then return the modified NotebookNode object and
|
||||
# accompanying resources dict.
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.Exporter.preprocessors = []
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.Exporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.Exporter.file_extension = '.txt'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# HTMLExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports a basic HTML document. This exporter assists with the export of HTML.
|
||||
# Inherit from it if you are writing your own HTML template and need custom
|
||||
# preprocessors/filters. If you don't need custom preprocessors/ filters, just
|
||||
# change the 'template_file' config option.
|
||||
|
||||
# HTMLExporter will inherit config from: TemplateExporter, Exporter
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.HTMLExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.HTMLExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.HTMLExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.HTMLExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.HTMLExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.HTMLExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.HTMLExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.HTMLExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.HTMLExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# LatexExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports to a Latex template. Inherit from this class if your template is
|
||||
# LaTeX based and you need custom tranformers/filters. Inherit from it if you
|
||||
# are writing your own HTML template and need custom tranformers/filters. If
|
||||
# you don't need custom tranformers/filters, just change the 'template_file'
|
||||
# config option. Place your template in the special "/latex" subfolder of the
|
||||
# "../templates" folder.
|
||||
|
||||
# LatexExporter will inherit config from: TemplateExporter, Exporter
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_logic_block_end = '*))'
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.LatexExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_comment_block_start = '((='
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.LatexExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.LatexExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.LatexExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.LatexExporter.template_extension = '.tplx'
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_logic_block_start = '((*'
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_variable_block_start = '((('
|
||||
|
||||
#
|
||||
# c.LatexExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_comment_block_end = '=))'
|
||||
|
||||
#
|
||||
# c.LatexExporter.jinja_variable_block_end = ')))'
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.LatexExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.LatexExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# MarkdownExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports to a markdown document (.md)
|
||||
|
||||
# MarkdownExporter will inherit config from: TemplateExporter, Exporter
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.MarkdownExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.MarkdownExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.MarkdownExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.MarkdownExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.MarkdownExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.MarkdownExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.MarkdownExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NotebookExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports to an IPython notebook.
|
||||
|
||||
# NotebookExporter will inherit config from: Exporter
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.NotebookExporter.preprocessors = []
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.NotebookExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.NotebookExporter.file_extension = '.txt'
|
||||
|
||||
# The nbformat version to write. Use this to downgrade notebooks.
|
||||
# c.NotebookExporter.nbformat_version = 4
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PDFExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Writer designed to write to PDF files
|
||||
|
||||
# PDFExporter will inherit config from: LatexExporter, TemplateExporter,
|
||||
# Exporter
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_logic_block_end = '*))'
|
||||
|
||||
# How many times latex will be called.
|
||||
# c.PDFExporter.latex_count = 3
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.PDFExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_comment_block_start = '((='
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.PDFExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.PDFExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.PDFExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.PDFExporter.template_extension = '.tplx'
|
||||
|
||||
# Whether to display the output of latex commands.
|
||||
# c.PDFExporter.verbose = False
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_logic_block_start = '((*'
|
||||
|
||||
# Shell command used to compile latex.
|
||||
# c.PDFExporter.latex_command = ['pdflatex', '{filename}']
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_variable_block_start = '((('
|
||||
|
||||
#
|
||||
# c.PDFExporter.template_path = ['.']
|
||||
|
||||
# Shell command used to run bibtex.
|
||||
# c.PDFExporter.bib_command = ['bibtex', '{filename}']
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_comment_block_end = '=))'
|
||||
|
||||
# File extensions of temp files to remove after running.
|
||||
# c.PDFExporter.temp_file_exts = ['.aux', '.bbl', '.blg', '.idx', '.log', '.out']
|
||||
|
||||
#
|
||||
# c.PDFExporter.jinja_variable_block_end = ')))'
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.PDFExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.PDFExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PythonExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports a Python code file.
|
||||
|
||||
# PythonExporter will inherit config from: TemplateExporter, Exporter
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.PythonExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.PythonExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.PythonExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.PythonExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.PythonExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.PythonExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.PythonExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.PythonExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.PythonExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# RSTExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports restructured text documents.
|
||||
|
||||
# RSTExporter will inherit config from: TemplateExporter, Exporter
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.RSTExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.RSTExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.RSTExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.RSTExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.RSTExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.RSTExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.RSTExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.RSTExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.RSTExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SlidesExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports HTML slides with reveal.js
|
||||
|
||||
# SlidesExporter will inherit config from: HTMLExporter, TemplateExporter,
|
||||
# Exporter
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.SlidesExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.SlidesExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.SlidesExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.SlidesExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.SlidesExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.SlidesExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.SlidesExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.SlidesExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.SlidesExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TemplateExporter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Exports notebooks into other file formats. Uses Jinja 2 templating engine to
|
||||
# output new formats. Inherit from this class if you are creating a new
|
||||
# template type along with new filters/preprocessors. If the filters/
|
||||
# preprocessors provided by default suffice, there is no need to inherit from
|
||||
# this class. Instead, override the template_file and file_extension traits via
|
||||
# a config file.
|
||||
#
|
||||
# - ascii_only - add_prompts - add_anchor - html2text - strip_ansi -
|
||||
# comment_lines - ansi2html - strip_files_prefix - prevent_list_blocks -
|
||||
# highlight2html - indent - wrap_text - markdown2rst - citation2latex -
|
||||
# highlight2latex - filter_data_type - get_lines - escape_latex - ipython2python
|
||||
# - markdown2html - strip_dollars - path2url - posix_path - ansi2latex -
|
||||
# markdown2latex
|
||||
|
||||
# TemplateExporter will inherit config from: Exporter
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_logic_block_end = ''
|
||||
|
||||
# List of preprocessors available by default, by name, namespace, instance, or
|
||||
# type.
|
||||
# c.TemplateExporter.default_preprocessors = ['IPython.nbconvert.preprocessors.coalesce_streams', 'IPython.nbconvert.preprocessors.SVG2PDFPreprocessor', 'IPython.nbconvert.preprocessors.ExtractOutputPreprocessor', 'IPython.nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', 'IPython.nbconvert.preprocessors.RevealHelpPreprocessor', 'IPython.nbconvert.preprocessors.LatexPreprocessor', 'IPython.nbconvert.preprocessors.ClearOutputPreprocessor', 'IPython.nbconvert.preprocessors.ExecutePreprocessor', 'IPython.nbconvert.preprocessors.HighlightMagicsPreprocessor']
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_comment_block_start = ''
|
||||
|
||||
# Dictionary of filters, by name and namespace, to add to the Jinja environment.
|
||||
# c.TemplateExporter.filters = {}
|
||||
|
||||
# List of preprocessors, by name or namespace, to enable.
|
||||
# c.TemplateExporter.preprocessors = []
|
||||
|
||||
# Name of the template file to use
|
||||
# c.TemplateExporter.template_file = 'default'
|
||||
|
||||
#
|
||||
# c.TemplateExporter.template_extension = '.tpl'
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_logic_block_start = ''
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_variable_block_start = ''
|
||||
|
||||
#
|
||||
# c.TemplateExporter.template_path = ['.']
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_comment_block_end = ''
|
||||
|
||||
#
|
||||
# c.TemplateExporter.jinja_variable_block_end = ''
|
||||
|
||||
# Extension of the file that should be written to disk
|
||||
# c.TemplateExporter.file_extension = '.txt'
|
||||
|
||||
# formats of raw cells to be included in this Exporter's output.
|
||||
# c.TemplateExporter.raw_mimetypes = []
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# CSSHTMLHeaderPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Preprocessor used to pre-process notebook for HTML output. Adds IPython
|
||||
# notebook front-end CSS and Pygments CSS to HTML output.
|
||||
|
||||
# CSSHTMLHeaderPreprocessor will inherit config from: Preprocessor,
|
||||
# NbConvertBase
|
||||
|
||||
# CSS highlight class identifier
|
||||
# c.CSSHTMLHeaderPreprocessor.highlight_class = '.highlight'
|
||||
|
||||
#
|
||||
# c.CSSHTMLHeaderPreprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.CSSHTMLHeaderPreprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.CSSHTMLHeaderPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ClearOutputPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Removes the output from all code cells in a notebook.
|
||||
|
||||
# ClearOutputPreprocessor will inherit config from: Preprocessor, NbConvertBase
|
||||
|
||||
#
|
||||
# c.ClearOutputPreprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.ClearOutputPreprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.ClearOutputPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ConvertFiguresPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Converts all of the outputs in a notebook from one format to another.
|
||||
|
||||
# ConvertFiguresPreprocessor will inherit config from: Preprocessor,
|
||||
# NbConvertBase
|
||||
|
||||
# Format the converter accepts
|
||||
# c.ConvertFiguresPreprocessor.from_format = ''
|
||||
|
||||
# Format the converter writes
|
||||
# c.ConvertFiguresPreprocessor.to_format = ''
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.ConvertFiguresPreprocessor.default_language = 'ipython'
|
||||
|
||||
#
|
||||
# c.ConvertFiguresPreprocessor.enabled = False
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.ConvertFiguresPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ExecutePreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Executes all the cells in a notebook
|
||||
|
||||
# ExecutePreprocessor will inherit config from: Preprocessor, NbConvertBase
|
||||
|
||||
#
|
||||
# c.ExecutePreprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.ExecutePreprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.ExecutePreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# If execution of a cell times out, interrupt the kernel and continue executing
|
||||
# other cells rather than throwing an error and stopping.
|
||||
# c.ExecutePreprocessor.interrupt_on_timeout = False
|
||||
|
||||
# The time to wait (in seconds) for output from executions.
|
||||
# c.ExecutePreprocessor.timeout = 30
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ExtractOutputPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Extracts all of the outputs from the notebook file. The extracted outputs
|
||||
# are returned in the 'resources' dictionary.
|
||||
|
||||
# ExtractOutputPreprocessor will inherit config from: Preprocessor,
|
||||
# NbConvertBase
|
||||
|
||||
#
|
||||
# c.ExtractOutputPreprocessor.enabled = False
|
||||
|
||||
#
|
||||
# c.ExtractOutputPreprocessor.output_filename_template = '{unique_key}_{cell_index}_{index}{extension}'
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.ExtractOutputPreprocessor.default_language = 'ipython'
|
||||
|
||||
#
|
||||
# c.ExtractOutputPreprocessor.extract_output_types = {'image/svg+xml', 'image/png', 'application/pdf', 'image/jpeg'}
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.ExtractOutputPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# HighlightMagicsPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Detects and tags code cells that use a different languages than Python.
|
||||
|
||||
# HighlightMagicsPreprocessor will inherit config from: Preprocessor,
|
||||
# NbConvertBase
|
||||
|
||||
#
|
||||
# c.HighlightMagicsPreprocessor.enabled = False
|
||||
|
||||
# Syntax highlighting for magic's extension languages. Each item associates a
|
||||
# language magic extension such as %%R, with a pygments lexer such as r.
|
||||
# c.HighlightMagicsPreprocessor.languages = {}
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.HighlightMagicsPreprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.HighlightMagicsPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# LatexPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Preprocessor for latex destined documents.
|
||||
#
|
||||
# Mainly populates the `latex` key in the resources dict, adding definitions for
|
||||
# pygments highlight styles.
|
||||
|
||||
# LatexPreprocessor will inherit config from: Preprocessor, NbConvertBase
|
||||
|
||||
#
|
||||
# c.LatexPreprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.LatexPreprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.LatexPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Preprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A configurable preprocessor
|
||||
#
|
||||
# Inherit from this class if you wish to have configurability for your
|
||||
# preprocessor.
|
||||
#
|
||||
# Any configurable traitlets this class exposed will be configurable in profiles
|
||||
# using c.SubClassName.attribute = value
|
||||
#
|
||||
# you can overwrite :meth:`preprocess_cell` to apply a transformation
|
||||
# independently on each cell or :meth:`preprocess` if you prefer your own logic.
|
||||
# See corresponding docstring for informations.
|
||||
#
|
||||
# Disabled by default and can be enabled via the config by
|
||||
# 'c.YourPreprocessorName.enabled = True'
|
||||
|
||||
# Preprocessor will inherit config from: NbConvertBase
|
||||
|
||||
#
|
||||
# c.Preprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.Preprocessor.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.Preprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# RevealHelpPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# RevealHelpPreprocessor will inherit config from: Preprocessor, NbConvertBase
|
||||
|
||||
#
|
||||
# c.RevealHelpPreprocessor.enabled = False
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.RevealHelpPreprocessor.default_language = 'ipython'
|
||||
|
||||
# The URL prefix for reveal.js. This can be a a relative URL for a local copy of
|
||||
# reveal.js, or point to a CDN.
|
||||
#
|
||||
# For speaker notes to work, a local reveal.js prefix must be used.
|
||||
# c.RevealHelpPreprocessor.url_prefix = 'reveal.js'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.RevealHelpPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SVG2PDFPreprocessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Converts all of the outputs in a notebook from SVG to PDF.
|
||||
|
||||
# SVG2PDFPreprocessor will inherit config from: ConvertFiguresPreprocessor,
|
||||
# Preprocessor, NbConvertBase
|
||||
|
||||
# Format the converter writes
|
||||
# c.SVG2PDFPreprocessor.to_format = ''
|
||||
|
||||
# The path to Inkscape, if necessary
|
||||
# c.SVG2PDFPreprocessor.inkscape = ''
|
||||
|
||||
# Format the converter accepts
|
||||
# c.SVG2PDFPreprocessor.from_format = ''
|
||||
|
||||
# The command to use for converting SVG to PDF
|
||||
#
|
||||
# This string is a template, which will be formatted with the keys to_filename
|
||||
# and from_filename.
|
||||
#
|
||||
# The conversion call must read the SVG from {from_flename}, and write a PDF to
|
||||
# {to_filename}.
|
||||
# c.SVG2PDFPreprocessor.command = ''
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.SVG2PDFPreprocessor.default_language = 'ipython'
|
||||
|
||||
#
|
||||
# c.SVG2PDFPreprocessor.enabled = False
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.SVG2PDFPreprocessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# FilesWriter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Consumes nbconvert output and produces files.
|
||||
|
||||
# FilesWriter will inherit config from: WriterBase, NbConvertBase
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.FilesWriter.default_language = 'ipython'
|
||||
|
||||
# When copying files that the notebook depends on, copy them in relation to this
|
||||
# path, such that the destination filename will be os.path.relpath(filename,
|
||||
# relpath). If FilesWriter is operating on a notebook that already exists
|
||||
# elsewhere on disk, then the default will be the directory containing that
|
||||
# notebook.
|
||||
# c.FilesWriter.relpath = ''
|
||||
|
||||
# Directory to write output to. Leave blank to output to the current directory
|
||||
# c.FilesWriter.build_directory = ''
|
||||
|
||||
# List of the files that the notebook references. Files will be included with
|
||||
# written output.
|
||||
# c.FilesWriter.files = []
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.FilesWriter.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# StdoutWriter configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Consumes output from nbconvert export...() methods and writes to the stdout
|
||||
# stream.
|
||||
|
||||
# StdoutWriter will inherit config from: WriterBase, NbConvertBase
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.StdoutWriter.default_language = 'ipython'
|
||||
|
||||
# List of the files that the notebook references. Files will be included with
|
||||
# written output.
|
||||
# c.StdoutWriter.files = []
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.StdoutWriter.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# WriterBase configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Consumes output from nbconvert export...() methods and writes to a useful
|
||||
# location.
|
||||
|
||||
# WriterBase will inherit config from: NbConvertBase
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.WriterBase.default_language = 'ipython'
|
||||
|
||||
# List of the files that the notebook references. Files will be included with
|
||||
# written output.
|
||||
# c.WriterBase.files = []
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.WriterBase.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PostProcessorBase configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# PostProcessorBase will inherit config from: NbConvertBase
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.PostProcessorBase.default_language = 'ipython'
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.PostProcessorBase.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ServePostProcessor configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Post processor designed to serve files
|
||||
#
|
||||
# Proxies reveal.js requests to a CDN if no local reveal.js is present
|
||||
|
||||
# ServePostProcessor will inherit config from: PostProcessorBase, NbConvertBase
|
||||
|
||||
# URL prefix for reveal.js
|
||||
# c.ServePostProcessor.reveal_prefix = 'reveal.js'
|
||||
|
||||
# Should the browser be opened automatically?
|
||||
# c.ServePostProcessor.open_in_browser = True
|
||||
|
||||
# An ordered list of preferred output type, the first encountered will usually
|
||||
# be used when converting discarding the others.
|
||||
# c.ServePostProcessor.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg', 'text/plain']
|
||||
|
||||
# DEPRECATED default highlight language, please use language_info metadata
|
||||
# instead
|
||||
# c.ServePostProcessor.default_language = 'ipython'
|
||||
|
||||
# port for the server to listen on.
|
||||
# c.ServePostProcessor.port = 8000
|
||||
|
||||
# URL for reveal.js CDN.
|
||||
# c.ServePostProcessor.reveal_cdn = 'https://cdn.jsdelivr.net/reveal.js/2.6.2'
|
||||
|
||||
# The IP address to listen on.
|
||||
# c.ServePostProcessor.ip = '127.0.0.1'
|
@ -0,0 +1,548 @@
|
||||
# Configuration file for ipython-notebook.
|
||||
|
||||
c = get_config()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NotebookApp configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# NotebookApp will inherit config from: BaseIPythonApplication, Application
|
||||
|
||||
# Supply SSL options for the tornado HTTPServer. See the tornado docs for
|
||||
# details.
|
||||
# c.NotebookApp.ssl_options = {}
|
||||
|
||||
# The config manager class to use
|
||||
# c.NotebookApp.config_manager_class = <class 'IPython.html.services.config.manager.ConfigManager'>
|
||||
|
||||
# Hashed password to use for web authentication.
|
||||
#
|
||||
# To generate, type in a python/IPython shell:
|
||||
#
|
||||
# from IPython.lib import passwd; passwd()
|
||||
#
|
||||
# The string should be of the form type:salt:hashed-password.
|
||||
# c.NotebookApp.password = ''
|
||||
|
||||
# The number of additional ports to try if the specified port is not available.
|
||||
# c.NotebookApp.port_retries = 50
|
||||
|
||||
# The kernel manager class to use.
|
||||
# c.NotebookApp.kernel_manager_class = <class 'IPython.html.services.kernels.kernelmanager.MappingKernelManager'>
|
||||
|
||||
# The port the notebook server will listen on.
|
||||
# c.NotebookApp.port = 8888
|
||||
|
||||
# Set the log level by value or name.
|
||||
# c.NotebookApp.log_level = 30
|
||||
|
||||
# Path to an extra config file to load.
|
||||
#
|
||||
# If specified, load this config file in addition to any other IPython config.
|
||||
# c.NotebookApp.extra_config_file = ''
|
||||
|
||||
# The cluster manager class to use.
|
||||
# c.NotebookApp.cluster_manager_class = <class 'IPython.html.services.clusters.clustermanager.ClusterManager'>
|
||||
|
||||
# The base URL for the notebook server.
|
||||
#
|
||||
# Leading and trailing slashes can be omitted, and will automatically be added.
|
||||
# c.NotebookApp.base_url = '/'
|
||||
|
||||
# Python modules to load as notebook server extensions. This is an experimental
|
||||
# API, and may change in future releases.
|
||||
# c.NotebookApp.server_extensions = []
|
||||
|
||||
# The login handler class to use.
|
||||
# c.NotebookApp.login_handler_class = <class 'IPython.html.auth.login.LoginHandler'>
|
||||
|
||||
# The session manager class to use.
|
||||
# c.NotebookApp.session_manager_class = <class 'IPython.html.services.sessions.sessionmanager.SessionManager'>
|
||||
|
||||
# Set the Access-Control-Allow-Origin header
|
||||
#
|
||||
# Use '*' to allow any origin to access your server.
|
||||
#
|
||||
# Takes precedence over allow_origin_pat.
|
||||
# c.NotebookApp.allow_origin = ''
|
||||
|
||||
# Whether to enable MathJax for typesetting math/TeX
|
||||
#
|
||||
# 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.
|
||||
# c.NotebookApp.enable_mathjax = True
|
||||
|
||||
# The notebook manager class to use.
|
||||
# c.NotebookApp.contents_manager_class = <class 'IPython.html.services.contents.filemanager.FileContentsManager'>
|
||||
|
||||
# The full path to an SSL/TLS certificate file.
|
||||
# c.NotebookApp.certfile = ''
|
||||
|
||||
# Set the Access-Control-Allow-Credentials: true header
|
||||
# c.NotebookApp.allow_credentials = False
|
||||
|
||||
# The Logging format template
|
||||
# c.NotebookApp.log_format = '[%(name)s]%(highlevel)s %(message)s'
|
||||
|
||||
# The base URL for websockets, if it differs from the HTTP server (hint: it
|
||||
# almost certainly doesn't).
|
||||
#
|
||||
# Should be in the form of an HTTP origin: ws[s]://hostname[:port]
|
||||
# c.NotebookApp.websocket_url = ''
|
||||
|
||||
# Use a regular expression for the Access-Control-Allow-Origin header
|
||||
#
|
||||
# Requests from an origin matching the expression will get replies with:
|
||||
#
|
||||
# Access-Control-Allow-Origin: origin
|
||||
#
|
||||
# where `origin` is the origin of the request.
|
||||
#
|
||||
# Ignored if allow_origin is set.
|
||||
# c.NotebookApp.allow_origin_pat = ''
|
||||
|
||||
# The date format used by logging formatters for %(asctime)s
|
||||
# c.NotebookApp.log_datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
|
||||
# The logout handler class to use.
|
||||
# c.NotebookApp.logout_handler_class = <class 'IPython.html.auth.logout.LogoutHandler'>
|
||||
|
||||
# The default URL to redirect to from `/`
|
||||
# c.NotebookApp.default_url = '/tree'
|
||||
|
||||
# The IPython profile to use.
|
||||
# c.NotebookApp.profile = 'default'
|
||||
|
||||
# extra paths to look for Javascript notebook extensions
|
||||
# c.NotebookApp.extra_nbextensions_path = []
|
||||
|
||||
# Specify what command to use to invoke a web browser when opening the notebook.
|
||||
# If not specified, the default browser will be determined by the `webbrowser`
|
||||
# standard library module, which allows setting of the BROWSER environment
|
||||
# variable to override it.
|
||||
# c.NotebookApp.browser = ''
|
||||
|
||||
# The url for MathJax.js.
|
||||
# c.NotebookApp.mathjax_url = ''
|
||||
|
||||
# Supply overrides for the tornado.web.Application that the IPython notebook
|
||||
# uses.
|
||||
# c.NotebookApp.tornado_settings = {}
|
||||
|
||||
# The file where the cookie secret is stored.
|
||||
# c.NotebookApp.cookie_secret_file = ''
|
||||
|
||||
# Create a massive crash report when IPython encounters what may be an internal
|
||||
# error. The default is to append a short message to the usual traceback
|
||||
# c.NotebookApp.verbose_crash = False
|
||||
|
||||
# Whether to overwrite existing config files when copying
|
||||
# c.NotebookApp.overwrite = False
|
||||
|
||||
# Whether to open in a browser after starting. The specific browser used is
|
||||
# platform dependent and determined by the python standard library `webbrowser`
|
||||
# module, unless it is overridden using the --browser (NotebookApp.browser)
|
||||
# configuration option.
|
||||
# c.NotebookApp.open_browser = True
|
||||
|
||||
# DEPRECATED, use tornado_settings
|
||||
# c.NotebookApp.webapp_settings = {}
|
||||
|
||||
# Reraise exceptions encountered loading server extensions?
|
||||
# c.NotebookApp.reraise_server_extension_failures = False
|
||||
|
||||
# Whether to install the default config files into the profile dir. If a new
|
||||
# profile is being created, and IPython contains config files for that profile,
|
||||
# then they will be staged into the new directory. Otherwise, default config
|
||||
# files will be automatically generated.
|
||||
# c.NotebookApp.copy_config_files = False
|
||||
|
||||
# DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
|
||||
# c.NotebookApp.pylab = 'disabled'
|
||||
|
||||
# The directory to use for notebooks and kernels.
|
||||
# c.NotebookApp.notebook_dir = ''
|
||||
|
||||
# The kernel spec manager class to use. Should be a subclass of
|
||||
# `IPython.kernel.kernelspec.KernelSpecManager`.
|
||||
#
|
||||
# The Api of KernelSpecManager is provisional and might change without warning
|
||||
# between this version of IPython and the next stable one.
|
||||
# c.NotebookApp.kernel_spec_manager_class = <class 'IPython.kernel.kernelspec.KernelSpecManager'>
|
||||
|
||||
#
|
||||
# c.NotebookApp.file_to_run = ''
|
||||
|
||||
# DEPRECATED use base_url
|
||||
# c.NotebookApp.base_project_url = '/'
|
||||
|
||||
# The random bytes used to secure cookies. By default this is a new random
|
||||
# number every time you start the Notebook. Set it to a value in a config file
|
||||
# to enable logins to persist across server sessions.
|
||||
#
|
||||
# Note: Cookie secrets should be kept private, do not share config files with
|
||||
# cookie_secret stored in plaintext (you can read the value from a file).
|
||||
# c.NotebookApp.cookie_secret = b''
|
||||
|
||||
# The full path to a private key file for usage with SSL/TLS.
|
||||
# c.NotebookApp.keyfile = ''
|
||||
|
||||
# Extra paths to search for serving static files.
|
||||
#
|
||||
# This allows adding javascript/css to be available from the notebook server
|
||||
# machine, or overriding individual files in the IPython
|
||||
# c.NotebookApp.extra_static_paths = []
|
||||
|
||||
# The name of the IPython directory. This directory is used for logging
|
||||
# configuration (through profiles), history storage, etc. The default is usually
|
||||
# $HOME/.ipython. This option can also be specified through the environment
|
||||
# variable IPYTHONDIR.
|
||||
# c.NotebookApp.ipython_dir = ''
|
||||
|
||||
# Extra paths to search for serving jinja templates.
|
||||
#
|
||||
# Can be used to override templates from IPython.html.templates.
|
||||
# c.NotebookApp.extra_template_paths = []
|
||||
|
||||
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
|
||||
# For headerssent by the upstream reverse proxy. Necessary if the proxy handles
|
||||
# SSL
|
||||
# c.NotebookApp.trust_xheaders = False
|
||||
|
||||
# Supply extra arguments that will be passed to Jinja environment.
|
||||
# c.NotebookApp.jinja_environment_options = {}
|
||||
|
||||
# The IP address the notebook server will listen on.
|
||||
# c.NotebookApp.ip = 'localhost'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# KernelManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Manages a single kernel in a subprocess on this host.
|
||||
#
|
||||
# This version starts kernels with Popen.
|
||||
|
||||
# KernelManager will inherit config from: ConnectionFileMixin
|
||||
|
||||
# set the heartbeat port [default: random]
|
||||
# c.KernelManager.hb_port = 0
|
||||
|
||||
# set the stdin (ROUTER) port [default: random]
|
||||
# c.KernelManager.stdin_port = 0
|
||||
|
||||
#
|
||||
# c.KernelManager.transport = 'tcp'
|
||||
|
||||
# JSON file in which to store connection info [default: kernel-<pid>.json]
|
||||
#
|
||||
# This file will contain the IP, ports, and authentication key needed to connect
|
||||
# clients to this kernel. By default, this file will be created in the security
|
||||
# dir of the current profile, but can be specified by absolute path.
|
||||
# c.KernelManager.connection_file = ''
|
||||
|
||||
# set the control (ROUTER) port [default: random]
|
||||
# c.KernelManager.control_port = 0
|
||||
|
||||
# set the shell (ROUTER) port [default: random]
|
||||
# c.KernelManager.shell_port = 0
|
||||
|
||||
# Should we autorestart the kernel if it dies.
|
||||
# c.KernelManager.autorestart = False
|
||||
|
||||
# DEPRECATED: Use kernel_name instead.
|
||||
#
|
||||
# The Popen Command to launch the kernel. Override this if you have a custom
|
||||
# kernel. If kernel_cmd is specified in a configuration file, IPython does not
|
||||
# pass any arguments to the kernel, because it cannot make any assumptions about
|
||||
# the arguments that the kernel understands. In particular, this means that the
|
||||
# kernel does not receive the option --debug if it given on the IPython command
|
||||
# line.
|
||||
# c.KernelManager.kernel_cmd = []
|
||||
|
||||
# Set the kernel's IP address [default localhost]. If the IP address is
|
||||
# something other than localhost, then Consoles on other machines will be able
|
||||
# to connect to the Kernel, so be careful!
|
||||
# c.KernelManager.ip = ''
|
||||
|
||||
# set the iopub (PUB) port [default: random]
|
||||
# c.KernelManager.iopub_port = 0
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ProfileDir configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# An object to manage the profile directory and its resources.
|
||||
#
|
||||
# The profile directory is used by all IPython applications, to manage
|
||||
# configuration, logging and security.
|
||||
#
|
||||
# This object knows how to find, create and manage these directories. This
|
||||
# should be used by any code that wants to handle profiles.
|
||||
|
||||
# Set the profile location directly. This overrides the logic used by the
|
||||
# `profile` option.
|
||||
# c.ProfileDir.location = ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Session configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Object for handling serialization and sending of messages.
|
||||
#
|
||||
# The Session object handles building messages and sending them with ZMQ sockets
|
||||
# or ZMQStream objects. Objects can communicate with each other over the
|
||||
# network via Session objects, and only need to work with the dict-based IPython
|
||||
# message spec. The Session will handle serialization/deserialization, security,
|
||||
# and metadata.
|
||||
#
|
||||
# Sessions support configurable serialization via packer/unpacker traits, and
|
||||
# signing with HMAC digests via the key/keyfile traits.
|
||||
#
|
||||
# Parameters ----------
|
||||
#
|
||||
# debug : bool
|
||||
# whether to trigger extra debugging statements
|
||||
# packer/unpacker : str : 'json', 'pickle' or import_string
|
||||
# importstrings for methods to serialize message parts. If just
|
||||
# 'json' or 'pickle', predefined JSON and pickle packers will be used.
|
||||
# Otherwise, the entire importstring must be used.
|
||||
#
|
||||
# The functions must accept at least valid JSON input, and output *bytes*.
|
||||
#
|
||||
# For example, to use msgpack:
|
||||
# packer = 'msgpack.packb', unpacker='msgpack.unpackb'
|
||||
# pack/unpack : callables
|
||||
# You can also set the pack/unpack callables for serialization directly.
|
||||
# session : bytes
|
||||
# the ID of this Session object. The default is to generate a new UUID.
|
||||
# username : unicode
|
||||
# username added to message headers. The default is to ask the OS.
|
||||
# key : bytes
|
||||
# The key used to initialize an HMAC signature. If unset, messages
|
||||
# will not be signed or checked.
|
||||
# keyfile : filepath
|
||||
# The file containing a key. If this is set, `key` will be initialized
|
||||
# to the contents of the file.
|
||||
|
||||
# The digest scheme used to construct the message signatures. Must have the form
|
||||
# 'hmac-HASH'.
|
||||
# c.Session.signature_scheme = 'hmac-sha256'
|
||||
|
||||
# The maximum number of digests to remember.
|
||||
#
|
||||
# The digest history will be culled when it exceeds this value.
|
||||
# c.Session.digest_history_size = 65536
|
||||
|
||||
# The name of the unpacker for unserializing messages. Only used with custom
|
||||
# functions for `packer`.
|
||||
# c.Session.unpacker = 'json'
|
||||
|
||||
# The name of the packer for serializing messages. Should be one of 'json',
|
||||
# 'pickle', or an import name for a custom callable serializer.
|
||||
# c.Session.packer = 'json'
|
||||
|
||||
# Username for the Session. Default is your system username.
|
||||
# c.Session.username = 'minrk'
|
||||
|
||||
# Debug output in the Session
|
||||
# c.Session.debug = False
|
||||
|
||||
# path to file containing execution key.
|
||||
# c.Session.keyfile = ''
|
||||
|
||||
# The maximum number of items for a container to be introspected for custom
|
||||
# serialization. Containers larger than this are pickled outright.
|
||||
# c.Session.item_threshold = 64
|
||||
|
||||
# Threshold (in bytes) beyond which an object's buffer should be extracted to
|
||||
# avoid pickling.
|
||||
# c.Session.buffer_threshold = 1024
|
||||
|
||||
# The UUID identifying this session.
|
||||
# c.Session.session = ''
|
||||
|
||||
# Threshold (in bytes) beyond which a buffer should be sent without copying.
|
||||
# c.Session.copy_threshold = 65536
|
||||
|
||||
# execution key, for signing messages.
|
||||
# c.Session.key = b''
|
||||
|
||||
# Metadata dictionary, which serves as the default top-level metadata dict for
|
||||
# each message.
|
||||
# c.Session.metadata = {}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# MappingKernelManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A KernelManager that handles notebook mapping and HTTP error handling
|
||||
|
||||
# MappingKernelManager will inherit config from: MultiKernelManager
|
||||
|
||||
# The kernel manager class. This is configurable to allow subclassing of the
|
||||
# KernelManager for customized behavior.
|
||||
# c.MappingKernelManager.kernel_manager_class = 'IPython.kernel.ioloop.IOLoopKernelManager'
|
||||
|
||||
#
|
||||
# c.MappingKernelManager.root_dir = ''
|
||||
|
||||
# The name of the default kernel to start
|
||||
# c.MappingKernelManager.default_kernel_name = 'python3'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ContentsManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Base class for serving files and directories.
|
||||
#
|
||||
# This serves any text or binary file, as well as directories, with special
|
||||
# handling for JSON notebook documents.
|
||||
#
|
||||
# Most APIs take a path argument, which is always an API-style unicode path, and
|
||||
# always refers to a directory.
|
||||
#
|
||||
# - unicode, not url-escaped
|
||||
# - '/'-separated
|
||||
# - leading and trailing '/' will be stripped
|
||||
# - if unspecified, path defaults to '',
|
||||
# indicating the root path.
|
||||
|
||||
# The base name used when creating untitled directories.
|
||||
# c.ContentsManager.untitled_directory = 'Untitled Folder'
|
||||
|
||||
# Python callable or importstring thereof
|
||||
#
|
||||
# To be called on a contents model prior to save.
|
||||
#
|
||||
# This can be used to process the structure, such as removing notebook outputs
|
||||
# or other side effects that should not be saved.
|
||||
#
|
||||
# It will be called as (all arguments passed by keyword)::
|
||||
#
|
||||
# hook(path=path, model=model, contents_manager=self)
|
||||
#
|
||||
# - model: the model to be saved. Includes file contents.
|
||||
# Modifying this dict will affect the file that is stored.
|
||||
# - path: the API path of the save destination
|
||||
# - contents_manager: this ContentsManager instance
|
||||
# c.ContentsManager.pre_save_hook = None
|
||||
|
||||
# Glob patterns to hide in file and directory listings.
|
||||
# c.ContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~']
|
||||
|
||||
# The base name used when creating untitled files.
|
||||
# c.ContentsManager.untitled_file = 'untitled'
|
||||
|
||||
# The base name used when creating untitled notebooks.
|
||||
# c.ContentsManager.untitled_notebook = 'Untitled'
|
||||
|
||||
#
|
||||
# c.ContentsManager.checkpoints = None
|
||||
|
||||
#
|
||||
# c.ContentsManager.checkpoints_class = <class 'IPython.html.services.contents.checkpoints.Checkpoints'>
|
||||
|
||||
#
|
||||
# c.ContentsManager.checkpoints_kwargs = {}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# FileContentsManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# FileContentsManager will inherit config from: ContentsManager
|
||||
|
||||
# The base name used when creating untitled directories.
|
||||
# c.FileContentsManager.untitled_directory = 'Untitled Folder'
|
||||
|
||||
# Python callable or importstring thereof
|
||||
#
|
||||
# To be called on a contents model prior to save.
|
||||
#
|
||||
# This can be used to process the structure, such as removing notebook outputs
|
||||
# or other side effects that should not be saved.
|
||||
#
|
||||
# It will be called as (all arguments passed by keyword)::
|
||||
#
|
||||
# hook(path=path, model=model, contents_manager=self)
|
||||
#
|
||||
# - model: the model to be saved. Includes file contents.
|
||||
# Modifying this dict will affect the file that is stored.
|
||||
# - path: the API path of the save destination
|
||||
# - contents_manager: this ContentsManager instance
|
||||
# c.FileContentsManager.pre_save_hook = None
|
||||
|
||||
# Glob patterns to hide in file and directory listings.
|
||||
# c.FileContentsManager.hide_globs = ['__pycache__', '*.pyc', '*.pyo', '.DS_Store', '*.so', '*.dylib', '*~']
|
||||
|
||||
# The base name used when creating untitled files.
|
||||
# c.FileContentsManager.untitled_file = 'untitled'
|
||||
|
||||
# The base name used when creating untitled notebooks.
|
||||
# c.FileContentsManager.untitled_notebook = 'Untitled'
|
||||
|
||||
# Python callable or importstring thereof
|
||||
#
|
||||
# to be called on the path of a file just saved.
|
||||
#
|
||||
# This can be used to process the file on disk, such as converting the notebook
|
||||
# to a script or HTML via nbconvert.
|
||||
#
|
||||
# It will be called as (all arguments passed by keyword)::
|
||||
#
|
||||
# hook(os_path=os_path, model=model, contents_manager=instance)
|
||||
#
|
||||
# - path: the filesystem path to the file just written - model: the model
|
||||
# representing the file - contents_manager: this ContentsManager instance
|
||||
# c.FileContentsManager.post_save_hook = None
|
||||
|
||||
# DEPRECATED, use post_save_hook
|
||||
# c.FileContentsManager.save_script = False
|
||||
|
||||
#
|
||||
# c.FileContentsManager.root_dir = ''
|
||||
|
||||
#
|
||||
# c.FileContentsManager.checkpoints_class = <class 'IPython.html.services.contents.checkpoints.Checkpoints'>
|
||||
|
||||
#
|
||||
# c.FileContentsManager.checkpoints = None
|
||||
|
||||
#
|
||||
# c.FileContentsManager.checkpoints_kwargs = {}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NotebookNotary configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# A class for computing and verifying notebook signatures.
|
||||
|
||||
# The number of notebook signatures to cache. When the number of signatures
|
||||
# exceeds this value, the oldest 25% of signatures will be culled.
|
||||
# c.NotebookNotary.cache_size = 65535
|
||||
|
||||
# The sqlite file in which to store notebook signatures. By default, this will
|
||||
# be in your IPython profile. You can set it to ':memory:' to disable sqlite
|
||||
# writing to the filesystem.
|
||||
# c.NotebookNotary.db_file = ''
|
||||
|
||||
# The secret key with which notebooks are signed.
|
||||
# c.NotebookNotary.secret = b''
|
||||
|
||||
# The file where the secret key is stored.
|
||||
# c.NotebookNotary.secret_file = ''
|
||||
|
||||
# The hashing algorithm used to sign notebooks.
|
||||
# c.NotebookNotary.algorithm = 'sha256'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# KernelSpecManager configuration
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Whitelist of allowed kernel names.
|
||||
#
|
||||
# By default, all installed kernels are allowed.
|
||||
# c.KernelSpecManager.whitelist = set()
|
@ -0,0 +1,7 @@
|
||||
/*
|
||||
Placeholder for custom user CSS
|
||||
|
||||
mainly to be overridden in profile/static/custom/custom.css
|
||||
|
||||
This will always be an empty file in IPython
|
||||
*/
|
@ -0,0 +1,82 @@
|
||||
// leave at least 2 line with only a star on it below, or doc generation fails
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Placeholder for custom user javascript
|
||||
* mainly to be overridden in profile/static/custom/custom.js
|
||||
* This will always be an empty file in IPython
|
||||
*
|
||||
* User could add any javascript in the `profile/static/custom/custom.js` file.
|
||||
* It will be executed by the ipython notebook at load time.
|
||||
*
|
||||
* Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
|
||||
*
|
||||
*
|
||||
* The object available at load time depend on the version of IPython in use.
|
||||
* there is no guaranties of API stability.
|
||||
*
|
||||
* The example below explain the principle, and might not be valid.
|
||||
*
|
||||
* Instances are created after the loading of this file and might need to be accessed using events:
|
||||
* define([
|
||||
* 'base/js/namespace',
|
||||
* 'base/js/events'
|
||||
* ], function(IPython, events) {
|
||||
* events.on("app_initialized.NotebookApp", function () {
|
||||
* IPython.keyboard_manager....
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 1:__
|
||||
*
|
||||
* Create a custom button in toolbar that execute `%qtconsole` in kernel
|
||||
* and hence open a qtconsole attached to the same kernel as the current notebook
|
||||
*
|
||||
* define([
|
||||
* 'base/js/namespace',
|
||||
* 'base/js/events'
|
||||
* ], function(IPython, events) {
|
||||
* events.on('app_initialized.NotebookApp', function(){
|
||||
* IPython.toolbar.add_buttons_group([
|
||||
* {
|
||||
* 'label' : 'run qtconsole',
|
||||
* 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
|
||||
* 'callback': function () {
|
||||
* IPython.notebook.kernel.execute('%qtconsole')
|
||||
* }
|
||||
* }
|
||||
* // add more button here if needed.
|
||||
* ]);
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 2:__
|
||||
*
|
||||
* At the completion of the dashboard loading, load an unofficial javascript extension
|
||||
* that is installed in profile/static/custom/
|
||||
*
|
||||
* define([
|
||||
* 'base/js/events'
|
||||
* ], function(events) {
|
||||
* events.on('app_initialized.DashboardApp', function(){
|
||||
* require(['custom/unofficial_extension.js'])
|
||||
* });
|
||||
* });
|
||||
*
|
||||
* __Example 3:__
|
||||
*
|
||||
* Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
|
||||
* to load custom script into the notebook.
|
||||
*
|
||||
* // to load the metadata ui extension example.
|
||||
* $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
|
||||
* // or
|
||||
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
|
||||
* $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
|
||||
*
|
||||
*
|
||||
* @module IPython
|
||||
* @namespace IPython
|
||||
* @class customjs
|
||||
* @static
|
||||
*/
|
32
.venv/Lib/site-packages/jupyter_core/tests/mocking.py
Normal file
32
.venv/Lib/site-packages/jupyter_core/tests/mocking.py
Normal file
@ -0,0 +1,32 @@
|
||||
"""General mocking utilities"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class MultiPatch:
|
||||
def __init__(self, *patchers):
|
||||
self.patchers = patchers
|
||||
|
||||
def __enter__(self):
|
||||
for p in self.patchers:
|
||||
p.start()
|
||||
|
||||
def __exit__(self, *args):
|
||||
for p in self.patchers:
|
||||
p.stop()
|
||||
|
||||
|
||||
darwin = MultiPatch(
|
||||
patch.object(os, "name", "posix"),
|
||||
patch.object(sys, "platform", "darwin"),
|
||||
)
|
||||
|
||||
linux = MultiPatch(
|
||||
patch.object(os, "name", "posix"),
|
||||
patch.object(sys, "platform", "linux2"),
|
||||
)
|
117
.venv/Lib/site-packages/jupyter_core/tests/test_application.py
Normal file
117
.venv/Lib/site-packages/jupyter_core/tests/test_application.py
Normal file
@ -0,0 +1,117 @@
|
||||
import os
|
||||
import shutil
|
||||
from tempfile import mkdtemp
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from traitlets import Integer
|
||||
|
||||
from jupyter_core.application import JupyterApp, NoStart
|
||||
|
||||
pjoin = os.path.join
|
||||
|
||||
|
||||
def test_basic():
|
||||
JupyterApp()
|
||||
|
||||
|
||||
def test_default_traits():
|
||||
app = JupyterApp()
|
||||
for trait_name in app.traits():
|
||||
getattr(app, trait_name)
|
||||
|
||||
|
||||
class DummyApp(JupyterApp):
|
||||
name = "dummy-app"
|
||||
m = Integer(0, config=True)
|
||||
n = Integer(0, config=True)
|
||||
|
||||
|
||||
_dummy_config = """
|
||||
c.DummyApp.n = 10
|
||||
"""
|
||||
|
||||
|
||||
def test_custom_config():
|
||||
app = DummyApp()
|
||||
td = mkdtemp()
|
||||
fname = pjoin(td, "config.py")
|
||||
with open(fname, "w", encoding="utf-8") as f:
|
||||
f.write(_dummy_config)
|
||||
app.initialize(["--config", fname])
|
||||
shutil.rmtree(td)
|
||||
assert app.config_file == fname
|
||||
assert app.n == 10
|
||||
|
||||
|
||||
def test_cli_override():
|
||||
app = DummyApp()
|
||||
td = mkdtemp()
|
||||
fname = pjoin(td, "config.py")
|
||||
with open(fname, "w", encoding="utf-8") as f:
|
||||
f.write(_dummy_config)
|
||||
app.initialize(["--config", fname, "--DummyApp.n=20"])
|
||||
shutil.rmtree(td)
|
||||
assert app.n == 20
|
||||
|
||||
|
||||
def test_generate_config():
|
||||
td = mkdtemp()
|
||||
app = DummyApp(config_dir=td)
|
||||
app.initialize(["--generate-config"])
|
||||
assert app.generate_config
|
||||
|
||||
with pytest.raises(NoStart):
|
||||
app.start()
|
||||
|
||||
assert os.path.exists(os.path.join(td, "dummy_app_config.py"))
|
||||
|
||||
|
||||
def test_load_config():
|
||||
config_dir = mkdtemp()
|
||||
wd = mkdtemp()
|
||||
with open(pjoin(config_dir, "dummy_app_config.py"), "w", encoding="utf-8") as f:
|
||||
f.write("c.DummyApp.m = 1\n")
|
||||
f.write("c.DummyApp.n = 1")
|
||||
with patch.object(os, "getcwd", lambda: wd):
|
||||
app = DummyApp(config_dir=config_dir)
|
||||
app.initialize([])
|
||||
|
||||
assert app.n == 1, "Loaded config from config dir"
|
||||
|
||||
with open(pjoin(wd, "dummy_app_config.py"), "w", encoding="utf-8") as f:
|
||||
f.write("c.DummyApp.n = 2")
|
||||
|
||||
with patch.object(os, "getcwd", lambda: wd):
|
||||
app = DummyApp(config_dir=config_dir)
|
||||
app.initialize([])
|
||||
|
||||
assert app.m == 1, "Loaded config from config dir"
|
||||
assert app.n == 2, "Loaded config from CWD"
|
||||
|
||||
shutil.rmtree(config_dir)
|
||||
shutil.rmtree(wd)
|
||||
|
||||
|
||||
def test_load_bad_config():
|
||||
config_dir = mkdtemp()
|
||||
wd = mkdtemp()
|
||||
with open(pjoin(config_dir, "dummy_app_config.py"), "w", encoding="utf-8") as f:
|
||||
f.write('c.DummyApp.m = "a\n') # Syntax error
|
||||
with patch.object(os, "getcwd", lambda: wd):
|
||||
with pytest.raises(SyntaxError):
|
||||
app = DummyApp(config_dir=config_dir)
|
||||
app.raise_config_file_errors = True
|
||||
app.initialize([])
|
||||
|
||||
shutil.rmtree(config_dir)
|
||||
shutil.rmtree(wd)
|
||||
|
||||
|
||||
def test_runtime_dir_changed():
|
||||
app = DummyApp()
|
||||
td = mkdtemp()
|
||||
shutil.rmtree(td)
|
||||
app.runtime_dir = td
|
||||
assert os.path.isdir(td)
|
||||
shutil.rmtree(td)
|
230
.venv/Lib/site-packages/jupyter_core/tests/test_command.py
Normal file
230
.venv/Lib/site-packages/jupyter_core/tests/test_command.py
Normal file
@ -0,0 +1,230 @@
|
||||
"""Test the Jupyter command-line"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import sysconfig
|
||||
from subprocess import PIPE, CalledProcessError, check_output
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from jupyter_core.command import list_subcommands
|
||||
from jupyter_core.paths import (
|
||||
jupyter_config_dir,
|
||||
jupyter_config_path,
|
||||
jupyter_data_dir,
|
||||
jupyter_path,
|
||||
jupyter_runtime_dir,
|
||||
)
|
||||
|
||||
resetenv = patch.dict(os.environ)
|
||||
|
||||
|
||||
def setup_module():
|
||||
resetenv.start()
|
||||
os.environ.pop("JUPYTER_PREFER_ENV_PATH", None)
|
||||
|
||||
|
||||
def teardown_module():
|
||||
resetenv.stop()
|
||||
|
||||
|
||||
def get_jupyter_output(cmd):
|
||||
"""Get output of a jupyter command"""
|
||||
if not isinstance(cmd, list):
|
||||
cmd = [cmd]
|
||||
return (
|
||||
check_output([sys.executable, "-m", "jupyter_core"] + cmd, stderr=PIPE)
|
||||
.decode("utf8")
|
||||
.strip()
|
||||
)
|
||||
|
||||
|
||||
def write_executable(path, source):
|
||||
if sys.platform == "win32":
|
||||
script = path.dirpath() / path.purebasename + "-script.py"
|
||||
exe = path.dirpath() / path.purebasename + ".exe"
|
||||
else:
|
||||
script = path
|
||||
|
||||
script.write(source)
|
||||
script.chmod(0o700)
|
||||
|
||||
if sys.platform == "win32":
|
||||
try:
|
||||
import pkg_resources
|
||||
|
||||
w = pkg_resources.resource_string("setuptools", "cli-32.exe")
|
||||
except (ImportError, FileNotFoundError, SystemError):
|
||||
pytest.skip("Need pkg_resources/setuptools to make scripts executable on Windows")
|
||||
exe.write(w, "wb")
|
||||
exe.chmod(0o700)
|
||||
|
||||
|
||||
def assert_output(cmd, expected):
|
||||
assert get_jupyter_output(cmd) == expected
|
||||
|
||||
|
||||
def test_config_dir():
|
||||
assert_output("--config-dir", jupyter_config_dir())
|
||||
|
||||
|
||||
def test_data_dir():
|
||||
assert_output("--data-dir", jupyter_data_dir())
|
||||
|
||||
|
||||
def test_runtime_dir():
|
||||
assert_output("--runtime-dir", jupyter_runtime_dir())
|
||||
|
||||
|
||||
def test_paths():
|
||||
output = get_jupyter_output("--paths")
|
||||
for d in (jupyter_config_dir(), jupyter_data_dir(), jupyter_runtime_dir()):
|
||||
assert d in output
|
||||
for key in ("config", "data", "runtime"):
|
||||
assert ("%s:" % key) in output
|
||||
|
||||
for path in (jupyter_config_path(), jupyter_path()):
|
||||
for d in path:
|
||||
assert d in output
|
||||
|
||||
|
||||
def test_paths_json():
|
||||
output = get_jupyter_output(["--paths", "--json"])
|
||||
data = json.loads(output)
|
||||
assert sorted(data) == ["config", "data", "runtime"]
|
||||
for _, path in data.items():
|
||||
assert isinstance(path, list)
|
||||
|
||||
|
||||
def test_paths_debug():
|
||||
vars = [
|
||||
"JUPYTER_PREFER_ENV_PATH",
|
||||
"JUPYTER_NO_CONFIG",
|
||||
"JUPYTER_CONFIG_PATH",
|
||||
"JUPYTER_CONFIG_DIR",
|
||||
"JUPYTER_PATH",
|
||||
"JUPYTER_DATA_DIR",
|
||||
"JUPYTER_RUNTIME_DIR",
|
||||
]
|
||||
output = get_jupyter_output(["--paths", "--debug"])
|
||||
for v in vars:
|
||||
assert f"{v} is not set" in output
|
||||
|
||||
with patch.dict("os.environ", [(v, "y") for v in vars]):
|
||||
output = get_jupyter_output(["--paths", "--debug"])
|
||||
for v in vars:
|
||||
assert f"{v} is set" in output
|
||||
|
||||
|
||||
def test_subcommand_not_given():
|
||||
with pytest.raises(CalledProcessError):
|
||||
get_jupyter_output([])
|
||||
|
||||
|
||||
def test_help():
|
||||
output = get_jupyter_output("-h")
|
||||
assert "--help" in output
|
||||
|
||||
|
||||
def test_subcommand_not_found():
|
||||
with pytest.raises(CalledProcessError) as excinfo:
|
||||
get_jupyter_output("nonexistant-subcommand")
|
||||
stderr = excinfo.value.stderr.decode("utf8")
|
||||
assert "Jupyter command `jupyter-nonexistant-subcommand` not found." in stderr
|
||||
|
||||
|
||||
@patch.object(sys, "argv", [__file__] + sys.argv[1:])
|
||||
def test_subcommand_list(tmpdir):
|
||||
a = tmpdir.mkdir("a")
|
||||
for cmd in ("jupyter-foo-bar", "jupyter-xyz", "jupyter-babel-fish"):
|
||||
a.join(cmd).write("")
|
||||
b = tmpdir.mkdir("b")
|
||||
for cmd in ("jupyter-foo", "jupyterstuff", "jupyter-yo-eyropa-ganymyde-callysto"):
|
||||
b.join(cmd).write("")
|
||||
c = tmpdir.mkdir("c")
|
||||
for cmd in ("jupyter-baz", "jupyter-bop"):
|
||||
c.join(cmd).write("")
|
||||
|
||||
path = os.pathsep.join(map(str, [a, b]))
|
||||
|
||||
def get_path(dummy):
|
||||
return str(c)
|
||||
|
||||
with patch.object(sysconfig, "get_path", get_path):
|
||||
with patch.dict("os.environ", {"PATH": path}):
|
||||
subcommands = list_subcommands()
|
||||
assert subcommands == [
|
||||
"babel-fish",
|
||||
"baz",
|
||||
"bop",
|
||||
"foo",
|
||||
"xyz",
|
||||
"yo-eyropa-ganymyde-callysto",
|
||||
]
|
||||
|
||||
|
||||
def test_not_on_path(tmpdir):
|
||||
a = tmpdir.mkdir("a")
|
||||
jupyter = a.join("jupyter")
|
||||
jupyter.write("from jupyter_core import command; command.main()")
|
||||
jupyter.chmod(0o700)
|
||||
witness = a.join("jupyter-witness")
|
||||
witness_src = "#!{}\n{}\n".format(sys.executable, 'print("WITNESS ME")')
|
||||
write_executable(witness, witness_src)
|
||||
|
||||
env = {"PATH": ""}
|
||||
if "SYSTEMROOT" in os.environ: # Windows http://bugs.python.org/issue20614
|
||||
env["SYSTEMROOT"] = os.environ["SYSTEMROOT"]
|
||||
if sys.platform == "win32":
|
||||
env["PATHEXT"] = ".EXE"
|
||||
# This won't work on windows unless
|
||||
out = check_output([sys.executable, str(jupyter), "witness"], env=env)
|
||||
assert b"WITNESS" in out
|
||||
|
||||
|
||||
def test_path_priority(tmpdir):
|
||||
a = tmpdir.mkdir("a")
|
||||
jupyter = a.join("jupyter")
|
||||
jupyter.write("from jupyter_core import command; command.main()")
|
||||
jupyter.chmod(0o700)
|
||||
witness_a = a.join("jupyter-witness")
|
||||
witness_a_src = "#!{}\n{}\n".format(sys.executable, 'print("WITNESS A")')
|
||||
write_executable(witness_a, witness_a_src)
|
||||
|
||||
b = tmpdir.mkdir("b")
|
||||
witness_b = b.join("jupyter-witness")
|
||||
witness_b_src = "#!{}\n{}\n".format(sys.executable, 'print("WITNESS B")')
|
||||
write_executable(witness_b, witness_b_src)
|
||||
|
||||
env = {"PATH": str(b)}
|
||||
if "SYSTEMROOT" in os.environ: # Windows http://bugs.python.org/issue20614
|
||||
env["SYSTEMROOT"] = os.environ["SYSTEMROOT"]
|
||||
if sys.platform == "win32":
|
||||
env["PATHEXT"] = ".EXE"
|
||||
out = check_output([sys.executable, str(jupyter), "witness"], env=env)
|
||||
assert b"WITNESS A" in out
|
||||
|
||||
|
||||
def test_argv0(tmpdir):
|
||||
a = tmpdir.mkdir("a")
|
||||
jupyter = a.join("jupyter")
|
||||
jupyter.write("from jupyter_core import command; command.main()")
|
||||
jupyter.chmod(0o700)
|
||||
witness_a = a.join("jupyter-witness")
|
||||
witness_a_src = f"""#!{sys.executable}
|
||||
import sys
|
||||
print(sys.argv[0])
|
||||
"""
|
||||
write_executable(witness_a, witness_a_src)
|
||||
|
||||
env = {}
|
||||
if "SYSTEMROOT" in os.environ: # Windows http://bugs.python.org/issue20614
|
||||
env["SYSTEMROOT"] = os.environ["SYSTEMROOT"]
|
||||
if sys.platform == "win32":
|
||||
env["PATHEXT"] = ".EXE"
|
||||
out = check_output([sys.executable, str(jupyter), "witness"], env=env)
|
||||
|
||||
# Make sure the first argv is the full path to the executing script
|
||||
assert f"{jupyter}-witness".encode() in out
|
218
.venv/Lib/site-packages/jupyter_core/tests/test_migrate.py
Normal file
218
.venv/Lib/site-packages/jupyter_core/tests/test_migrate.py
Normal file
@ -0,0 +1,218 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
"""Test config file migration"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from tempfile import mkdtemp
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from jupyter_core import migrate as migrate_mod
|
||||
from jupyter_core.migrate import (
|
||||
migrate,
|
||||
migrate_config,
|
||||
migrate_dir,
|
||||
migrate_file,
|
||||
migrate_one,
|
||||
migrate_static_custom,
|
||||
)
|
||||
from jupyter_core.utils import ensure_dir_exists
|
||||
|
||||
pjoin = os.path.join
|
||||
here = os.path.dirname(__file__)
|
||||
dotipython = pjoin(here, "dotipython")
|
||||
dotipython_empty = pjoin(here, "dotipython_empty")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def td(request):
|
||||
"""Fixture for a temporary directory"""
|
||||
td = mkdtemp("μnïcø∂e")
|
||||
request.addfinalizer(lambda: shutil.rmtree(td))
|
||||
return td
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def env(request):
|
||||
"""Fixture for a full testing environment"""
|
||||
td = mkdtemp()
|
||||
env = {
|
||||
"TESTDIR": td,
|
||||
"IPYTHONDIR": pjoin(td, "ipython"),
|
||||
"JUPYTER_CONFIG_DIR": pjoin(td, "jupyter"),
|
||||
"JUPYTER_DATA_DIR": pjoin(td, "jupyter_data"),
|
||||
"JUPYTER_RUNTIME_DIR": pjoin(td, "jupyter_runtime"),
|
||||
"JUPYTER_PATH": "",
|
||||
}
|
||||
env_patch = patch.dict(os.environ, env)
|
||||
env_patch.start()
|
||||
|
||||
def fin():
|
||||
"""Cleanup test env"""
|
||||
env_patch.stop()
|
||||
shutil.rmtree(td)
|
||||
|
||||
request.addfinalizer(fin)
|
||||
|
||||
return env
|
||||
|
||||
|
||||
def touch(path, content=""):
|
||||
ensure_dir_exists(os.path.dirname(path))
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def assert_files_equal(a, b):
|
||||
"""Verify that two files match"""
|
||||
|
||||
assert os.path.exists(b)
|
||||
with open(a, encoding="utf-8") as f:
|
||||
a_txt = f.read()
|
||||
|
||||
with open(b, encoding="utf-8") as f:
|
||||
b_txt = f.read()
|
||||
|
||||
assert a_txt == b_txt
|
||||
|
||||
|
||||
def test_migrate_file(td):
|
||||
src = pjoin(td, "src")
|
||||
dst = pjoin(td, "dst")
|
||||
touch(src, "test file")
|
||||
assert migrate_file(src, dst)
|
||||
assert_files_equal(src, dst)
|
||||
|
||||
src2 = pjoin(td, "src2")
|
||||
touch(src2, "different src")
|
||||
assert not migrate_file(src2, dst)
|
||||
assert_files_equal(src, dst)
|
||||
|
||||
|
||||
def test_migrate_dir(td):
|
||||
src = pjoin(td, "src")
|
||||
dst = pjoin(td, "dst")
|
||||
os.mkdir(src)
|
||||
assert not migrate_dir(src, dst)
|
||||
assert not os.path.exists(dst)
|
||||
|
||||
touch(pjoin(src, "f"), "test file")
|
||||
assert migrate_dir(src, dst)
|
||||
assert_files_equal(pjoin(src, "f"), pjoin(dst, "f"))
|
||||
|
||||
touch(pjoin(src, "g"), "other test file")
|
||||
assert not migrate_dir(src, dst)
|
||||
assert not os.path.exists(pjoin(dst, "g"))
|
||||
|
||||
shutil.rmtree(dst)
|
||||
os.mkdir(dst)
|
||||
assert migrate_dir(src, dst)
|
||||
assert_files_equal(pjoin(src, "f"), pjoin(dst, "f"))
|
||||
assert_files_equal(pjoin(src, "g"), pjoin(dst, "g"))
|
||||
|
||||
|
||||
def test_migrate_one(td):
|
||||
src = pjoin(td, "src")
|
||||
srcdir = pjoin(td, "srcdir")
|
||||
dst = pjoin(td, "dst")
|
||||
dstdir = pjoin(td, "dstdir")
|
||||
|
||||
touch(src, "test file")
|
||||
touch(pjoin(srcdir, "f"), "test dir file")
|
||||
|
||||
called = {}
|
||||
|
||||
def notice_m_file(src, dst):
|
||||
called["migrate_file"] = True
|
||||
return migrate_file(src, dst)
|
||||
|
||||
def notice_m_dir(src, dst):
|
||||
called["migrate_dir"] = True
|
||||
return migrate_dir(src, dst)
|
||||
|
||||
with patch.object(migrate_mod, "migrate_file", notice_m_file), patch.object(
|
||||
migrate_mod, "migrate_dir", notice_m_dir
|
||||
):
|
||||
assert migrate_one(src, dst)
|
||||
assert called == {"migrate_file": True}
|
||||
called.clear()
|
||||
assert migrate_one(srcdir, dstdir)
|
||||
assert called == {"migrate_dir": True}
|
||||
called.clear()
|
||||
assert not migrate_one(pjoin(td, "dne"), dst)
|
||||
assert called == {}
|
||||
|
||||
|
||||
def test_migrate_config(td):
|
||||
profile = pjoin(td, "profile")
|
||||
jpy = pjoin(td, "jupyter_config")
|
||||
ensure_dir_exists(profile)
|
||||
|
||||
env = {
|
||||
"profile": profile,
|
||||
"jupyter_config": jpy,
|
||||
}
|
||||
cfg_py = pjoin(profile, "ipython_test_config.py")
|
||||
touch(cfg_py, "c.Klass.trait = 5\n")
|
||||
empty_cfg_py = pjoin(profile, "ipython_empty_config.py")
|
||||
touch(empty_cfg_py, "# c.Klass.trait = 5\n")
|
||||
|
||||
assert not migrate_config("empty", env)
|
||||
assert not os.path.exists(jpy)
|
||||
|
||||
with patch.dict(
|
||||
migrate_mod.config_substitutions,
|
||||
{
|
||||
re.compile(r"\bKlass\b"): "Replaced",
|
||||
},
|
||||
):
|
||||
assert migrate_config("test", env)
|
||||
|
||||
assert os.path.isdir(jpy)
|
||||
assert sorted(os.listdir(jpy)) == [
|
||||
"jupyter_test_config.py",
|
||||
]
|
||||
|
||||
with open(pjoin(jpy, "jupyter_test_config.py"), encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
assert text == "c.Replaced.trait = 5\n"
|
||||
|
||||
|
||||
def test_migrate_custom_default(td):
|
||||
profile = pjoin(dotipython, "profile_default")
|
||||
src = pjoin(profile, "static", "custom")
|
||||
assert os.path.exists(src)
|
||||
assert not migrate_static_custom(src, td)
|
||||
|
||||
src = pjoin(td, "src")
|
||||
dst = pjoin(td, "dst")
|
||||
os.mkdir(src)
|
||||
src_custom_js = pjoin(src, "custom.js")
|
||||
src_custom_css = pjoin(src, "custom.css")
|
||||
touch(src_custom_js, "var a=5;")
|
||||
touch(src_custom_css, "div { height: 5px; }")
|
||||
|
||||
assert migrate_static_custom(src, dst)
|
||||
|
||||
|
||||
def test_migrate_nothing(env):
|
||||
migrate()
|
||||
assert os.listdir(env["JUPYTER_CONFIG_DIR"]) == ["migrated"]
|
||||
assert not os.path.exists(env["JUPYTER_DATA_DIR"])
|
||||
|
||||
|
||||
def test_migrate_default(env):
|
||||
shutil.copytree(dotipython_empty, env["IPYTHONDIR"])
|
||||
migrate()
|
||||
assert os.listdir(env["JUPYTER_CONFIG_DIR"]) == ["migrated"]
|
||||
assert not os.path.exists(env["JUPYTER_DATA_DIR"])
|
||||
|
||||
|
||||
def test_migrate(env):
|
||||
shutil.copytree(dotipython, env["IPYTHONDIR"])
|
||||
migrate()
|
||||
assert os.path.exists(env["JUPYTER_CONFIG_DIR"])
|
||||
assert os.path.exists(env["JUPYTER_DATA_DIR"])
|
481
.venv/Lib/site-packages/jupyter_core/tests/test_paths.py
Normal file
481
.venv/Lib/site-packages/jupyter_core/tests/test_paths.py
Normal file
@ -0,0 +1,481 @@
|
||||
"""Tests for paths"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import site
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import warnings
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from jupyter_core import paths
|
||||
from jupyter_core.paths import (
|
||||
is_file_hidden,
|
||||
is_hidden,
|
||||
jupyter_config_dir,
|
||||
jupyter_config_path,
|
||||
jupyter_data_dir,
|
||||
jupyter_path,
|
||||
jupyter_runtime_dir,
|
||||
secure_write,
|
||||
)
|
||||
|
||||
from .mocking import darwin, linux
|
||||
|
||||
pjoin = os.path.join
|
||||
|
||||
|
||||
xdg_env = {
|
||||
"XDG_CONFIG_HOME": "/tmp/xdg/config",
|
||||
"XDG_DATA_HOME": "/tmp/xdg/data",
|
||||
"XDG_RUNTIME_DIR": "/tmp/xdg/runtime",
|
||||
}
|
||||
xdg = patch.dict("os.environ", xdg_env)
|
||||
no_xdg = patch.dict(
|
||||
"os.environ",
|
||||
{
|
||||
"XDG_CONFIG_HOME": "",
|
||||
"XDG_DATA_HOME": "",
|
||||
"XDG_RUNTIME_DIR": "",
|
||||
},
|
||||
)
|
||||
|
||||
no_config_env = patch.dict(
|
||||
"os.environ",
|
||||
{
|
||||
"JUPYTER_CONFIG_DIR": "",
|
||||
"JUPYTER_DATA_DIR": "",
|
||||
"JUPYTER_RUNTIME_DIR": "",
|
||||
"JUPYTER_PATH": "",
|
||||
},
|
||||
)
|
||||
|
||||
jupyter_config_env = "/jupyter-cfg"
|
||||
config_env = patch.dict("os.environ", {"JUPYTER_CONFIG_DIR": jupyter_config_env})
|
||||
prefer_env = patch.dict("os.environ", {"JUPYTER_PREFER_ENV_PATH": "True"})
|
||||
|
||||
resetenv = patch.dict(os.environ)
|
||||
|
||||
|
||||
def setup_module():
|
||||
resetenv.start()
|
||||
os.environ.pop("JUPYTER_PREFER_ENV_PATH", None)
|
||||
|
||||
|
||||
def teardown_module():
|
||||
resetenv.stop()
|
||||
|
||||
|
||||
def realpath(path):
|
||||
return os.path.abspath(os.path.realpath(os.path.expanduser(path)))
|
||||
|
||||
|
||||
home_jupyter = realpath("~/.jupyter")
|
||||
|
||||
|
||||
def test_envset():
|
||||
true_values = ["", "True", "on", "yes", "Y", "1", "anything"]
|
||||
false_values = ["n", "No", "N", "fAlSE", "0", "0.0", "Off"]
|
||||
with patch.dict("os.environ", ((f"FOO_{v}", v) for v in true_values + false_values)):
|
||||
for v in true_values:
|
||||
assert paths.envset(f"FOO_{v}")
|
||||
for v in false_values:
|
||||
assert not paths.envset(f"FOO_{v}")
|
||||
assert not paths.envset("THIS_VARIABLE_SHOULD_NOT_BE_SET")
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_config_dir_darwin():
|
||||
with darwin, no_config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == home_jupyter
|
||||
|
||||
with darwin, config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == jupyter_config_env
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="only run on windows")
|
||||
def test_config_dir_windows():
|
||||
with no_config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == home_jupyter
|
||||
|
||||
with config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == jupyter_config_env
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_config_dir_linux():
|
||||
with linux, no_config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == home_jupyter
|
||||
|
||||
with linux, config_env:
|
||||
config = jupyter_config_dir()
|
||||
assert config == jupyter_config_env
|
||||
|
||||
|
||||
def test_data_dir_env():
|
||||
data_env = "runtime-dir"
|
||||
with patch.dict("os.environ", {"JUPYTER_DATA_DIR": data_env}):
|
||||
data = jupyter_data_dir()
|
||||
assert data == data_env
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_data_dir_darwin():
|
||||
with darwin:
|
||||
data = jupyter_data_dir()
|
||||
assert data == realpath("~/Library/Jupyter")
|
||||
|
||||
with darwin, xdg:
|
||||
# darwin should ignore xdg
|
||||
data = jupyter_data_dir()
|
||||
assert data == realpath("~/Library/Jupyter")
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="only run on windows")
|
||||
def test_data_dir_windows():
|
||||
data = jupyter_data_dir()
|
||||
assert data == realpath(pjoin(os.environ.get("APPDATA", ""), "jupyter"))
|
||||
|
||||
with xdg:
|
||||
# windows should ignore xdg
|
||||
data = jupyter_data_dir()
|
||||
assert data == realpath(pjoin(os.environ.get("APPDATA", ""), "jupyter"))
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_data_dir_linux():
|
||||
with linux, no_xdg:
|
||||
data = jupyter_data_dir()
|
||||
assert data == realpath("~/.local/share/jupyter")
|
||||
|
||||
with linux, xdg:
|
||||
data = jupyter_data_dir()
|
||||
assert data == pjoin(xdg_env["XDG_DATA_HOME"], "jupyter")
|
||||
|
||||
|
||||
def test_runtime_dir_env():
|
||||
rtd_env = "runtime-dir"
|
||||
with patch.dict("os.environ", {"JUPYTER_RUNTIME_DIR": rtd_env}):
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == rtd_env
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_runtime_dir_darwin():
|
||||
with darwin:
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == realpath("~/Library/Jupyter/runtime")
|
||||
|
||||
with darwin, xdg:
|
||||
# darwin should ignore xdg
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == realpath("~/Library/Jupyter/runtime")
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="only run on windows")
|
||||
def test_runtime_dir_windows():
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == realpath(pjoin(os.environ.get("APPDATA", ""), "jupyter", "runtime"))
|
||||
|
||||
with xdg:
|
||||
# windows should ignore xdg
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == realpath(pjoin(os.environ.get("APPDATA", ""), "jupyter", "runtime"))
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_runtime_dir_linux():
|
||||
with linux, no_xdg:
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == realpath("~/.local/share/jupyter/runtime")
|
||||
|
||||
with linux, xdg:
|
||||
runtime = jupyter_runtime_dir()
|
||||
assert runtime == pjoin(xdg_env["XDG_DATA_HOME"], "jupyter", "runtime")
|
||||
|
||||
|
||||
def test_jupyter_path():
|
||||
system_path = ["system", "path"]
|
||||
with no_config_env, patch.object(paths, "SYSTEM_JUPYTER_PATH", system_path):
|
||||
path = jupyter_path()
|
||||
assert path[0] == jupyter_data_dir()
|
||||
assert path[-2:] == system_path
|
||||
|
||||
|
||||
def test_jupyter_path_user_site():
|
||||
with no_config_env, patch.object(site, "ENABLE_USER_SITE", True):
|
||||
path = jupyter_path()
|
||||
|
||||
# deduplicated expected values
|
||||
values = list(
|
||||
dict.fromkeys(
|
||||
[
|
||||
jupyter_data_dir(),
|
||||
os.path.join(site.getuserbase(), "share", "jupyter"),
|
||||
paths.ENV_JUPYTER_PATH[0],
|
||||
]
|
||||
)
|
||||
)
|
||||
for p, v in zip(path, values):
|
||||
assert p == v
|
||||
|
||||
|
||||
def test_jupyter_path_no_user_site():
|
||||
with no_config_env, patch.object(site, "ENABLE_USER_SITE", False):
|
||||
path = jupyter_path()
|
||||
assert path[0] == jupyter_data_dir()
|
||||
assert path[1] == paths.ENV_JUPYTER_PATH[0]
|
||||
|
||||
|
||||
def test_jupyter_path_prefer_env():
|
||||
with prefer_env:
|
||||
path = jupyter_path()
|
||||
assert path[0] == paths.ENV_JUPYTER_PATH[0]
|
||||
assert path[1] == jupyter_data_dir()
|
||||
|
||||
|
||||
def test_jupyter_path_env():
|
||||
path_env = os.pathsep.join(
|
||||
[
|
||||
pjoin("foo", "bar"),
|
||||
pjoin("bar", "baz", ""), # trailing /
|
||||
]
|
||||
)
|
||||
|
||||
with patch.dict("os.environ", {"JUPYTER_PATH": path_env}):
|
||||
path = jupyter_path()
|
||||
assert path[:2] == [pjoin("foo", "bar"), pjoin("bar", "baz")]
|
||||
|
||||
|
||||
def test_jupyter_path_sys_prefix():
|
||||
with patch.object(paths, "ENV_JUPYTER_PATH", ["sys_prefix"]):
|
||||
path = jupyter_path()
|
||||
assert "sys_prefix" in path
|
||||
|
||||
|
||||
def test_jupyter_path_subdir():
|
||||
path = jupyter_path("sub1", "sub2")
|
||||
for p in path:
|
||||
assert p.endswith(pjoin("", "sub1", "sub2"))
|
||||
|
||||
|
||||
def test_jupyter_config_path():
|
||||
with patch.object(site, "ENABLE_USER_SITE", True):
|
||||
path = jupyter_config_path()
|
||||
|
||||
# deduplicated expected values
|
||||
values = list(
|
||||
dict.fromkeys(
|
||||
[
|
||||
jupyter_config_dir(),
|
||||
os.path.join(site.getuserbase(), "etc", "jupyter"),
|
||||
paths.ENV_CONFIG_PATH[0],
|
||||
]
|
||||
)
|
||||
)
|
||||
for p, v in zip(path, values):
|
||||
assert p == v
|
||||
|
||||
|
||||
def test_jupyter_config_path_no_user_site():
|
||||
with patch.object(site, "ENABLE_USER_SITE", False):
|
||||
path = jupyter_config_path()
|
||||
assert path[0] == jupyter_config_dir()
|
||||
assert path[1] == paths.ENV_CONFIG_PATH[0]
|
||||
|
||||
|
||||
def test_jupyter_config_path_prefer_env():
|
||||
with prefer_env, patch.object(site, "ENABLE_USER_SITE", True):
|
||||
path = jupyter_config_path()
|
||||
|
||||
# deduplicated expected values
|
||||
values = list(
|
||||
dict.fromkeys(
|
||||
[
|
||||
paths.ENV_CONFIG_PATH[0],
|
||||
jupyter_config_dir(),
|
||||
os.path.join(site.getuserbase(), "etc", "jupyter"),
|
||||
]
|
||||
)
|
||||
)
|
||||
for p, v in zip(path, values):
|
||||
assert p == v
|
||||
|
||||
|
||||
def test_jupyter_config_path_env():
|
||||
path_env = os.pathsep.join(
|
||||
[
|
||||
pjoin("foo", "bar"),
|
||||
pjoin("bar", "baz", ""), # trailing /
|
||||
]
|
||||
)
|
||||
|
||||
with patch.dict("os.environ", {"JUPYTER_CONFIG_PATH": path_env}):
|
||||
path = jupyter_config_path()
|
||||
assert path[:2] == [pjoin("foo", "bar"), pjoin("bar", "baz")]
|
||||
|
||||
|
||||
def test_is_hidden():
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
subdir1 = os.path.join(root, "subdir")
|
||||
os.makedirs(subdir1)
|
||||
assert not is_hidden(subdir1, root)
|
||||
assert not is_file_hidden(subdir1)
|
||||
|
||||
subdir2 = os.path.join(root, ".subdir2")
|
||||
os.makedirs(subdir2)
|
||||
assert is_hidden(subdir2, root)
|
||||
assert is_file_hidden(subdir2)
|
||||
# root dir is always visible
|
||||
assert not is_hidden(subdir2, subdir2)
|
||||
|
||||
subdir34 = os.path.join(root, "subdir3", ".subdir4")
|
||||
os.makedirs(subdir34)
|
||||
assert is_hidden(subdir34, root)
|
||||
assert is_hidden(subdir34)
|
||||
|
||||
subdir56 = os.path.join(root, ".subdir5", "subdir6")
|
||||
os.makedirs(subdir56)
|
||||
assert is_hidden(subdir56, root)
|
||||
assert is_hidden(subdir56)
|
||||
assert not is_file_hidden(subdir56)
|
||||
assert not is_file_hidden(subdir56, os.stat(subdir56))
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not (
|
||||
sys.platform == "win32"
|
||||
and (("__pypy__" not in sys.modules) or (sys.implementation.version >= (7, 3, 6)))
|
||||
),
|
||||
reason="only run on windows/cpython or pypy >= 7.3.6: https://foss.heptapod.net/pypy/pypy/-/issues/3469",
|
||||
)
|
||||
def test_is_hidden_win32_cpython():
|
||||
import ctypes # noqa
|
||||
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
subdir1 = os.path.join(root, "subdir")
|
||||
os.makedirs(subdir1)
|
||||
assert not is_hidden(subdir1, root)
|
||||
subprocess.check_call(["attrib", "+h", subdir1])
|
||||
assert is_hidden(subdir1, root)
|
||||
assert is_file_hidden(subdir1)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not (
|
||||
sys.platform == "win32"
|
||||
and "__pypy__" in sys.modules
|
||||
and sys.implementation.version < (7, 3, 6)
|
||||
),
|
||||
reason="only run on windows/pypy < 7.3.6: https://foss.heptapod.net/pypy/pypy/-/issues/3469",
|
||||
)
|
||||
def test_is_hidden_win32_pypy():
|
||||
import ctypes # noqa
|
||||
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
subdir1 = os.path.join(root, "subdir")
|
||||
os.makedirs(subdir1)
|
||||
assert not is_hidden(subdir1, root)
|
||||
subprocess.check_call(["attrib", "+h", subdir1])
|
||||
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
# Cause all warnings to always be triggered.
|
||||
warnings.simplefilter("always")
|
||||
# Trigger a warning.
|
||||
assert not is_hidden(subdir1, root)
|
||||
# Verify the warning was triggered
|
||||
assert len(w) == 1
|
||||
assert issubclass(w[-1].category, UserWarning)
|
||||
assert "hidden files are not detectable on this system" in str(w[-1].message)
|
||||
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
# Cause all warnings to always be triggered.
|
||||
warnings.simplefilter("always")
|
||||
# Trigger a warning.
|
||||
assert not is_file_hidden(subdir1)
|
||||
# Verify the warning was triggered
|
||||
assert len(w) == 1
|
||||
assert issubclass(w[-1].category, UserWarning)
|
||||
assert "hidden files are not detectable on this system" in str(w[-1].message)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="only runs on windows")
|
||||
def test_secure_write_win32():
|
||||
def fetch_win32_permissions(filename):
|
||||
"""Extracts file permissions on windows using icacls"""
|
||||
role_permissions = {}
|
||||
proc = os.popen("icacls %s" % filename)
|
||||
lines = proc.read().splitlines()
|
||||
proc.close()
|
||||
for index, line in enumerate(lines):
|
||||
if index == 0:
|
||||
line = line.split(filename)[-1].strip().lower()
|
||||
match = re.match(r"\s*([^:]+):\(([^\)]*)\)", line)
|
||||
if match:
|
||||
usergroup, permissions = match.groups()
|
||||
usergroup = usergroup.lower().split("\\")[-1]
|
||||
permissions = {p.lower() for p in permissions.split(",")}
|
||||
role_permissions[usergroup] = permissions
|
||||
elif not line.strip():
|
||||
break
|
||||
return role_permissions
|
||||
|
||||
def check_user_only_permissions(fname):
|
||||
# Windows has it's own permissions ACL patterns
|
||||
username = os.environ["USERNAME"].lower()
|
||||
permissions = fetch_win32_permissions(fname)
|
||||
print(permissions) # for easier debugging
|
||||
assert username in permissions
|
||||
assert permissions[username] == {"r", "w", "d"}
|
||||
assert "administrators" in permissions
|
||||
assert permissions["administrators"] == {"f"}
|
||||
assert "everyone" not in permissions
|
||||
assert len(permissions) == 2
|
||||
|
||||
directory = tempfile.mkdtemp()
|
||||
fname = os.path.join(directory, "check_perms")
|
||||
try:
|
||||
with secure_write(fname) as f:
|
||||
f.write("test 1")
|
||||
check_user_only_permissions(fname)
|
||||
with open(fname, encoding="utf-8") as f:
|
||||
assert f.read() == "test 1"
|
||||
finally:
|
||||
shutil.rmtree(directory)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
|
||||
def test_secure_write_unix():
|
||||
directory = tempfile.mkdtemp()
|
||||
fname = os.path.join(directory, "check_perms")
|
||||
try:
|
||||
with secure_write(fname) as f:
|
||||
f.write("test 1")
|
||||
mode = os.stat(fname).st_mode
|
||||
assert 0o0600 == (stat.S_IMODE(mode) & 0o7677) # tolerate owner-execute bit
|
||||
with open(fname, encoding="utf-8") as f:
|
||||
assert f.read() == "test 1"
|
||||
|
||||
# Try changing file permissions ahead of time
|
||||
os.chmod(fname, 0o755)
|
||||
with secure_write(fname) as f:
|
||||
f.write("test 2")
|
||||
mode = os.stat(fname).st_mode
|
||||
assert 0o0600 == (stat.S_IMODE(mode) & 0o7677) # tolerate owner-execute bit
|
||||
with open(fname, encoding="utf-8") as f:
|
||||
assert f.read() == "test 2"
|
||||
finally:
|
||||
shutil.rmtree(directory)
|
103
.venv/Lib/site-packages/jupyter_core/troubleshoot.py
Normal file
103
.venv/Lib/site-packages/jupyter_core/troubleshoot.py
Normal file
@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
display environment information that is frequently
|
||||
used to troubleshoot installations of Jupyter or IPython
|
||||
"""
|
||||
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def subs(cmd):
|
||||
"""
|
||||
get data from commands that we need to run outside of python
|
||||
"""
|
||||
try:
|
||||
stdout = subprocess.check_output(cmd)
|
||||
return stdout.decode("utf-8", "replace").strip()
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
return None
|
||||
|
||||
|
||||
def get_data():
|
||||
"""
|
||||
returns a dict of various user environment data
|
||||
"""
|
||||
env: dict = {}
|
||||
env["path"] = os.environ.get("PATH")
|
||||
env["sys_path"] = sys.path
|
||||
env["sys_exe"] = sys.executable
|
||||
env["sys_version"] = sys.version
|
||||
env["platform"] = platform.platform()
|
||||
# FIXME: which on Windows?
|
||||
if sys.platform == "win32":
|
||||
env["where"] = subs(["where", "jupyter"])
|
||||
env["which"] = None
|
||||
else:
|
||||
env["which"] = subs(["which", "-a", "jupyter"])
|
||||
env["where"] = None
|
||||
env["pip"] = subs([sys.executable, "-m", "pip", "list"])
|
||||
env["conda"] = subs(["conda", "list"])
|
||||
env["conda-env"] = subs(["conda", "env", "export"])
|
||||
return env
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
print out useful info
|
||||
"""
|
||||
# pylint: disable=superfluous-parens
|
||||
# args = get_args()
|
||||
environment_data = get_data()
|
||||
|
||||
print("$PATH:")
|
||||
for directory in environment_data["path"].split(os.pathsep):
|
||||
print(f"\t{directory}")
|
||||
|
||||
print("\nsys.path:")
|
||||
for directory in environment_data["sys_path"]:
|
||||
print(f"\t{directory}")
|
||||
|
||||
print("\nsys.executable:")
|
||||
print(f'\t{environment_data["sys_exe"]}')
|
||||
|
||||
print("\nsys.version:")
|
||||
if "\n" in environment_data["sys_version"]:
|
||||
for data in environment_data["sys_version"].split("\n"):
|
||||
print(f"\t{data}")
|
||||
else:
|
||||
print(f'\t{environment_data["sys_version"]}')
|
||||
|
||||
print("\nplatform.platform():")
|
||||
print(f'\t{environment_data["platform"]}')
|
||||
|
||||
if environment_data["which"]:
|
||||
print("\nwhich -a jupyter:")
|
||||
for line in environment_data["which"].split("\n"):
|
||||
print(f"\t{line}")
|
||||
|
||||
if environment_data["where"]:
|
||||
print("\nwhere jupyter:")
|
||||
for line in environment_data["where"].split("\n"):
|
||||
print(f"\t{line}")
|
||||
|
||||
if environment_data["pip"]:
|
||||
print("\npip list:")
|
||||
for package in environment_data["pip"].split("\n"):
|
||||
print(f"\t{package}")
|
||||
|
||||
if environment_data["conda"]:
|
||||
print("\nconda list:")
|
||||
for package in environment_data["conda"].split("\n"):
|
||||
print(f"\t{package}")
|
||||
|
||||
if environment_data["conda-env"]:
|
||||
print("\nconda env:")
|
||||
for package in environment_data["conda-env"].split("\n"):
|
||||
print(f"\t{package}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
17
.venv/Lib/site-packages/jupyter_core/utils/__init__.py
Normal file
17
.venv/Lib/site-packages/jupyter_core/utils/__init__.py
Normal file
@ -0,0 +1,17 @@
|
||||
import errno
|
||||
import os
|
||||
|
||||
|
||||
def ensure_dir_exists(path, mode=0o777):
|
||||
"""ensure that a directory exists
|
||||
If it doesn't exist, try to create it, protecting against a race condition
|
||||
if another process is doing the same.
|
||||
The default permissions are determined by the current umask.
|
||||
"""
|
||||
try:
|
||||
os.makedirs(path, mode=mode)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
if not os.path.isdir(path):
|
||||
raise OSError("%r exists but is not a directory" % path)
|
19
.venv/Lib/site-packages/jupyter_core/version.py
Normal file
19
.venv/Lib/site-packages/jupyter_core/version.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
|
||||
|
||||
version_info = VersionInfo(4, 10, 0, "final", 0)
|
||||
|
||||
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": "", "dev": "dev"}
|
||||
|
||||
if version_info.releaselevel == "final":
|
||||
_suffix_ = ""
|
||||
elif version_info.releaselevel == "dev":
|
||||
_suffix_ = f".dev{version_info.serial}"
|
||||
else:
|
||||
_suffix_ = f"{_specifier_[version_info.releaselevel]}{version_info.serial}"
|
||||
|
||||
__version__ = f"{version_info.major}.{version_info.minor}.{version_info.micro}{_suffix_}"
|
Reference in New Issue
Block a user