Skip to content

Commit 6bdde5b

Browse files
Sigmar Stefanssonbloomsablink1073IITIIWh1isper
authored
Bgd 4401 merge from upstream 2121 (#8)
* ContentsHandler return 404 rather than raise exc (jupyter-server#1357) * Add more typings (jupyter-server#1356) * Publish 2.10.1 SHA256 hashes: jupyter_server-2.10.1-py3-none-any.whl: 20519e355d951fc5e1b6ac5952854fe7620d0cfb56588fa4efe362a758977ed3 jupyter_server-2.10.1.tar.gz: e6da2657a954a7879eed28cc08e0817b01ffd81d7eab8634660397b55f926472 * Bump to 2.11.0.dev0 * typo: ServerApp (jupyter-server#1361) * Support get file(notebook) md5 (jupyter-server#1363) * Update ruff and typings (jupyter-server#1365) * Update api docs with md5 param (jupyter-server#1364) * Publish 2.11.0 SHA256 hashes: jupyter_server-2.11.0-py3-none-any.whl: c9bd6e6d71dc5a2a25df167dc323422997f14682b008bfecb5d7920a55020ea7 jupyter_server-2.11.0.tar.gz: 78c97ec8049f9062f0151725bc8a1364dfed716646a66819095e0e8a24793eba * Bump to 2.12.0.dev0 * Change md5 to hash and hash_algorithm, fix incompatibility (jupyter-server#1367) Co-authored-by: Frédéric Collonval <[email protected]> * avoid unhandled error on some invalid paths (jupyter-server#1369) * Publish 2.11.1 SHA256 hashes: jupyter_server-2.11.1-py3-none-any.whl: 4b3a16e3ed16fd202588890f10b8ca589bd3e29405d128beb95935f059441373 jupyter_server-2.11.1.tar.gz: fe80bab96493acf5f7d6cd9a1575af8fbd253dc2591aa4d015131a1e03b5799a * Bump to 2.12.0.dev0 * Merge pull request from GHSA-h56g-gq9v-vc8r Co-authored-by: Steven Silvester <[email protected]> * Publish 2.11.2 SHA256 hashes: jupyter_server-2.11.2-py3-none-any.whl: 0c548151b54bcb516ca466ec628f7f021545be137d01b5467877e87f6fff4374 jupyter_server-2.11.2.tar.gz: 0c99f9367b0f24141e527544522430176613f9249849be80504c6d2b955004bb * Bump to 2.12.0.dev0 * chore: update pre-commit hooks (jupyter-server#1370) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <[email protected]> * Update for tornado 6.4 (jupyter-server#1372) * Support async Authorizers (jupyter-server#1373) * Publish 2.12.0 SHA256 hashes: jupyter_server-2.12.0-py3-none-any.whl: 3482912efa4387bb1edc23ba60531796aff3b6d6a6e93a5810f5719e2bdb48b7 jupyter_server-2.12.0.tar.gz: 9fa74ed3bb931cf33f42b3d9046e2788328ec9e6dcc59d48aa3e0910a491e3e4 * Bump to 2.13.0.dev0 * log extension import time at debug level unless it's actually slow (jupyter-server#1375) * Add support for async Authorizers (part 2) (jupyter-server#1374) * Publish 2.12.1 SHA256 hashes: jupyter_server-2.12.1-py3-none-any.whl: fd030dd7be1ca572e4598203f718df6630c12bd28a599d7f1791c4d7938e1010 jupyter_server-2.12.1.tar.gz: dc77b7dcc5fc0547acba2b2844f01798008667201eea27c6319ff9257d700a6d --------- Co-authored-by: Sam Bloomquist <[email protected]> Co-authored-by: Steven Silvester <[email protected]> Co-authored-by: blink1073 <[email protected]> Co-authored-by: IITII <[email protected]> Co-authored-by: Zhongsheng Ji <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: Min RK <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zachary Sailer <[email protected]> Co-authored-by: Zsailer <[email protected]>
1 parent 9579862 commit 6bdde5b

File tree

96 files changed

+1237
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1237
-669
lines changed

.github/workflows/downstream.yml

+18
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ jobs:
107107
test_command: pip install pytest-jupyter[server] && pytest -vv -raXxs -W default --durations 10 --color=yes
108108
package_name: jupyter_server_terminals
109109

110+
jupytext:
111+
runs-on: ubuntu-latest
112+
timeout-minutes: 10
113+
114+
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v4
117+
118+
- name: Base Setup
119+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
120+
121+
- name: Test jupytext
122+
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
123+
with:
124+
package_name: jupytext
125+
test_command: pip install pytest-jupyter[server] gitpython pre-commit && python -m ipykernel install --name jupytext-dev --user && pytest -vv -raXxs -W default --durations 10 --color=yes --ignore=tests/test_doc_files_are_notebooks.py --ignore=tests/test_changelog.py
126+
110127
downstream_check: # This job does nothing and is only used for the branch protection
111128
if: always()
112129
needs:
@@ -115,6 +132,7 @@ jobs:
115132
- jupyterlab_server
116133
- notebook
117134
- nbclassic
135+
- jupytext
118136
runs-on: ubuntu-latest
119137
steps:
120138
- name: Decide whether the needed jobs succeeded or failed

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.1
24+
rev: 0.27.2
2525
hooks:
2626
- id: check-github-workflows
2727

@@ -33,7 +33,7 @@ repos:
3333
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3434

3535
- repo: https://github.com/pre-commit/mirrors-prettier
36-
rev: "v3.0.3"
36+
rev: "v3.1.0"
3737
hooks:
3838
- id: prettier
3939
types_or: [yaml, html, json]
@@ -58,7 +58,7 @@ repos:
5858
- id: rst-inline-touching-normal
5959

6060
- repo: https://github.com/pre-commit/mirrors-mypy
61-
rev: "v1.6.1"
61+
rev: "v1.7.1"
6262
hooks:
6363
- id: mypy
6464
files: jupyter_server
@@ -67,7 +67,7 @@ repos:
6767
["traitlets>=5.13", "jupyter_core>=5.5", "jupyter_client>=8.5"]
6868

6969
- repo: https://github.com/astral-sh/ruff-pre-commit
70-
rev: v0.1.5
70+
rev: v0.1.6
7171
hooks:
7272
- id: ruff
7373
types_or: [python, jupyter]
@@ -76,7 +76,7 @@ repos:
7676
types_or: [python, jupyter]
7777

7878
- repo: https://github.com/scientific-python/cookie
79-
rev: "2023.10.27"
79+
rev: "2023.11.17"
8080
hooks:
8181
- id: sp-repo-review
8282
additional_dependencies: ["repo-review[cli]"]

CHANGELOG.md

+102-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,108 @@ All notable changes to this project will be documented in this file.
44

55
<!-- <START NEW CHANGELOG ENTRY> -->
66

7+
## 2.12.1
8+
9+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.12.0...a59beb9b7bf3decc00af782821561435f47bbb16))
10+
11+
### Enhancements made
12+
13+
- log extension import time at debug level unless it's actually slow [#1375](https://github.com/jupyter-server/jupyter_server/pull/1375) ([@minrk](https://github.com/minrk))
14+
- Add support for async Authorizers (part 2) [#1374](https://github.com/jupyter-server/jupyter_server/pull/1374) ([@Zsailer](https://github.com/Zsailer))
15+
16+
### Contributors to this release
17+
18+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-12-05&to=2023-12-06&type=c))
19+
20+
[@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2023-12-05..2023-12-06&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AZsailer+updated%3A2023-12-05..2023-12-06&type=Issues)
21+
22+
<!-- <END NEW CHANGELOG ENTRY> -->
23+
24+
## 2.12.0
25+
26+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.11.2...3bd347b6f2ead5897a18c6171db1174eaaf6176d))
27+
28+
### Enhancements made
29+
30+
- Support async Authorizers [#1373](https://github.com/jupyter-server/jupyter_server/pull/1373) ([@Zsailer](https://github.com/Zsailer))
31+
32+
### Maintenance and upkeep improvements
33+
34+
- Update for tornado 6.4 [#1372](https://github.com/jupyter-server/jupyter_server/pull/1372) ([@blink1073](https://github.com/blink1073))
35+
- chore: update pre-commit hooks [#1370](https://github.com/jupyter-server/jupyter_server/pull/1370) ([@pre-commit-ci](https://github.com/pre-commit-ci))
36+
37+
### Contributors to this release
38+
39+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-12-04&to=2023-12-05&type=c))
40+
41+
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-12-04..2023-12-05&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Apre-commit-ci+updated%3A2023-12-04..2023-12-05&type=Issues) | [@Zsailer](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AZsailer+updated%3A2023-12-04..2023-12-05&type=Issues)
42+
43+
## 2.11.2
44+
45+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.11.1))
46+
47+
### Contributors to this release
48+
49+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-11-27&to=2023-12-04&type=c))
50+
51+
## 2.11.1
52+
53+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.11.0...40a95e5f39d3f167bebf9232da9fab64818ba97d))
54+
55+
### Bugs fixed
56+
57+
- avoid unhandled error on some invalid paths [#1369](https://github.com/jupyter-server/jupyter_server/pull/1369) ([@minrk](https://github.com/minrk))
58+
- Change md5 to hash and hash_algorithm, fix incompatibility [#1367](https://github.com/jupyter-server/jupyter_server/pull/1367) ([@Wh1isper](https://github.com/Wh1isper))
59+
60+
### Contributors to this release
61+
62+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-11-21&to=2023-11-27&type=c))
63+
64+
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-11-21..2023-11-27&type=Issues) | [@fcollonval](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Afcollonval+updated%3A2023-11-21..2023-11-27&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Aminrk+updated%3A2023-11-21..2023-11-27&type=Issues) | [@Wh1isper](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AWh1isper+updated%3A2023-11-21..2023-11-27&type=Issues)
65+
66+
## 2.11.0
67+
68+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.10.1...e7c0f331d4cbf82eb1a9e9bc6c260faabda0255a))
69+
70+
### Enhancements made
71+
72+
- Support get file(notebook) md5 [#1363](https://github.com/jupyter-server/jupyter_server/pull/1363) ([@Wh1isper](https://github.com/Wh1isper))
73+
74+
### Maintenance and upkeep improvements
75+
76+
- Update ruff and typings [#1365](https://github.com/jupyter-server/jupyter_server/pull/1365) ([@blink1073](https://github.com/blink1073))
77+
78+
### Documentation improvements
79+
80+
- Update api docs with md5 param [#1364](https://github.com/jupyter-server/jupyter_server/pull/1364) ([@Wh1isper](https://github.com/Wh1isper))
81+
- typo: ServerApp [#1361](https://github.com/jupyter-server/jupyter_server/pull/1361) ([@IITII](https://github.com/IITII))
82+
83+
### Contributors to this release
84+
85+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-11-15&to=2023-11-21&type=c))
86+
87+
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-11-15..2023-11-21&type=Issues) | [@IITII](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AIITII+updated%3A2023-11-15..2023-11-21&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Awelcome+updated%3A2023-11-15..2023-11-21&type=Issues) | [@Wh1isper](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3AWh1isper+updated%3A2023-11-15..2023-11-21&type=Issues)
88+
89+
## 2.10.1
90+
91+
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.10.0...9f8ff2886903a6744c5eb483f9e5bd7e63d5d015))
92+
93+
### Bugs fixed
94+
95+
- ContentsHandler return 404 rather than raise exc [#1357](https://github.com/jupyter-server/jupyter_server/pull/1357) ([@bloomsa](https://github.com/bloomsa))
96+
97+
### Maintenance and upkeep improvements
98+
99+
- Clean up ruff config [#1358](https://github.com/jupyter-server/jupyter_server/pull/1358) ([@blink1073](https://github.com/blink1073))
100+
- Add more typings [#1356](https://github.com/jupyter-server/jupyter_server/pull/1356) ([@blink1073](https://github.com/blink1073))
101+
- chore: update pre-commit hooks [#1355](https://github.com/jupyter-server/jupyter_server/pull/1355) ([@pre-commit-ci](https://github.com/pre-commit-ci))
102+
103+
### Contributors to this release
104+
105+
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_server/graphs/contributors?from=2023-11-06&to=2023-11-15&type=c))
106+
107+
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-11-06..2023-11-15&type=Issues) | [@bloomsa](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Abloomsa+updated%3A2023-11-06..2023-11-15&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Apre-commit-ci+updated%3A2023-11-06..2023-11-15&type=Issues)
108+
7109
## 2.10.0
8110

9111
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.9.1...e71e95884483c7ce2d9fd5ee83059a0269741aa1))
@@ -25,8 +127,6 @@ All notable changes to this project will be documented in this file.
25127

