Skip to content

Commit

Permalink
Fix import order with new isort options
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed May 2, 2022
1 parent 486cf3a commit 75cf00a
Show file tree
Hide file tree
Showing 96 changed files with 305 additions and 386 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# serve to show the default.

import sys
import os


import os
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
Expand Down Expand Up @@ -72,6 +71,7 @@
# built documents.
#
from fs import __version__

# The short X.Y version.
version = '.'.join(__version__.split('.')[:2])
# The full version, including alpha/beta/rc tags.
Expand Down
1 change: 0 additions & 1 deletion examples/count_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from fs import open_fs
from fs.filesize import traditional


fs_url = sys.argv[1]
count = 0

Expand Down
4 changes: 2 additions & 2 deletions examples/find_dups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"""

from collections import defaultdict
import sys

from fs import open_fs
from collections import defaultdict

from fs import open_fs

hashes = defaultdict(list)
with open_fs(sys.argv[1]) as fs:
Expand Down
1 change: 0 additions & 1 deletion examples/rm_pyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from fs import open_fs


with open_fs(sys.argv[1]) as fs:
count = fs.glob("**/*.pyc").remove()
print(f"{count} .pyc files remove")
3 changes: 2 additions & 1 deletion examples/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
"""

import os
import sys

import os

from fs import open_fs

_, file_path, fs_url = sys.argv
Expand Down
4 changes: 2 additions & 2 deletions fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

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

from . import path
from ._fscompat import fsdecode, fsencode
from ._version import __version__
from .enums import ResourceType, Seek
from .opener import open_fs
from ._fscompat import fsencode, fsdecode
from . import path

__all__ = ["__version__", "ResourceType", "Seek", "open_fs"]
8 changes: 5 additions & 3 deletions fs/_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@

from __future__ import unicode_literals

import threading
import typing

import threading
from six.moves.queue import Queue

from .copy import copy_file_internal, copy_modified_time
from .errors import BulkCopyFailed
from .tools import copy_file_data

if typing.TYPE_CHECKING:
from .base import FS
from typing import IO, List, Optional, Text, Tuple, Type

from types import TracebackType
from typing import List, Optional, Text, Type, IO, Tuple

from .base import FS


class _Worker(threading.Thread):
Expand Down
4 changes: 2 additions & 2 deletions fs/_fscompat.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import six

try:
from os import fsencode, fsdecode
from os import fsdecode, fsencode
except ImportError:
from backports.os import fsencode, fsdecode # type: ignore
from backports.os import fsdecode, fsencode # type: ignore

try:
from os import fspath
Expand Down
7 changes: 2 additions & 5 deletions fs/_ftp_parse.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, print_function, unicode_literals

import unicodedata
import re
import time
import unicodedata
from datetime import datetime

try:
Expand All @@ -15,7 +13,6 @@
from .enums import ResourceType
from .permissions import Permissions


EPOCH_DT = datetime.fromtimestamp(0, timezone.utc)


Expand Down
2 changes: 1 addition & 1 deletion fs/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""
import sys
import six

import six

_PY = sys.version_info

Expand Down
3 changes: 1 addition & 2 deletions fs/_tzcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
https://docs.python.org/2.7/library/datetime.html#tzinfo-objects
"""

from datetime import tzinfo, timedelta

from datetime import timedelta, tzinfo

ZERO = timedelta(0)

Expand Down
5 changes: 3 additions & 2 deletions fs/_url_tools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import typing

import platform
import re
import six
import platform
import typing

if typing.TYPE_CHECKING:
from typing import Text
Expand Down
6 changes: 3 additions & 3 deletions fs/appfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

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

import abc
import typing

import abc
import six
from appdirs import AppDirs

from .osfs import OSFS
from ._repr import make_repr
from appdirs import AppDirs
from .osfs import OSFS

if typing.TYPE_CHECKING:
from typing import Optional, Text
Expand Down
18 changes: 10 additions & 8 deletions fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

from __future__ import absolute_import, print_function, unicode_literals

import typing

import abc
import hashlib
import itertools
import os
import six
import threading
import time
import typing
import warnings
from contextlib import closing
from functools import partial, wraps
import warnings

import six

from . import copy, errors, fsencode, iotools, tools, walk, wildcard
from .copy import copy_modified_time
Expand All @@ -30,15 +30,13 @@
from .walk import Walker

if typing.TYPE_CHECKING:
from datetime import datetime
from threading import RLock
from typing import (
IO,
Any,
BinaryIO,
Callable,
Collection,
Dict,
IO,
Iterable,
Iterator,
List,
Expand All @@ -49,11 +47,15 @@
Type,
Union,
)

from datetime import datetime
from threading import RLock
from types import TracebackType

from .enums import ResourceType
from .info import Info, RawInfo
from .subfs import SubFS
from .permissions import Permissions
from .subfs import SubFS
from .walk import BoundWalker

_F = typing.TypeVar("_F", bound="FS")
Expand Down
15 changes: 7 additions & 8 deletions fs/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
`tarfile` modules from the standard library.
"""

from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, print_function, unicode_literals

import time
import tarfile
import typing
import zipfile
from datetime import datetime

import six
import tarfile
import time
import zipfile
from datetime import datetime

from .enums import ResourceType
from .errors import MissingInfoNamespace, NoSysPath
from .path import relpath
from .time import datetime_to_epoch
from .errors import NoSysPath, MissingInfoNamespace
from .walk import Walker

if typing.TYPE_CHECKING:
from typing import BinaryIO, Optional, Text, Tuple, Union

from .base import FS

ZipTime = Tuple[int, int, int, int, int, int]
Expand Down
1 change: 0 additions & 1 deletion fs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import io


DEFAULT_CHUNK_SIZE = io.DEFAULT_BUFFER_SIZE * 16
"""`int`: the size of a single chunk read from or written to a file.
"""
2 changes: 2 additions & 0 deletions fs/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import print_function, unicode_literals

import typing

import warnings

from .errors import ResourceNotFound
Expand All @@ -14,6 +15,7 @@

if typing.TYPE_CHECKING:
from typing import Callable, Optional, Text, Union

from .base import FS

_OnCopy = Callable[[FS, Text, FS, Text], object]
Expand Down
3 changes: 1 addition & 2 deletions fs/enums.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Enums used by PyFilesystem.
"""

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals

import os
from enum import IntEnum, unique
Expand Down
12 changes: 6 additions & 6 deletions fs/error_tools.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"""Tools for managing OS errors.
"""

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import print_function, unicode_literals

import errno
import platform
import sys
import typing
from contextlib import contextmanager

import errno
import platform
from contextlib import contextmanager
from six import reraise

from . import errors

if typing.TYPE_CHECKING:
from types import TracebackType
from typing import Iterator, Optional, Text, Type, Union

from types import TracebackType

try:
from collections.abc import Mapping
except ImportError:
Expand Down
5 changes: 2 additions & 3 deletions fs/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"""

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import print_function, unicode_literals

import functools
import typing

import functools
import six
from six import text_type

Expand Down
5 changes: 2 additions & 3 deletions fs/filesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"""

from __future__ import division
from __future__ import unicode_literals
from __future__ import division, unicode_literals

import typing

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

# TODO (dargueta): Don't rely on unit or suffix being defined in the loop.
for i, suffix in enumerate(suffixes, 2): # noqa: B007
unit = base ** i
unit = base**i
if size < unit:
break
return "{:,.1f} {}".format((base * size / unit), suffix)
Expand Down
Loading

0 comments on commit 75cf00a

Please sign in to comment.