diff --git a/jupyter_server/services/contents/fileio.py b/jupyter_server/services/contents/fileio.py index 606e85fc2c..3033ebe3fa 100644 --- a/jupyter_server/services/contents/fileio.py +++ b/jupyter_server/services/contents/fileio.py @@ -204,7 +204,7 @@ def atomic_writing(self, os_path, *args, **kwargs): Depending on flag 'use_atomic_writing', the wrapper perform an actual atomic writing or simply writes the file (whatever an old exists or not)""" with self.perm_to_403(os_path): - kwargs["log"] = self.log # type:ignore[attr-defined] + kwargs["log"] = self.log if self.use_atomic_writing: with atomic_writing(os_path, *args, **kwargs) as f: yield f @@ -234,7 +234,7 @@ def _copy(self, src, dest): like shutil.copy2, but log errors in copystat """ - copy2_safe(src, dest, log=self.log) # type:ignore[attr-defined] + copy2_safe(src, dest, log=self.log) def _get_os_path(self, path): """Given an API path, return its file system path. @@ -361,7 +361,7 @@ async def _copy(self, src, dest): like shutil.copy2, but log errors in copystat """ - await async_copy2_safe(src, dest, log=self.log) # type:ignore[attr-defined] + await async_copy2_safe(src, dest, log=self.log) async def _read_notebook(self, os_path, as_version=4, capture_validation_error=None): """Read a notebook from an os path.""" diff --git a/tests/services/contents/test_fileio.py b/tests/services/contents/test_fileio.py index 5367bb1a09..0f0cf1bfed 100644 --- a/tests/services/contents/test_fileio.py +++ b/tests/services/contents/test_fileio.py @@ -139,7 +139,7 @@ def test_path_to_invalid(tmpdir): @pytest.mark.skipif(os.name == "nt", reason="test fails on Windows") def test_file_manager_mixin(tmpdir): mixin = FileManagerMixin() - mixin.log = logging.getLogger() # type:ignore[attr-defined] + mixin.log = logging.getLogger() bad_content = tmpdir / "bad_content.ipynb" bad_content.write_text("{}", "utf8") with pytest.raises(HTTPError): @@ -161,7 +161,7 @@ def test_file_manager_mixin(tmpdir): @pytest.mark.skipif(os.name == "nt", reason="test fails on Windows") async def test_async_file_manager_mixin(tmpdir): mixin = AsyncFileManagerMixin() - mixin.log = logging.getLogger() # type:ignore[attr-defined] + mixin.log = logging.getLogger() bad_content = tmpdir / "bad_content.ipynb" bad_content.write_text("{}", "utf8") with pytest.raises(HTTPError):