From 73a10a5f3db041788ffdaa599f471352856756e4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 16 Dec 2022 10:09:02 -0600 Subject: [PATCH] Fix lint (#336) * fix lint * lint --- .pre-commit-config.yaml | 2 +- nbformat/sign.py | 2 +- nbformat/v1/nbbase.py | 1 - nbformat/v1/nbjson.py | 1 - nbformat/v2/convert.py | 1 - nbformat/v2/nbbase.py | 1 - nbformat/v2/nbjson.py | 1 - nbformat/v2/rwbase.py | 1 - pyproject.toml | 10 +++++----- tests/test_reader.py | 1 - 10 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff708b29..f546c700 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.165 + rev: v0.0.180 hooks: - id: ruff args: ["--fix"] diff --git a/nbformat/sign.py b/nbformat/sign.py index 6011ef37..6f1a7964 100644 --- a/nbformat/sign.py +++ b/nbformat/sign.py @@ -528,7 +528,7 @@ def check_cells(self, nb): return trusted -trust_flags = { +trust_flags: dict = { "reset": ( {"TrustNotebookApp": {"reset": True}}, """Delete the trusted notebook cache. diff --git a/nbformat/v1/nbbase.py b/nbformat/v1/nbbase.py index 5b1c0c41..441f6fa9 100644 --- a/nbformat/v1/nbbase.py +++ b/nbformat/v1/nbbase.py @@ -18,7 +18,6 @@ from .._struct import Struct - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/nbformat/v1/nbjson.py b/nbformat/v1/nbjson.py index d319e60d..aeb7b349 100644 --- a/nbformat/v1/nbjson.py +++ b/nbformat/v1/nbjson.py @@ -21,7 +21,6 @@ from .nbbase import from_dict from .rwbase import NotebookReader, NotebookWriter - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/nbformat/v2/convert.py b/nbformat/v2/convert.py index dd3ab798..501b90f6 100644 --- a/nbformat/v2/convert.py +++ b/nbformat/v2/convert.py @@ -19,7 +19,6 @@ from .nbbase import new_code_cell, new_notebook, new_text_cell, new_worksheet - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/nbformat/v2/nbbase.py b/nbformat/v2/nbbase.py index 72cf751f..bc9f3ab4 100644 --- a/nbformat/v2/nbbase.py +++ b/nbformat/v2/nbbase.py @@ -23,7 +23,6 @@ from .._struct import Struct - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/nbformat/v2/nbjson.py b/nbformat/v2/nbjson.py index 59397333..9c86275f 100644 --- a/nbformat/v2/nbjson.py +++ b/nbformat/v2/nbjson.py @@ -22,7 +22,6 @@ from .nbbase import from_dict from .rwbase import NotebookReader, NotebookWriter, rejoin_lines, restore_bytes, split_lines - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/nbformat/v2/rwbase.py b/nbformat/v2/rwbase.py index af23ade5..edfc8deb 100644 --- a/nbformat/v2/rwbase.py +++ b/nbformat/v2/rwbase.py @@ -18,7 +18,6 @@ from base64 import decodebytes, encodebytes - # ----------------------------------------------------------------------------- # Code # ----------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index fedd5e69..c40a90ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,8 +54,6 @@ test = [ "pre-commit", "pep440" ] -lint = ["black[jupyter]>=22.6.0", "mdformat>0.7", "ruff>=0.0.156"] -typing = ["mypy>=0.990"] [project.scripts] jupyter-trust = "nbformat.sign:TrustNotebookApp.launch_instance" @@ -82,12 +80,14 @@ test = "python -m pytest -vv --cov nbformat --cov-branch --cov-report term-missi nowarn = "test -W default {args}" [tool.hatch.envs.typing] -features = ["typing", "test"] +features = ["test"] +dependencies = ["mypy>=0.990"] [tool.hatch.envs.typing.scripts] test = "mypy --install-types --non-interactive {args:nbformat tests}" [tool.hatch.envs.lint] -features = ["lint"] +dependencies = ["black[jupyter]==22.10.0", "mdformat>0.7", "ruff==0.0.180"] +detached = true [tool.hatch.envs.lint.scripts] style = [ "ruff {args:.}", @@ -172,7 +172,7 @@ ignore = [ # Line too long "E501", # Relative imports are banned - "I252", + "TID252", # Boolean ... in function definition "FBT001", "FBT002", # Module level import not at top of file diff --git a/tests/test_reader.py b/tests/test_reader.py index fbdf99f6..4f3e2f5f 100644 --- a/tests/test_reader.py +++ b/tests/test_reader.py @@ -17,7 +17,6 @@ from .base import TestsBase - # ----------------------------------------------------------------------------- # Classes and functions # -----------------------------------------------------------------------------