Skip to content

Commit

Permalink
Revert PR #378 (Simplify NotebookNotary._data_dir_default) (#397)
Browse files Browse the repository at this point in the history
* Revert PR #378 (Simplify NotebookNotary._data_dir_default)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113 pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
krassowski and pre-commit-ci[bot] authored Mar 13, 2024
1 parent 99d09ae commit c17a251
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
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
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"
}

0 comments on commit c17a251

Please sign in to comment.