Skip to content

Commit

Permalink
Merge pull request #63 from scottwernervt/60/merge-flake8-options
Browse files Browse the repository at this point in the history
Move flake8 options into setup.cfg.
  • Loading branch information
scottwernervt committed Apr 24, 2020
2 parents e1f2a55 + f9e1a3f commit 7845c7b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 22 deletions.
47 changes: 29 additions & 18 deletions setup.cfg
Expand Up @@ -2,24 +2,35 @@
python-tag = py3

[flake8]
ignore =
F403
F405
max-line-length = 120
exclude = */migrations/*
max-line-length = 80
max-complexity = 18
select = C,E,F,W,B,B950
ignore = E203,E501,W503
exclude =
.git
.eggs
.tox
__pycache__
docs/conf.py
old
build
dist

[mypy]
ignore_missing_imports = true
warn_unreachable = true
warn_unused_ignores = true
warn_redundant_casts = true

[tool:pytest]
testpaths = tests
norecursedirs =
migrations

python_files =
test_*.py
*_test.py
tests.py
addopts =
-ra
--strict
--doctest-modules
--doctest-glob=\*.rst
--tb=short
.eggs
.git
.pytest_cache
.tox
build
dist
docs
env
venv
addopts = -v --tb=short
7 changes: 4 additions & 3 deletions src/cloudstorage/__init__.py
@@ -1,13 +1,14 @@
"""Cloud Storage
:copyright: (c) 2017 by Scott Werner.
:copyright: (c) 2018 by Scott Werner.
:license: MIT, see LICENSE for more details.
"""
import logging
from enum import Enum, unique

from cloudstorage.base import Blob, Container, Driver
from cloudstorage.exceptions import CloudStorageError
from cloudstorage.typed import Drivers

__all__ = [
"Blob",
Expand Down Expand Up @@ -47,7 +48,7 @@ class DriverName(Enum):
}


def get_driver(driver: DriverName) -> Driver:
def get_driver(driver: DriverName) -> Drivers:
"""Get driver class by DriverName enumeration member.
.. code-block:: python
Expand All @@ -72,7 +73,7 @@ def get_driver(driver: DriverName) -> Driver:
raise CloudStorageError("Driver '%s' does not exist." % driver)


def get_driver_by_name(driver_name: str) -> Driver:
def get_driver_by_name(driver_name: str) -> Drivers:
"""Get driver class by driver name.
.. code-block:: python
Expand Down
17 changes: 16 additions & 1 deletion src/cloudstorage/typed.py
@@ -1,9 +1,24 @@
"""Custom typed annotations."""
from typing import Any, BinaryIO, Dict, Optional, TYPE_CHECKING, TextIO, Union
from typing import Any, BinaryIO, Dict, Optional, TYPE_CHECKING, TextIO, Union, Type

if TYPE_CHECKING:
from cloudstorage.structures import CaseInsensitiveDict # noqa
from cloudstorage.drivers.amazon import S3Driver # noqa
from cloudstorage.drivers.google import GoogleStorageDriver # noqa
from cloudstorage.drivers.local import LocalDriver # noqa
from cloudstorage.drivers.microsoft import AzureStorageDriver # noqa
from cloudstorage.drivers.minio import MinioDriver # noqa
from cloudstorage.drivers.rackspace import CloudFilesDriver # noqa


Drivers = Union[
Type["S3Driver"],
Type["GoogleStorageDriver"],
Type["LocalDriver"],
Type["AzureStorageDriver"],
Type["MinioDriver"],
Type["CloudFilesDriver"],
]
FileLike = Union[BinaryIO, TextIO, str]
Acl = Optional[Dict[Any, Any]]
MetaData = Optional["CaseInsensitiveDict"]
Expand Down

0 comments on commit 7845c7b

Please sign in to comment.