|
51 | 51 | import unittest |
52 | 52 | import warnings |
53 | 53 | import weakref |
| 54 | +from collections.abc import Callable, ItemsView, Iterator, Sequence |
54 | 55 | from importlib import reload |
55 | 56 | from importlib.abc import Loader, MetaPathFinder |
56 | 57 | from importlib.machinery import ModuleSpec |
57 | | -from importlib.util import spec_from_file_location, module_from_spec |
58 | | -from types import ModuleType, TracebackType, FunctionType |
| 58 | +from importlib.util import module_from_spec, spec_from_file_location |
| 59 | +from types import FunctionType, ModuleType, TracebackType |
59 | 60 | from typing import ( |
60 | 61 | Any, |
61 | 62 | Optional, |
62 | 63 | cast, |
63 | 64 | ) |
64 | | - |
65 | | -from collections.abc import Callable, Iterator, ItemsView, Sequence |
66 | 65 | from unittest import TestSuite |
67 | 66 |
|
68 | | -from pyfakefs import fake_filesystem, fake_io, fake_os, fake_open, fake_path, fake_file |
69 | | -from pyfakefs import fake_filesystem_shutil |
70 | | -from pyfakefs import fake_pathlib |
71 | | -from pyfakefs import mox3_stubout |
| 67 | +from pyfakefs import ( |
| 68 | + fake_file, |
| 69 | + fake_filesystem, |
| 70 | + fake_filesystem_shutil, |
| 71 | + fake_io, |
| 72 | + fake_open, |
| 73 | + fake_os, |
| 74 | + fake_path, |
| 75 | + fake_pathlib, |
| 76 | + mox3_stubout, |
| 77 | +) |
72 | 78 | from pyfakefs.fake_filesystem import ( |
73 | | - set_uid, |
74 | | - set_gid, |
75 | | - reset_ids, |
76 | | - PatchMode, |
77 | 79 | FakeFilesystem, |
| 80 | + PatchMode, |
| 81 | + reset_ids, |
| 82 | + set_gid, |
| 83 | + set_uid, |
78 | 84 | ) |
79 | 85 | from pyfakefs.fake_os import use_original_os |
80 | 86 | from pyfakefs.helpers import IS_PYPY, IS_WIN |
@@ -554,9 +560,9 @@ class Patcher: |
554 | 560 | SKIPMODULES.add(nt) |
555 | 561 | SKIPMODULES.add(ntpath) |
556 | 562 | else: |
| 563 | + import fcntl |
557 | 564 | import posix |
558 | 565 | import posixpath |
559 | | - import fcntl |
560 | 566 |
|
561 | 567 | SKIPMODULES.add(posix) |
562 | 568 | SKIPMODULES.add(posixpath) |
@@ -725,10 +731,10 @@ def __init__( |
725 | 731 |
|
726 | 732 | if use_known_patches: |
727 | 733 | from pyfakefs.patched_packages import ( |
728 | | - get_modules_to_patch, |
729 | 734 | get_classes_to_patch, |
730 | | - get_fake_module_classes, |
731 | 735 | get_cleanup_handlers, |
| 736 | + get_fake_module_classes, |
| 737 | + get_modules_to_patch, |
732 | 738 | ) |
733 | 739 |
|
734 | 740 | modules_to_patch = modules_to_patch or {} |
@@ -1250,7 +1256,7 @@ def __enter__(self) -> FakeFilesystem: |
1250 | 1256 | self._fs.pause() |
1251 | 1257 | return self._fs |
1252 | 1258 |
|
1253 | | - def __exit__(self, *args: Any) -> None: |
| 1259 | + def __exit__(self, *args: object) -> None: |
1254 | 1260 | self._fs.resume() |
1255 | 1261 |
|
1256 | 1262 |
|
|
0 commit comments