Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify NotebookNotary._data_dir_default #378

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions nbformat/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def convert_datetime(val):
from base64 import encodebytes

from jupyter_core.application import JupyterApp, base_flags
from jupyter_core.paths import jupyter_data_dir
from traitlets import Any, Bool, Bytes, Callable, Enum, Instance, Integer, Unicode, default, observe
from traitlets.config import LoggingConfigurable, MultipleInstanceError
from traitlets.config import LoggingConfigurable

from . import NO_CONVERT, __version__, read, reads

Expand Down Expand Up @@ -341,17 +342,7 @@ class NotebookNotary(LoggingConfigurable):

@default("data_dir")
def _data_dir_default(self):
app = None
try:
if JupyterApp.initialized():
app = JupyterApp.instance()
except MultipleInstanceError:
pass
if app is None:
# create an app, without the global instance
app = JupyterApp()
app.initialize(argv=[])
return app.data_dir
return jupyter_data_dir()

store_factory = Callable(
help="""A callable returning the storage backend for notebook signatures.
Expand Down
Loading