Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#357)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and blink1073 authored Apr 7, 2023
1 parent b27672b commit 4692b54
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/parse_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def parse_ref(current_ref):
raise Exception(f"Invalid ref `{current_ref}`!") # noqa

tag_name = current_ref.replace("refs/tags/", "")
print(tag_name)
print(tag_name) # noqa


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.22.0
hooks:
- id: check-github-workflows

Expand All @@ -30,12 +30,12 @@ repos:
- id: mdformat

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
rev: v0.0.260
hooks:
- id: ruff
args: ["--fix"]
Expand Down
4 changes: 3 additions & 1 deletion nbformat/current.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- use nbformat.vX directly to composing notebooks of a particular version
""",
DeprecationWarning,
stacklevel=2,
)

__all__ = [
Expand Down Expand Up @@ -88,7 +89,8 @@ class NBFormatError(ValueError):
def _warn_format():
warnings.warn(
"""Non-JSON file support in nbformat is deprecated since nbformat 1.0.
Use nbconvert to create files of other formats."""
Use nbconvert to create files of other formats.""",
stacklevel=2,
)


Expand Down
8 changes: 4 additions & 4 deletions nbformat/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,21 +596,21 @@ def sign_notebook_file(self, notebook_path):
def sign_notebook(self, nb, notebook_path="<stdin>"):
"""Sign a notebook that's been loaded"""
if self.notary.check_signature(nb):
print("Notebook already signed: %s" % notebook_path)
print("Notebook already signed: %s" % notebook_path) # noqa
else:
print("Signing notebook: %s" % notebook_path)
print("Signing notebook: %s" % notebook_path) # noqa
self.notary.sign(nb)

def generate_new_key(self):
"""Generate a new notebook signature key"""
print("Generating new notebook key: %s" % self.notary.secret_file)
print("Generating new notebook key: %s" % self.notary.secret_file) # noqa
self.notary._write_secret_file(os.urandom(1024))

def start(self):
"""Start the trust notebook app."""
if self.reset:
if os.path.exists(self.notary.db_file):
print("Removing trusted signature cache: %s" % self.notary.db_file)
print("Removing trusted signature cache: %s" % self.notary.db_file) # noqa
os.remove(self.notary.db_file)
self.generate_new_key()
return
Expand Down
2 changes: 1 addition & 1 deletion nbformat/v2/nbpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def reads(self, s, **kwargs):
"""Convert a string to a notebook."""
return self.to_notebook(s, **kwargs)

def to_notebook(self, s, **kwargs):
def to_notebook(self, s, **kwargs): # noqa
"""Convert a string to a notebook."""
lines = s.splitlines()
cells = []
Expand Down
4 changes: 2 additions & 2 deletions nbformat/v3/nbpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def to_notebook(self, s, **kwargs): # noqa
nb = new_notebook(worksheets=[ws])
return nb

def new_cell(self, state, lines, **kwargs):
def new_cell(self, state, lines, **kwargs): # noqa
"""Create a new cell."""
if state == "codecell":
input_ = "\n".join(lines)
Expand Down Expand Up @@ -167,7 +167,7 @@ def split_lines_into_blocks(self, lines):
class PyWriter(NotebookWriter):
"""A Python notebook writer."""

def writes(self, nb, **kwargs):
def writes(self, nb, **kwargs): # noqa
"""Convert a notebook to a string."""
lines = ["# -*- coding: utf-8 -*-"]
lines.extend(
Expand Down
2 changes: 1 addition & 1 deletion nbformat/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def _get_errors(
return iter(errors)


def _strip_invalida_metadata(
def _strip_invalida_metadata( # noqa
nbdict: Any, version: int, version_minor: int, relax_add_props: bool
) -> int:
"""
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies = ["mypy>=0.990"]
test = "mypy --install-types --non-interactive {args:nbformat tests}"

[tool.hatch.envs.lint]
dependencies = ["black[jupyter]==23.1.0", "mdformat>0.7", "ruff==0.0.254"]
dependencies = ["black[jupyter]==23.3.0", "mdformat>0.7", "ruff==0.0.260"]
detached = true
[tool.hatch.envs.lint.scripts]
style = [
Expand Down Expand Up @@ -192,7 +192,9 @@ unfixable = [
# RUF001 contains ambiguous unicode character '–' (did you mean '-'?)
# S101 Use of `assert` detected
# PLR2004 Magic value used in comparison
"tests/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802", "RUF001", "RUF002", "S101", "PLR2004"]
# PLC1901 `cell.source == ""` can be simplified
"tests/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802", "RUF001", "RUF002", "S101", "PLR2004",
"PLC1901"]
# F401 `nbxml.to_notebook` imported but unused
"nbformat/*__init__.py" = ["F401"]

Expand Down

0 comments on commit 4692b54

Please sign in to comment.