Skip to content

Commit 5c49f8b

Browse files
committed
get pyrefly green
1 parent 9e386ef commit 5c49f8b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

nbqa/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ def _main(cli_args: CLIArgs, configs: Configs) -> int:
751751
if not nb_to_tmp_mapping:
752752
sys.stderr.write("No notebooks found in given path(s)\n")
753753
return 0
754+
saved_sources: Any
754755
saved_sources, (newlinesbefore, newlinesafter) = SAVE_SOURCES[configs["md"]](
755756
nb_to_tmp_mapping,
756757
configs["process_cells"],
@@ -770,7 +771,7 @@ def _main(cli_args: CLIArgs, configs: Configs) -> int:
770771
for key, i in nb_to_tmp_mapping.items()
771772
if key
772773
not in (
773-
*saved_sources.failed_notebooks,
774+
*saved_sources.failed_notebooks, # type: ignore[not-a-type, unused-ignore]
774775
*saved_sources.non_python_notebooks,
775776
)
776777
],

nbqa/path_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import string
66
from pathlib import Path
7-
from typing import Any, Dict, Optional, Tuple
7+
from typing import Any, Dict, Optional, Tuple, cast
88

99

1010
def remove_prefix(string_: str, prefix: str) -> str:
@@ -106,7 +106,10 @@ def read_notebook(notebook: str) -> Tuple[Optional[Dict[str, Any]], Optional[boo
106106
config = None
107107

108108
try:
109-
md_content = jupytext.jupytext.read(notebook, config=config) # type: ignore[missing-attribute,unused-ignore]
109+
# jupytext isn't typed unfortunately
110+
md_content = cast( # type: ignore[missing-attribute,unused-ignore]
111+
Any, jupytext.jupytext.read(notebook, config=config)
112+
)
110113
except: # noqa: E72a # pylint: disable=bare-except
111114
return None, None
112115

0 commit comments

Comments
 (0)