Skip to content

Commit 75cf00a

Browse files
committed
Fix import order with new isort options
1 parent 486cf3a commit 75cf00a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+305
-386
lines changed

docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
# serve to show the default.
1414

1515
import sys
16-
import os
17-
1816

17+
import os
1918
import sphinx_rtd_theme
2019

2120
html_theme = "sphinx_rtd_theme"
@@ -72,6 +71,7 @@
7271
# built documents.
7372
#
7473
from fs import __version__
74+
7575
# The short X.Y version.
7676
version = '.'.join(__version__.split('.')[:2])
7777
# The full version, including alpha/beta/rc tags.

examples/count_py.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from fs import open_fs
1212
from fs.filesize import traditional
1313

14-
1514
fs_url = sys.argv[1]
1615
count = 0
1716

examples/find_dups.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
88
"""
99

10-
from collections import defaultdict
1110
import sys
1211

13-
from fs import open_fs
12+
from collections import defaultdict
1413

14+
from fs import open_fs
1515

1616
hashes = defaultdict(list)
1717
with open_fs(sys.argv[1]) as fs:

examples/rm_pyc.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from fs import open_fs
1313

14-
1514
with open_fs(sys.argv[1]) as fs:
1615
count = fs.glob("**/*.pyc").remove()
1716
print(f"{count} .pyc files remove")

examples/upload.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
1313
"""
1414

15-
import os
1615
import sys
1716

17+
import os
18+
1819
from fs import open_fs
1920

2021
_, file_path, fs_url = sys.argv

fs/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
__import__("pkg_resources").declare_namespace(__name__) # type: ignore
55

6+
from . import path
7+
from ._fscompat import fsdecode, fsencode
68
from ._version import __version__
79
from .enums import ResourceType, Seek
810
from .opener import open_fs
9-
from ._fscompat import fsencode, fsdecode
10-
from . import path
1111

1212
__all__ = ["__version__", "ResourceType", "Seek", "open_fs"]

fs/_bulk.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66

77
from __future__ import unicode_literals
88

9-
import threading
109
import typing
1110

11+
import threading
1212
from six.moves.queue import Queue
1313

1414
from .copy import copy_file_internal, copy_modified_time
1515
from .errors import BulkCopyFailed
1616
from .tools import copy_file_data
1717

1818
if typing.TYPE_CHECKING:
19-
from .base import FS
19+
from typing import IO, List, Optional, Text, Tuple, Type
20+
2021
from types import TracebackType
21-
from typing import List, Optional, Text, Type, IO, Tuple
22+
23+
from .base import FS
2224

2325

2426
class _Worker(threading.Thread):

fs/_fscompat.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import six
22

33
try:
4-
from os import fsencode, fsdecode
4+
from os import fsdecode, fsencode
55
except ImportError:
6-
from backports.os import fsencode, fsdecode # type: ignore
6+
from backports.os import fsdecode, fsencode # type: ignore
77

88
try:
99
from os import fspath

fs/_ftp_parse.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
from __future__ import absolute_import
2-
from __future__ import print_function
3-
from __future__ import unicode_literals
1+
from __future__ import absolute_import, print_function, unicode_literals
42

5-
import unicodedata
63
import re
74
import time
5+
import unicodedata
86
from datetime import datetime
97

108
try:
@@ -15,7 +13,6 @@
1513
from .enums import ResourceType
1614
from .permissions import Permissions
1715

18-
1916
EPOCH_DT = datetime.fromtimestamp(0, timezone.utc)
2017

2118

fs/_typing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
44
"""
55
import sys
6-
import six
76

7+
import six
88

99
_PY = sys.version_info
1010

fs/_tzcompat.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
https://docs.python.org/2.7/library/datetime.html#tzinfo-objects
55
"""
66

7-
from datetime import tzinfo, timedelta
8-
7+
from datetime import timedelta, tzinfo
98

109
ZERO = timedelta(0)
1110

fs/_url_tools.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import typing
2+
3+
import platform
14
import re
25
import six
3-
import platform
4-
import typing
56

67
if typing.TYPE_CHECKING:
78
from typing import Text

fs/appfs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
# see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
1111

12-
import abc
1312
import typing
1413

14+
import abc
1515
import six
16+
from appdirs import AppDirs
1617

17-
from .osfs import OSFS
1818
from ._repr import make_repr
19-
from appdirs import AppDirs
19+
from .osfs import OSFS
2020

2121
if typing.TYPE_CHECKING:
2222
from typing import Optional, Text

fs/base.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
from __future__ import absolute_import, print_function, unicode_literals
1010

