Skip to content

Commit 04771e7

Browse files
pre-commit-ci[bot]mrbean-bremen
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a3b9579 commit 04771e7

12 files changed

+26
-29
lines changed

pyfakefs/fake_filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ def resolve(
18311831
open_file = self.get_open_file(file_path).get_object()
18321832
assert isinstance(open_file, FakeFile)
18331833
return open_file
1834-
raise TypeError("path should be string, bytes or " "os.PathLike, not int")
1834+
raise TypeError("path should be string, bytes or os.PathLike, not int")
18351835

18361836
if follow_symlinks:
18371837
return self.get_object_from_normpath(

pyfakefs/fake_filesystem_unittest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ class Patcher:
530530
FS_DEFARGS: List[Tuple[FunctionType, int, Callable[..., Any]]] = []
531531
SKIPPED_FS_MODULES: Dict[str, Set[Tuple[ModuleType, str]]] = {}
532532

533-
assert None in SKIPMODULES, "sys.modules contains 'None' values;" " must skip them."
533+
assert None in SKIPMODULES, "sys.modules contains 'None' values; must skip them."
534534

535535
IS_WINDOWS = sys.platform in ("win32", "cygwin")
536536

pyfakefs/fake_os.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,7 @@ def _path_with_dir_fd(
971971
raise NotImplementedError("dir_fd unavailable on this platform")
972972
if isinstance(path, int):
973973
raise ValueError(
974-
"%s: Can't specify dir_fd without "
975-
"matching path_str" % fct.__name__
974+
"%s: Can't specify dir_fd without matching path_str" % fct.__name__
976975
)
977976
if not self.path.isabs(path):
978977
open_file = self.filesystem.get_open_file(dir_fd)
@@ -1068,7 +1067,7 @@ def fchmod(
10681067
"""
10691068
if self.filesystem.is_windows_fs and sys.version_info < (3, 13):
10701069
raise AttributeError(
1071-
"module 'os' has no attribute 'fchmod'. " "Did you mean: 'chmod'?"
1070+
"module 'os' has no attribute 'fchmod'. Did you mean: 'chmod'?"
10721071
)
10731072
self.filesystem.chmod(fd, mode)
10741073

@@ -1094,7 +1093,7 @@ def chmod(
10941093
self.chmod not in self.supports_follow_symlinks or IS_PYPY
10951094
):
10961095
raise NotImplementedError(
1097-
"`follow_symlinks` for chmod() is not available " "on this system"
1096+
"`follow_symlinks` for chmod() is not available on this system"
10981097
)
10991098
path = self._path_with_dir_fd(path, self.chmod, dir_fd)
11001099
self.filesystem.chmod(path, mode, follow_symlinks)

pyfakefs/fake_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def realpath(self, filename: AnyStr, strict: Optional[bool] = None) -> AnyStr:
360360
symbolic links encountered in the path.
361361
"""
362362
if strict is not None and sys.version_info < (3, 10):
363-
raise TypeError("realpath() got an unexpected " "keyword argument 'strict'")
363+
raise TypeError("realpath() got an unexpected keyword argument 'strict'")
364364
if strict:
365365
# raises in strict mode if the file does not exist
366366
self.filesystem.resolve(filename)

pyfakefs/fake_pathlib.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ def chmod(self, pathobj, *args, **kwargs):
179179
if "follow_symlinks" in kwargs:
180180
if sys.version_info < (3, 10):
181181
raise TypeError(
182-
"chmod() got an unexpected keyword " "argument 'follow_symlinks'"
182+
"chmod() got an unexpected keyword argument 'follow_symlinks'"
183183
)
184184

185185
if not kwargs["follow_symlinks"] and (
186186
os.chmod not in os.supports_follow_symlinks or IS_PYPY
187187
):
188188
raise NotImplementedError(
189-
"`follow_symlinks` for chmod() is not available " "on this system"
189+
"`follow_symlinks` for chmod() is not available on this system"
190190
)
191191
return pathobj.filesystem.chmod(str(pathobj), *args, **kwargs)
192192

@@ -432,7 +432,7 @@ def gethomedir(self, username):
432432
return pwd.getpwnam(username).pw_dir
433433
except KeyError:
434434
raise RuntimeError(
435-
"Can't determine home directory " "for %r" % username
435+
"Can't determine home directory for %r" % username
436436
)
437437

438438
class _FakeWindowsFlavour(_FakeFlavour):
@@ -502,7 +502,7 @@ def gethomedir(self, username):
502502
drv, root, parts = self.parse_parts((userhome,))
503503
if parts[-1] != os.environ["USERNAME"]:
504504
raise RuntimeError(
505-
"Can't determine home directory " "for %r" % username
505+
"Can't determine home directory for %r" % username
506506
)
507507
parts[-1] = username
508508
if drv or root:
@@ -549,7 +549,7 @@ def gethomedir(self, username):
549549
return pwd.getpwnam(username).pw_dir
550550
except KeyError:
551551
raise RuntimeError(
552-
"Can't determine home directory " "for %r" % username
552+
"Can't determine home directory for %r" % username
553553
)
554554

555555
def compile_pattern(self, pattern):
@@ -765,9 +765,7 @@ def write_text(self, data, encoding=None, errors=None, newline=None):
765765
if not isinstance(data, str):
766766
raise TypeError("data must be str, not %s" % data.__class__.__name__)
767767
if newline is not None and sys.version_info < (3, 10):
768-
raise TypeError(
769-
"write_text() got an unexpected " "keyword argument 'newline'"
770-
)
768+
raise TypeError("write_text() got an unexpected keyword argument 'newline'")
771769
with fake_open(
772770
self.filesystem,
773771
self.skip_names,

pyfakefs/fake_scandir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(self, filesystem, path):
127127
if isinstance(path, int):
128128
if self.filesystem.is_windows_fs:
129129
raise NotImplementedError(
130-
"scandir does not support file descriptor " "path argument"
130+
"scandir does not support file descriptor path argument"
131131
)
132132
self.abspath = self.filesystem.absnormpath(
133133
self.filesystem.get_open_file(path).get_object().path

pyfakefs/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def st_blocks(self) -> int:
367367
def st_file_attributes(self) -> int:
368368
if not self.is_windows:
369369
raise AttributeError(
370-
"module 'os.stat_result' " "has no attribute 'st_file_attributes'"
370+
"module 'os.stat_result' has no attribute 'st_file_attributes'"
371371
)
372372
mode = 0
373373
st_mode = self.st_mode
@@ -385,7 +385,7 @@ def st_file_attributes(self) -> int:
385385
def st_reparse_tag(self) -> int:
386386
if not self.is_windows or sys.version_info < (3, 8):
387387
raise AttributeError(
388-
"module 'os.stat_result' " "has no attribute 'st_reparse_tag'"
388+
"module 'os.stat_result' has no attribute 'st_reparse_tag'"
389389
)
390390
if self.st_mode & stat.S_IFLNK:
391391
return stat.IO_REPARSE_TAG_SYMLINK # type: ignore[attr-defined]

pyfakefs/tests/example_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_create_file(self):
8989

9090
def test_delete_file(self):
9191
"""Test example.delete_file() which uses `os.remove()`."""
92-
self.fs.create_file("/test/full.txt", contents="First line\n" "Second Line\n")
92+
self.fs.create_file("/test/full.txt", contents="First line\nSecond Line\n")
9393
self.assertTrue(os.path.exists("/test/full.txt"))
9494
example.delete_file("/test/full.txt")
9595
self.assertFalse(os.path.exists("/test/full.txt"))

pyfakefs/tests/fake_filesystem_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ def test_getattr_forward_to_real_os_path(self):
12601260
if private_path_function:
12611261
self.assertTrue(
12621262
hasattr(self.path, private_path_function),
1263-
"Get a real os.path function " "not implemented in fake os.path",
1263+
"Get a real os.path function not implemented in fake os.path",
12641264
)
12651265
self.assertFalse(hasattr(self.path, "nonexistent"))
12661266

@@ -1771,7 +1771,7 @@ def test_creating_file_with_fitting_content(self):
17711771
self.fs.create_file("!foo!bar", contents=b"a" * 100)
17721772
except OSError:
17731773
self.fail(
1774-
"File with contents fitting into disk space " "could not be written."
1774+
"File with contents fitting into disk space could not be written."
17751775
)
17761776

17771777
self.assertEqual(initial_usage.used + 100, self.fs.get_disk_usage().used)
@@ -1863,7 +1863,7 @@ def test_that_the_size_of_correct_mount_point_is_used(self):
18631863
self.fs.create_file("!mount_unlimited!foo", st_size=1000000)
18641864
except OSError:
18651865
self.fail(
1866-
"File with contents fitting into " "disk space could not be written."
1866+
"File with contents fitting into disk space could not be written."
18671867
)
18681868

18691869
def test_that_disk_usage_of_correct_mount_point_is_used(self):

pyfakefs/tests/fake_filesystem_unittest_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,20 @@ def test_open(self):
112112
with open("/fake_file.txt", encoding="utf8") as f:
113113
content = f.read()
114114
self.assertEqual(
115-
"This test file was created using the " "open() function.\n",
115+
"This test file was created using the open() function.\n",
116116
content,
117117
)
118118

119119
def test_io_open(self):
120120
"""Fake io module is bound"""
121121
self.assertFalse(os.path.exists("/fake_file.txt"))
122122
with io_open("/fake_file.txt", "w", encoding="utf8") as f:
123-
f.write("This test file was created using the" " io.open() function.\n")
123+
f.write("This test file was created using the io.open() function.\n")
124124
self.assertTrue(self.fs.exists("/fake_file.txt"))
125125
with open("/fake_file.txt", encoding="utf8") as f:
126126
content = f.read()
127127
self.assertEqual(
128-
"This test file was created using the " "io.open() function.\n",
128+
"This test file was created using the io.open() function.\n",
129129
content,
130130
)
131131

0 commit comments

Comments
 (0)