Skip to content

Commit e06c629

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 786d10a commit e06c629

7 files changed

+18
-30
lines changed

pyfakefs/fake_filesystem.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,7 @@ def os(self) -> OSType:
321321
return (
322322
OSType.WINDOWS
323323
if self.is_windows_fs
324-
else OSType.MACOS
325-
if self.is_macos
326-
else OSType.LINUX
324+
else OSType.MACOS if self.is_macos else OSType.LINUX
327325
)
328326

329327
@os.setter
@@ -930,9 +928,9 @@ def normpath(self, path: AnyStr) -> AnyStr:
930928
path_components: List[AnyStr] = path_str.split(
931929
sep
932930
) # pytype: disable=invalid-annotation
933-
collapsed_path_components: List[
934-
AnyStr
935-
] = [] # pytype: disable=invalid-annotation
931+
collapsed_path_components: List[AnyStr] = (
932+
[]
933+
) # pytype: disable=invalid-annotation
936934
dot = matching_string(path_str, ".")
937935
dotdot = matching_string(path_str, "..")
938936
for component in path_components:
@@ -1220,12 +1218,10 @@ def joinpaths(self, *paths: AnyStr) -> AnyStr:
12201218
return matching_string(file_paths[0], "").join(joined_path_segments)
12211219

12221220
@overload
1223-
def _path_components(self, path: str) -> List[str]:
1224-
...
1221+
def _path_components(self, path: str) -> List[str]: ...
12251222

12261223
@overload
1227-
def _path_components(self, path: bytes) -> List[bytes]:
1228-
...
1224+
def _path_components(self, path: bytes) -> List[bytes]: ...
12291225

12301226
def _path_components(self, path: AnyStr) -> List[AnyStr]:
12311227
"""Breaks the path into a list of component names.
@@ -1888,9 +1884,7 @@ def _handle_broken_link_with_trailing_sep(self, path: AnyStr) -> None:
18881884
error = (
18891885
errno.ENOENT
18901886
if self.is_macos
1891-
else errno.EINVAL
1892-
if self.is_windows_fs
1893-
else errno.ENOTDIR
1887+
else errno.EINVAL if self.is_windows_fs else errno.ENOTDIR
18941888
)
18951889
self.raise_os_error(error, path)
18961890

pyfakefs/fake_open.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ def _init_file_object(
292292
error = (
293293
errno.EINVAL
294294
if self.filesystem.is_windows_fs
295-
else errno.ENOENT
296-
if self.filesystem.is_macos
297-
else errno.EISDIR
295+
else errno.ENOENT if self.filesystem.is_macos else errno.EISDIR
298296
)
299297
self.filesystem.raise_os_error(error, file_path)
300298
file_object = self.filesystem.create_file_internally(

pyfakefs/fake_path.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,12 @@ def samefile(self, path1: AnyStr, path2: AnyStr) -> bool:
368368
@overload
369369
def _join_real_path(
370370
self, path: str, rest: str, seen: Dict[str, Optional[str]]
371-
) -> Tuple[str, bool]:
372-
...
371+
) -> Tuple[str, bool]: ...
373372

374373
@overload
375374
def _join_real_path(
376375
self, path: bytes, rest: bytes, seen: Dict[bytes, Optional[bytes]]
377-
) -> Tuple[bytes, bool]:
378-
...
376+
) -> Tuple[bytes, bool]: ...
379377

380378
def _join_real_path(
381379
self, path: AnyStr, rest: AnyStr, seen: Dict[AnyStr, Optional[AnyStr]]

pyfakefs/helpers.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,11 @@ def is_unicode_string(val: Any) -> bool:
110110

111111

112112
@overload
113-
def make_string_path(dir_name: AnyStr) -> AnyStr:
114-
...
113+
def make_string_path(dir_name: AnyStr) -> AnyStr: ...
115114

116115

117116
@overload
118-
def make_string_path(dir_name: os.PathLike) -> str:
119-
...
117+
def make_string_path(dir_name: os.PathLike) -> str: ...
120118

121119

122120
def make_string_path(dir_name: AnyPath) -> AnyStr: # type: ignore[type-var]
@@ -158,18 +156,15 @@ def now():
158156

159157

160158
@overload
161-
def matching_string(matched: bytes, string: AnyStr) -> bytes:
162-
...
159+
def matching_string(matched: bytes, string: AnyStr) -> bytes: ...
163160

164161

165162
@overload
166-
def matching_string(matched: str, string: AnyStr) -> str:
167-
...
163+
def matching_string(matched: str, string: AnyStr) -> str: ...
168164

169165

170166
@overload
171-
def matching_string(matched: AnyStr, string: None) -> None:
172-
...
167+
def matching_string(matched: AnyStr, string: None) -> None: ...
173168

174169

175170
def matching_string( # type: ignore[misc]

pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Uses the output from running pytest with pytest_plugin_failing_helper.py.
33
Regression test for #381.
44
"""
5+
56
import os
67

78
import pytest

pyfakefs/pytest_tests/pytest_doctest_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
Add `-s` option to enable print statements.
1010
"""
11+
1112
from __future__ import unicode_literals
1213

1314

pyfakefs/pytest_tests/pytest_plugin_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests that the pytest plugin properly provides the "fs" fixture"""
2+
23
import os
34
import tempfile
45

0 commit comments

Comments
 (0)