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

Revert PR #378 (Simplify NotebookNotary._data_dir_default) #397

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions nbformat/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from hmac import HMAC
from pathlib import Path

from jupyter_core.paths import jupyter_data_dir

try:
import sqlite3

Expand All @@ -41,7 +39,7 @@ def convert_datetime(val):

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

from . import NO_CONVERT, __version__, read, reads

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

@default("data_dir")
def _data_dir_default(self):
return jupyter_data_dir()
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

store_factory = Callable(
help="""A callable returning the storage backend for notebook signatures.
Expand Down
46 changes: 23 additions & 23 deletions package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, can we take this file with whitespace changes out? it wasn't there in #378.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not make this, it was the precommit bot. I'm afraid I do not have permissions to override the bot

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry about that, @krassowski <3

Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "nbformat-schema",
"version": "5.10.2",
"description": "JSON schemata for Jupyter notebook formats",
"main": "index.js",
"files": [
"nbformat/v3/nbformat.v3.schema.json",
"nbformat/v4/nbformat.v4.schema.json"
],
"repository": {
"type": "git",
"url": "git+https://github.com/jupyter/nbformat.git"
},
"keywords": [
"jupyter",
"notebook",
"json-schema"
],
"author": "Project Jupyter Contributors",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/jupyter/nbformat/issues"
},
"homepage": "https://nbformat.readthedocs.io"
"name": "nbformat-schema",
"version": "5.10.2",
"description": "JSON schemata for Jupyter notebook formats",
"main": "index.js",
"files": [
"nbformat/v3/nbformat.v3.schema.json",
"nbformat/v4/nbformat.v4.schema.json"
],
"repository": {
"type": "git",
"url": "git+https://github.com/jupyter/nbformat.git"
},
"keywords": [
"jupyter",
"notebook",
"json-schema"
],
"author": "Project Jupyter Contributors",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/jupyter/nbformat/issues"
},
"homepage": "https://nbformat.readthedocs.io"
}
Loading