11+
import typing
12+
1113
import abc
1214
import hashlib
1315
import itertools
1416
import os
17+
import six
1518
import threading
1619
import time
17-
import typing
20+
import warnings
1821
from contextlib import closing
1922
from functools import partial, wraps
20-
import warnings
21-
22-
import six
2323

2424
from . import copy, errors, fsencode, iotools, tools, walk, wildcard
2525
from .copy import copy_modified_time
@@ -30,15 +30,13 @@
3030
from .walk import Walker
3131

3232
if typing.TYPE_CHECKING:
33-
from datetime import datetime
34-
from threading import RLock
3533
from typing import (
34+
IO,
3635
Any,
3736
BinaryIO,
3837
Callable,
3938
Collection,
4039
Dict,
41-
IO,
4240
Iterable,
4341
Iterator,
4442
List,
@@ -49,11 +47,15 @@
4947
Type,
5048
Union,
5149
)
50+
51+
from datetime import datetime
52+
from threading import RLock
5253
from types import TracebackType
54+
5355
from .enums import ResourceType
5456
from .info import Info, RawInfo
55-
from .subfs import SubFS
5657
from .permissions import Permissions
58+
from .subfs import SubFS
5759
from .walk import BoundWalker
5860

5961
_F = typing.TypeVar("_F", bound="FS")

fs/compress.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@
44
`tarfile` modules from the standard library.
55
"""
66

7-
from __future__ import absolute_import
8-
from __future__ import print_function
9-
from __future__ import unicode_literals
7+
from __future__ import absolute_import, print_function, unicode_literals
108

11-
import time
12-
import tarfile
139
import typing
14-
import zipfile
15-
from datetime import datetime
1610

1711
import six
12+
import tarfile
13+
import time
14+
import zipfile
15+
from datetime import datetime
1816

1917
from .enums import ResourceType
18+
from .errors import MissingInfoNamespace, NoSysPath
2019
from .path import relpath
2120
from .time import datetime_to_epoch
22-
from .errors import NoSysPath, MissingInfoNamespace
2321
from .walk import Walker
2422

2523
if typing.TYPE_CHECKING:
2624
from typing import BinaryIO, Optional, Text, Tuple, Union
25+
2726
from .base import FS
2827

2928
ZipTime = Tuple[int, int, int, int, int, int]

fs/constants.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import io
55

6-
76
DEFAULT_CHUNK_SIZE = io.DEFAULT_BUFFER_SIZE * 16
87
"""`int`: the size of a single chunk read from or written to a file.
98
"""

fs/copy.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import print_function, unicode_literals
55

66
import typing
7+
78
import warnings
89

910
from .errors import ResourceNotFound
@@ -14,6 +15,7 @@
1415

1516
if typing.TYPE_CHECKING:
1617
from typing import Callable, Optional, Text, Union
18+
1719
from .base import FS
1820

1921
_OnCopy = Callable[[FS, Text, FS, Text], object]

fs/enums.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""Enums used by PyFilesystem.
22
"""
33

4-
from __future__ import absolute_import
5-
from __future__ import unicode_literals
4+
from __future__ import absolute_import, unicode_literals
65

76
import os
87
from enum import IntEnum, unique

fs/error_tools.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
"""Tools for managing OS errors.
22
"""
33

4-
from __future__ import print_function
5-
from __future__ import unicode_literals
4+
from __future__ import print_function, unicode_literals
65

7-
import errno
8-
import platform
96
import sys
107
import typing
11-
from contextlib import contextmanager
128

9+
import errno
10+
import platform
11+
from contextlib import contextmanager
1312
from six import reraise
1413

1514
from . import errors
1615

1716
if typing.TYPE_CHECKING:
18-
from types import TracebackType
1917
from typing import Iterator, Optional, Text, Type, Union
2018

19+
from types import TracebackType
20+
2121
try:
2222
from collections.abc import Mapping
2323
except ImportError:

fs/errors.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
99
"""
1010

11-
from __future__ import unicode_literals
12-
from __future__ import print_function
11+
from __future__ import print_function, unicode_literals
1312

14-
import functools
1513
import typing
1614

15+
import functools
1716
import six
1817
from six import text_type
1918

fs/filesize.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
1212
"""
1313

14-
from __future__ import division
15-
from __future__ import unicode_literals
14+
from __future__ import division, unicode_literals
1615

1716
import typing
1817

@@ -36,7 +35,7 @@ def _to_str(size, suffixes, base):
3635

3736
# TODO (dargueta): Don't rely on unit or suffix being defined in the loop.
3837
for i, suffix in enumerate(suffixes, 2): # noqa: B007
39-
unit = base ** i
38+
unit = base**i
4039
if size < unit:
4140
break
4241
return "{:,.1f} {}".format((base * size / unit), suffix)

0 commit comments

Comments
 (0)