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

[pre-commit.ci] pre-commit autoupdate #569

Merged
merged 2 commits into from
Oct 7, 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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ci:
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-json
- id: check-yaml
Expand All @@ -28,14 +28,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
rev: v0.6.9
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.11.2
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand All @@ -51,7 +51,7 @@ repos:
)$

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["-S", "*.ipynb"]
3 changes: 2 additions & 1 deletion docs/render/orphaned_nb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
],
"source": [
"from myst_nb import glue\n",
"\n",
"glue(\"var_text\", \"My orphaned variable!\")\n",
"glue(\"var_float\", 1.0/3.0)"
"glue(\"var_float\", 1.0 / 3.0)"
]
}
],
Expand Down
1 change: 1 addition & 0 deletions myst_nb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A docutils/sphinx parser for Jupyter Notebooks."""

__version__ = "1.1.2"


Expand Down
1 change: 1 addition & 0 deletions myst_nb/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A basic CLI for quickstart of a myst_nb project."""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration for myst-nb."""

import dataclasses as dc
from enum import Enum
from typing import Any, Callable, Dict, Iterable, Literal, Optional, Sequence, Tuple
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/execute/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for executing notebooks."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/execute/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Execute a notebook from the cache."""

from __future__ import annotations

from contextlib import nullcontext, suppress
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/execute/direct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Execute a notebook directly."""

from __future__ import annotations

from contextlib import nullcontext
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/execute/inline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Execute a notebook inline."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/lexers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pygments lexers"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
``logger.warning("message", line=1, subtype="foo")``
"""

import logging
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/nb_to_tokens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for parsing notebooks to Markdown-it tokens."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/read.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for reading notebook formats from a string input."""

from __future__ import annotations

import dataclasses as dc
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Note, this module purposely does not import any Sphinx modules at the top-level,
in order for docutils-only use.
"""

from __future__ import annotations

from binascii import a2b_base64
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Shared utilities."""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions myst_nb/core/variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for rendering code output variables."""

from __future__ import annotations

from ast import literal_eval
Expand Down
1 change: 1 addition & 0 deletions myst_nb/docutils_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The docutils parser implementation for myst-nb."""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
7 changes: 4 additions & 3 deletions myst_nb/ext/eval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Roles/directives for evaluating variables in the notebook."""

from __future__ import annotations

from functools import partial
Expand Down Expand Up @@ -161,9 +162,9 @@ def run(self):
render: dict[str, Any] = {}
for key in ("alt", "height", "width", "scale", "class"):
if key in self.options:
render.setdefault("image", {})[
key.replace("classes", "class")
] = self.options[key]
render.setdefault("image", {})[key.replace("classes", "class")] = (
self.options[key]
)

mime_nodes = render_variable_outputs(
data, self.document, self.line, self.source, render=render
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/execution_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
which is then replaced by a table of statistics in a post-transformation
(once all the documents have been executed and these statistics are available).
"""

from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/glue/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Functionality for storing special data in notebook code cells,
which can then be inserted into the document body.
"""

from __future__ import annotations

from typing import TYPE_CHECKING, Any
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/glue/crossref.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Note, we restrict this to a only a subset of mime-types and data -> nodes transforms,
since adding these nodes in a post-transform will not apply any transforms to them.
"""

from __future__ import annotations

from functools import lru_cache
Expand Down
7 changes: 4 additions & 3 deletions myst_nb/ext/glue/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We intentionally do no import sphinx in this module,
in order to allow docutils-only use without sphinx installed.
"""

from typing import TYPE_CHECKING, Any, Dict, List

from docutils import nodes
Expand Down Expand Up @@ -151,9 +152,9 @@ def run(self):
render: Dict[str, Any] = {}
for key in ("alt", "height", "width", "scale", "class"):
if key in self.options:
render.setdefault("image", {})[
key.replace("classes", "class")
] = self.options[key]
render.setdefault("image", {})[key.replace("classes", "class")] = (
self.options[key]
)
paste_nodes = render_variable_outputs(
[data], self.document, self.line, self.source, render=render
)
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/glue/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This is required for any directive/role names using `:`.
"""

from sphinx.domains import Domain

from .directives import (
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/glue/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We intentionally do no import sphinx in this module,
in order to allow docutils-only use without sphinx installed.
"""

from __future__ import annotations

from docutils import nodes
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/glue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We intentionally do no import sphinx in this module,
in order to allow docutils-only use without sphinx installed.
"""

from __future__ import annotations

from functools import partial
Expand Down
1 change: 1 addition & 0 deletions myst_nb/ext/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
We intentionally do no import sphinx in this module,
in order to allow docutils-only use without sphinx installed.
"""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions myst_nb/sphinx_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The sphinx parser implementation for myst-nb."""

from __future__ import annotations

from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions myst_nb/sphinx_ext.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Setup for the myst-nb sphinx extension."""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions myst_nb/warnings_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Central handling of warnings for the myst-nb extension."""

from __future__ import annotations

from enum import Enum
Expand Down
82 changes: 41 additions & 41 deletions tests/notebooks/basic_failing.ipynb
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# a title\n",
"\n",
"some text\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"source": [
"raise Exception('oopsie!')"
],
"outputs": []
}
],
"metadata": {
"test_name": "notebook1",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# a title\n",
"\n",
"some text\n"
]
},
"nbformat": 4,
"nbformat_minor": 2
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"raise Exception(\"oopsie!\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
},
"test_name": "notebook1"
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading
Loading