26128
[@blink1073](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_server+involves%3Ablink1073+updated%3A2023-10-25..2023-11-06&type=Issues)
27129

28-
<!-- <END NEW CHANGELOG ENTRY> -->
29-
30130
## 2.9.1
31131

32132
([Full Changelog](https://github.com/jupyter-server/jupyter_server/compare/v2.9.0...bb293ec5cac5b277259f27e458da60fa8a926f46))

docs/source/conf.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python3
2-
#
31
# Jupyter Server documentation build configuration file, created by
42
# sphinx-quickstart on Mon Apr 13 09:51:11 2015.
53
#
@@ -44,7 +42,7 @@
4442
]
4543

4644
try:
47-
import enchant # type:ignore[import-not-found] # noqa
45+
import enchant # type:ignore[import-not-found]
4846

4947
extensions += ["sphinxcontrib.spelling"]
5048
except ImportError:
@@ -338,7 +336,7 @@
338336
spelling_word_list_filename = "spelling_wordlist.txt"
339337

340338
# import before any doc is built, so _ is guaranteed to be injected
341-
import jupyter_server.transutils # noqa: F401
339+
import jupyter_server.transutils
342340

343341
CONFIG_HEADER = """\
344342
.. _other-full-config:

docs/source/developers/architecture.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Jupyter Server contains the following components:
2828

2929
- **Config Manager** initializes configuration for the ServerApp. You can define
3030
custom classes for the Jupyter Server managers using this config and change
31-
SererApp settings. Follow :ref:`the Config File Guide <other-full-config>` to
31+
ServerApp settings. Follow :ref:`the Config File Guide <other-full-config>` to
3232
learn about configuration settings and how to build custom config.
3333

3434
- **Custom Extensions** allow you to create the custom Server's REST API endpoints.

docs/source/developers/contents.rst

+52-31
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,48 @@ which we refer to as **models**.
3333

3434
Models may contain the following entries:
3535

36-
+--------------------+-----------+------------------------------+
37-
| Key | Type |Info |
38-
+====================+===========+==============================+
39-
|**name** |unicode |Basename of the entity. |
40-
+--------------------+-----------+------------------------------+
41-
|**path** |unicode |Full |
42-
| | |(:ref:`API-style<apipaths>`) |
43-
| | |path to the entity. |
44-
+--------------------+-----------+------------------------------+
45-
|**type** |unicode |The entity type. One of |
46-
| | |``"notebook"``, ``"file"`` or |
47-
| | |``"directory"``. |
48-
+--------------------+-----------+------------------------------+
49-
|**created** |datetime |Creation date of the entity. |
50-
+--------------------+-----------+------------------------------+
51-
|**last_modified** |datetime |Last modified date of the |
52-
| | |entity. |
53-
+--------------------+-----------+------------------------------+
54-
|**content** |variable |The "content" of the entity. |
55-
| | |(:ref:`See |
56-
| | |Below<modelcontent>`) |
57-
+--------------------+-----------+------------------------------+
58-
|**mimetype** |unicode or |The mimetype of ``content``, |
59-
| |``None`` |if any. (:ref:`See |
60-
| | |Below<modelcontent>`) |
61-
+--------------------+-----------+------------------------------+
62-
|**format** |unicode or |The format of ``content``, |
63-
| |``None`` |if any. (:ref:`See |
64-
| | |Below<modelcontent>`) |
65-
+--------------------+-----------+------------------------------+
36+
+--------------------+------------+-------------------------------+
37+
| Key | Type | Info |
38+
+====================+============+===============================+
39+
| **name** | unicode | Basename of the entity. |
40+
+--------------------+------------+-------------------------------+
41+
| **path** | unicode | Full |
42+
| | | (:ref:`API-style<apipaths>`) |
43+
| | | path to the entity. |
44+
+--------------------+------------+-------------------------------+
45+
| **type** | unicode | The entity type. One of |
46+
| | | ``"notebook"``, ``"file"`` or |
47+
| | | ``"directory"``. |
48+
+--------------------+------------+-------------------------------+
49+
| **created** | datetime | Creation date of the entity. |
50+
+--------------------+------------+-------------------------------+
51+
| **last_modified** | datetime | Last modified date of the |
52+
| | | entity. |
53+
+--------------------+------------+-------------------------------+
54+
| **content** | variable | The "content" of the entity. |
55+
| | | (:ref:`See |
56+
| | | Below<modelcontent>`) |
57+
+--------------------+------------+-------------------------------+
58+
| **mimetype** | unicode or | The mimetype of ``content``, |
59+
| | ``None`` | if any. (:ref:`See |
60+
| | | Below<modelcontent>`) |
61+
+--------------------+------------+-------------------------------+
62+
| **format** | unicode or | The format of ``content``, |
63+
| | ``None`` | if any. (:ref:`See |
64+
| | | Below<modelcontent>`) |
65+
+--------------------+------------+-------------------------------+
66+
| [optional] | | |
67+
| **hash** | unicode or | The hash of the contents. |
68+
| | ``None`` | It cannot be null if |
69+
| | | ``hash_algorithm`` is |
70+
| | | defined. |
71+
+--------------------+------------+-------------------------------+
72+
| [optional] | | |
73+
| **hash_algorithm** | unicode or | The algorithm used to compute |
74+
| | ``None`` | hash value. |
75+
| | | It cannot be null |
76+
| | | if ``hash`` is defined. |
77+
+--------------------+------------+-------------------------------+
6678

6779
.. _modelcontent:
6880

@@ -76,6 +88,9 @@ model. There are three model types: **notebook**, **file**, and **directory**.
7688
:class:`nbformat.notebooknode.NotebookNode` representing the .ipynb file
7789
represented by the model. See the `NBFormat`_ documentation for a full
7890
description.
91+
- The ``hash`` field a hexdigest string of the hash value of the file.
92+
If ``ContentManager.get`` not support hash, it should always be ``None``.
93+
- ``hash_algorithm`` is the algorithm used to compute the hash value.
7994

8095
- ``file`` models
8196
- The ``format`` field is either ``"text"`` or ``"base64"``.
@@ -85,12 +100,16 @@ model. There are three model types: **notebook**, **file**, and **directory**.
85100
file models, ``content`` simply contains the file's bytes after decoding
86101
as UTF-8. Non-text (``base64``) files are read as bytes, base64 encoded,
87102
and then decoded as UTF-8.
103+
- The ``hash`` field a hexdigest string of the hash value of the file.
104+
If ``ContentManager.get`` not support hash, it should always be ``None``.
105+
- ``hash_algorithm`` is the algorithm used to compute the hash value.
88106

89107
- ``directory`` models
90108
- The ``format`` field is always ``"json"``.
91109
- The ``mimetype`` field is always ``None``.
92110
- The ``content`` field contains a list of :ref:`content-free<contentfree>`
93111
models representing the entities in the directory.
112+
- The ``hash`` field is always ``None``.
94113

95114
.. note::
96115

@@ -107,7 +126,7 @@ model. There are three model types: **notebook**, **file**, and **directory**.
107126

108127
.. code-block:: python
109128
110-
# Notebook Model with Content
129+
# Notebook Model with Content and Hash
111130
{
112131
"content": {
113132
"metadata": {},
@@ -129,6 +148,8 @@ model. There are three model types: **notebook**, **file**, and **directory**.
129148
"path": "foo/a.ipynb",
130149
"type": "notebook",
131150
"writable": True,
151+
"hash": "f5e43a0b1c2e7836ab3b4d6b1c35c19e2558688de15a6a14e137a59e4715d34b",
152+
"hash_algorithm": "sha256",
132153
}
133154
134155
# Notebook Model without Content

examples/simple/simple_ext1/application.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class SimpleApp1(ExtensionAppJinjaMixin, ExtensionApp):
3636
# Local path to templates directory.
3737
template_paths = [DEFAULT_TEMPLATE_FILES_PATH] # type:ignore[assignment]
3838

39-
configA = Unicode("", config=True, help="Config A example.") # noqa
39+
configA = Unicode("", config=True, help="Config A example.")
4040

41-
configB = Unicode("", config=True, help="Config B example.") # noqa
41+
configB = Unicode("", config=True, help="Config B example.")
4242

43-
configC = Unicode("", config=True, help="Config C example.") # noqa
43+
configC = Unicode("", config=True, help="Config C example.")
4444

4545
def initialize_handlers(self):
4646
"""Initialize handlers."""

examples/simple/simple_ext1/handlers.py

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def get(self, matched_part=None, *args, **kwargs):
4747
class BaseTemplateHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
4848
"""The base template handler."""
4949

50-
pass
51-
5250

5351
class TypescriptHandler(BaseTemplateHandler):
5452
"""A typescript handler."""

examples/simple/simple_ext2/application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SimpleApp2(ExtensionAppJinjaMixin, ExtensionApp):
2929
# Local path to templates directory.
3030
template_paths = [DEFAULT_TEMPLATE_FILES_PATH] # type:ignore[assignment]
3131

32-
configD = Unicode("", config=True, help="Config D example.") # noqa
32+
configD = Unicode("", config=True, help="Config D example.")
3333

3434
def initialize_handlers(self):
3535
"""Initialize handlers."""

examples/simple/simple_ext2/handlers.py

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def get(self, matched_part=None, *args, **kwargs):
2020
class BaseTemplateHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandler):
2121
"""A base template handler."""
2222

23-
pass
24-
2523

2624
class IndexHandler(BaseTemplateHandler):
2725
"""The root API handler."""

0 commit comments

Comments
 (0)