diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-08-27 23:06:13 -0700 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-08-27 23:06:13 -0700 |
commit | 968aed0bd91f8de507ffe3d4ed291cdaf73d0225 (patch) | |
tree | 1fb9ad7c68c360183c466faba033bbc2bcb7d6da | |
parent | 472d4643fe7fde1b98f56e6c21f9bc6afb94846c (diff) | |
download | isort-issue/1392/extensive-profile-testing-black.tar.gz |
Update to latest version of dependencies; reformatissue/1392/extensive-profile-testing-black
-rw-r--r-- | example_isort_formatting_plugin/example_isort_formatting_plugin.py | 3 | ||||
-rw-r--r-- | example_isort_formatting_plugin/pyproject.toml | 4 | ||||
-rw-r--r-- | isort/_future/_dataclasses.py | 7 | ||||
-rw-r--r-- | isort/output.py | 6 | ||||
-rw-r--r-- | isort/wrap_modes.py | 2 | ||||
-rw-r--r-- | poetry.lock | 117 | ||||
-rw-r--r-- | pyproject.toml | 4 | ||||
-rw-r--r-- | tests/integration/test_setting_combinations.py | 6 | ||||
-rw-r--r-- | tests/unit/profiles/test_black.py | 51 | ||||
-rw-r--r-- | tests/unit/test_isort.py | 15 | ||||
-rw-r--r-- | tests/unit/test_ticketed_features.py | 10 |
11 files changed, 129 insertions, 96 deletions
diff --git a/example_isort_formatting_plugin/example_isort_formatting_plugin.py b/example_isort_formatting_plugin/example_isort_formatting_plugin.py index ff65412f..f63b817e 100644 --- a/example_isort_formatting_plugin/example_isort_formatting_plugin.py +++ b/example_isort_formatting_plugin/example_isort_formatting_plugin.py @@ -15,7 +15,8 @@ def black_format_import_section( contents, fast=True, mode=black.FileMode( - is_pyi=extension.lower() == "pyi", line_length=config.line_length, + is_pyi=extension.lower() == "pyi", + line_length=config.line_length, ), ) except black.NothingChanged: diff --git a/example_isort_formatting_plugin/pyproject.toml b/example_isort_formatting_plugin/pyproject.toml index 9e060ec1..31e3f928 100644 --- a/example_isort_formatting_plugin/pyproject.toml +++ b/example_isort_formatting_plugin/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "example_isort_formatting_plugin" -version = "0.0.1" +version = "0.0.2" description = "An example plugin that modifies isort formatting using black." authors = ["Timothy Crosley <timothy.crosley@gmail.com>"] license = "MIT" @@ -11,7 +11,7 @@ example = "example_isort_formatting_plugin:black_format_import_section" [tool.poetry.dependencies] python = "^3.6" isort = "^5.1.4" -black = "^19.10b0" +black = "^20.08b1" [tool.poetry.dev-dependencies] diff --git a/isort/_future/_dataclasses.py b/isort/_future/_dataclasses.py index a7b113fe..87acb666 100644 --- a/isort/_future/_dataclasses.py +++ b/isort/_future/_dataclasses.py @@ -1137,7 +1137,10 @@ def make_dataclass( name = item tp = "typing.Any" elif len(item) == 2: - name, tp, = item + ( + name, + tp, + ) = item elif len(item) == 3: name, tp, spec = item namespace[name] = spec @@ -1173,7 +1176,7 @@ def replace(obj, **changes): c = C(1, 2) c1 = replace(c, x=3) assert c1.x == 3 and c1.y == 2 - """ + """ # We're going to mutate 'changes', but that's okay because it's a # new dict, even if called with 'replace(obj, **my_changes)'. diff --git a/isort/output.py b/isort/output.py index afb14ea2..7d793ac1 100644 --- a/isort/output.py +++ b/isort/output.py @@ -229,7 +229,11 @@ def _with_from_imports( from_imports = sorting.naturally( from_imports, key=lambda key: sorting.module_key( - key, config, True, ignore_case, section_name=section, + key, + config, + True, + ignore_case, + section_name=section, ), ) if remove_imports: diff --git a/isort/wrap_modes.py b/isort/wrap_modes.py index 92a63c3f..8e10a947 100644 --- a/isort/wrap_modes.py +++ b/isort/wrap_modes.py @@ -34,7 +34,7 @@ def _wrap_mode_interface( def _wrap_mode(function): """Registers an individual wrap mode. Function name and order are significant and used for - creating enum. + creating enum. """ _wrap_modes[function.__name__.upper()] = function function.__signature__ = signature(_wrap_mode_interface) diff --git a/poetry.lock b/poetry.lock index e7472fbd..ce01d351 100644 --- a/poetry.lock +++ b/poetry.lock @@ -21,10 +21,10 @@ description = "Better dates & times for Python" name = "arrow" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.15.8" +version = "0.16.0" [package.dependencies] -python-dateutil = "*" +python-dateutil = ">=2.7.0" [[package]] category = "dev" @@ -41,13 +41,12 @@ description = "Classes Without Boilerplate" name = "attrs" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "19.3.0" +version = "20.1.0" [package.extras] -azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"] -dev = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "pre-commit"] -docs = ["sphinx", "zope.interface"] -tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] +dev = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "sphinx-rtd-theme", "pre-commit"] +docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] +tests = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] [[package]] category = "dev" @@ -89,18 +88,24 @@ description = "The uncompromising code formatter." name = "black" optional = false python-versions = ">=3.6" -version = "19.10b0" +version = "20.8b1" [package.dependencies] appdirs = "*" -attrs = ">=18.1.0" -click = ">=6.5" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" pathspec = ">=0.6,<1" -regex = "*" -toml = ">=0.9.4" +regex = ">=2020.1.8" +toml = ">=0.10.1" typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" + +[package.dependencies.dataclasses] +python = "<3.7" +version = ">=0.6" [package.extras] +colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] [[package]] @@ -202,7 +207,7 @@ description = "Allows you to maintain all the necessary cruft for packaging and name = "cruft" optional = false python-versions = ">=3.6,<4.0" -version = "2.2.0" +version = "2.3.0" [package.dependencies] click = ">=7.1.2,<8.0.0" @@ -269,10 +274,10 @@ description = "An example plugin that modifies isort formatting using black." name = "example-isort-formatting-plugin" optional = false python-versions = ">=3.6,<4.0" -version = "0.0.1" +version = "0.0.2" [package.dependencies] -black = ">=19.10b0,<20.0" +black = ">=20.08b1,<21.0" isort = ">=5.1.4,<6.0.0" [[package]] @@ -417,7 +422,7 @@ description = "Chromium HSTS Preload list as a Python package and updated daily" name = "hstspreload" optional = false python-versions = ">=3.6" -version = "2020.8.12" +version = "2020.8.25" [[package]] category = "dev" @@ -475,17 +480,19 @@ description = "A library for property-based testing" name = "hypothesis" optional = false python-versions = ">=3.5.2" -version = "5.24.4" +version = "5.29.3" [package.dependencies] attrs = ">=19.2.0" sortedcontainers = ">=2.1.0,<3.0.0" [package.extras] -all = ["django (>=2.2)", "dpcontracts (>=0.4)", "lark-parser (>=0.6.5)", "numpy (>=1.9.0)", "pandas (>=0.19)", "pytest (>=4.3)", "python-dateutil (>=1.4)", "pytz (>=2014.1)"] +all = ["black (>=19.10b0)", "click (>=7.0)", "django (>=2.2)", "dpcontracts (>=0.4)", "lark-parser (>=0.6.5)", "numpy (>=1.9.0)", "pandas (>=0.19)", "pytest (>=4.3)", "python-dateutil (>=1.4)", "pytz (>=2014.1)"] +cli = ["click (>=7.0)", "black (>=19.10b0)"] dateutil = ["python-dateutil (>=1.4)"] django = ["pytz (>=2014.1)", "django (>=2.2)"] dpcontracts = ["dpcontracts (>=0.4)"] +ghostwriter = ["black (>=19.10b0)"] lark = ["lark-parser (>=0.6.5)"] numpy = ["numpy (>=1.9.0)"] pandas = ["pandas (>=0.19)"] @@ -513,7 +520,7 @@ description = "Hypothesis strategies for generating Python programs, something l name = "hypothesmith" optional = false python-versions = ">=3.6" -version = "0.1.3" +version = "0.1.4" [package.dependencies] hypothesis = ">=5.23.7" @@ -660,7 +667,7 @@ description = "A concrete syntax tree with AST-like properties for Python 3.5, 3 name = "libcst" optional = false python-versions = ">=3.6" -version = "0.3.9" +version = "0.3.10" [package.dependencies] pyyaml = ">=5.2" @@ -680,7 +687,7 @@ description = "Python LiveReload is an awesome tool for web developers" name = "livereload" optional = false python-versions = "*" -version = "2.6.2" +version = "2.6.3" [package.dependencies] six = "*" @@ -782,7 +789,7 @@ description = "A Material Design theme for MkDocs" name = "mkdocs-material" optional = false python-versions = "*" -version = "5.5.6" +version = "5.5.9" [package.dependencies] Pygments = ">=2.4" @@ -1153,7 +1160,7 @@ description = "Python docstring style checker" name = "pydocstyle" optional = false python-versions = ">=3.5" -version = "5.0.2" +version = "5.1.0" [package.dependencies] snowballstemmer = "*" @@ -1525,7 +1532,7 @@ description = "Typer, build great CLIs. Easy to code. Based on Python type hints name = "typer" optional = false python-versions = ">=3.6" -version = "0.3.1" +version = "0.3.2" [package.dependencies] click = ">=7.1.1,<7.2.0" @@ -1534,7 +1541,7 @@ click = ">=7.1.1,<7.2.0" all = ["colorama (>=0.4.3,<0.5.0)", "shellingham (>=1.3.0,<2.0.0)"] dev = ["autoflake (>=1.3.1,<2.0.0)", "flake8 (>=3.8.3,<4.0.0)"] doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=5.4.0,<6.0.0)", "markdown-include (>=0.5.1,<0.6.0)"] -test = ["shellingham (>=1.3.0,<2.0.0)", "pytest (>=4.4.0,<5.4.0)", "pytest-cov (>=2.10.0,<3.0.0)", "coverage (>=5.2,<6.0)", "pytest-xdist (>=1.32.0,<2.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "mypy (0.782)", "black (>=19.10b0,<20.0b0)", "isort (>=5.0.6,<6.0.0)"] +test = ["pytest-xdist (>=1.32.0,<2.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "mypy (0.782)", "black (>=19.10b0,<20.0b0)", "isort (>=5.0.6,<6.0.0)", "shellingham (>=1.3.0,<2.0.0)", "pytest (>=4.4.0,<5.4.0)", "pytest-cov (>=2.10.0,<3.0.0)", "coverage (>=5.2,<6.0)"] [[package]] category = "dev" @@ -1542,7 +1549,7 @@ description = "Backported and Experimental Type Hints for Python 3.5+" name = "typing-extensions" optional = false python-versions = "*" -version = "3.7.4.2" +version = "3.7.4.3" [[package]] category = "dev" @@ -1653,7 +1660,7 @@ pipfile_deprecated_finder = ["pipreqs", "tomlkit", "requirementslib"] requirements_deprecated_finder = ["pipreqs", "pip-api"] [metadata] -content-hash = "5463d8238a63216a861fd6d75b1a86842f2a1ab3574a5ecb8dbe8d9183b6a874" +content-hash = "c366831acb4de815d36de7d6072c341ae3a1a1cca409490b5c81fe1159977597" python-versions = "^3.6" [metadata.files] @@ -1666,16 +1673,16 @@ appnope = [ {file = "appnope-0.1.0.tar.gz", hash = "sha256:8b995ffe925347a2138d7ac0fe77155e4311a0ea6d6da4f5128fe4b3cbe5ed71"}, ] arrow = [ - {file = "arrow-0.15.8-py2.py3-none-any.whl", hash = "sha256:271b8e05174d48e50324ed0dc5d74796c839c7e579a4f21cf1a7394665f9e94f"}, - {file = "arrow-0.15.8.tar.gz", hash = "sha256:edc31dc051db12c95da9bac0271cd1027b8e36912daf6d4580af53b23e62721a"}, + {file = "arrow-0.16.0-py2.py3-none-any.whl", hash = "sha256:98184d8dd3e5d30b96c2df4596526f7de679ccb467f358b82b0f686436f3a6b8"}, + {file = "arrow-0.16.0.tar.gz", hash = "sha256:92aac856ea5175c804f7ccb96aca4d714d936f1c867ba59d747a8096ec30e90a"}, ] atomicwrites = [ {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, ] attrs = [ - {file = "attrs-19.3.0-py2.py3-none-any.whl", hash = "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"}, - {file = "attrs-19.3.0.tar.gz", hash = "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"}, + {file = "attrs-20.1.0-py2.py3-none-any.whl", hash = "sha256:2867b7b9f8326499ab5b0e2d12801fa5c98842d2cbd22b35112ae04bf85b4dff"}, + {file = "attrs-20.1.0.tar.gz", hash = "sha256:0ef97238856430dcf9228e07f316aefc17e8939fc8507e18c6501b761ef1a42a"}, ] backcall = [ {file = "backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"}, @@ -1690,8 +1697,8 @@ binaryornot = [ {file = "binaryornot-0.4.4.tar.gz", hash = "sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061"}, ] black = [ - {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, - {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, + {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] cached-property = [ {file = "cached-property-1.5.1.tar.gz", hash = "sha256:9217a59f14a5682da7c4b8829deadbfc194ac22e9908ccf7c8820234e80a1504"}, @@ -1760,8 +1767,8 @@ coverage = [ {file = "coverage-5.2.1.tar.gz", hash = "sha256:a34cb28e0747ea15e82d13e14de606747e9e484fb28d63c999483f5d5188e89b"}, ] cruft = [ - {file = "cruft-2.2.0-py3-none-any.whl", hash = "sha256:da3dc9ee84dea1a4ea161b5d0fa86b11ecb77480eb22b4d776572f95a96ae9fc"}, - {file = "cruft-2.2.0.tar.gz", hash = "sha256:9365ae8547bf2297c9e88dec3b28a16bd4491c4931f417b8c3c1fd8140b1e0fd"}, + {file = "cruft-2.3.0-py3-none-any.whl", hash = "sha256:ca973c1ca9e4add9893483dbce02cd8930e105f8940afe0d087a14b70c6068de"}, + {file = "cruft-2.3.0.tar.gz", hash = "sha256:7c0f7682765e76fcf31adf877ea6f74372a0ab9554d8f8d6766e8e0413730e52"}, ] dataclasses = [ {file = "dataclasses-0.6-py3-none-any.whl", hash = "sha256:454a69d788c7fda44efd71e259be79577822f5e3f53f029a22d08004e951dc9f"}, @@ -1783,8 +1790,8 @@ dparse = [ {file = "dparse-0.5.1.tar.gz", hash = "sha256:a1b5f169102e1c894f9a7d5ccf6f9402a836a5d24be80a986c7ce9eaed78f367"}, ] example-isort-formatting-plugin = [ - {file = "example_isort_formatting_plugin-0.0.1-py3-none-any.whl", hash = "sha256:3c4bd66eb457480daa1320e2e1ef4160e639f2629315cfc54830b2613aa823bc"}, - {file = "example_isort_formatting_plugin-0.0.1.tar.gz", hash = "sha256:2666045920accaa0c3f7e60e85369c408658faef50c6c8971519562a14b7e7d8"}, + {file = "example_isort_formatting_plugin-0.0.2-py3-none-any.whl", hash = "sha256:ce428ab5deb4719e4bec56eae63978ff2d9c20dc2c2aa7cc39ece61044153db7"}, + {file = "example_isort_formatting_plugin-0.0.2.tar.gz", hash = "sha256:8cb6401c9efe2f97ba3e776439cb647ee964dc7880bd9790b0324be2c7a55907"}, ] example-shared-isort-profile = [ {file = "example_shared_isort_profile-0.0.1-py3-none-any.whl", hash = "sha256:3fa3e2d093e68285fc7893704b727791ed3e0969d07bdd2733e366303d1a2582"}, @@ -1850,8 +1857,8 @@ hpack = [ {file = "hpack-3.0.0.tar.gz", hash = "sha256:8eec9c1f4bfae3408a3f30500261f7e6a65912dc138526ea054f9ad98892e9d2"}, ] hstspreload = [ - {file = "hstspreload-2020.8.12-py3-none-any.whl", hash = "sha256:64f4441066d5544873faccf2e0b5757c6670217d34dc31d362ca2977f44604ff"}, - {file = "hstspreload-2020.8.12.tar.gz", hash = "sha256:3f5c324b1eb9d924e32ffeb5fe265b879806b6e346b765f57566410344f4b41e"}, + {file = "hstspreload-2020.8.25-py3-none-any.whl", hash = "sha256:c96401eca4669340b423abd711d2d5d03ddf0685461f95e9cfe500d5e9acf3d2"}, + {file = "hstspreload-2020.8.25.tar.gz", hash = "sha256:3129613419c13ea62411ec7375d79840e28004cbb6a585909ddcbeee401bea14"}, ] httpcore = [ {file = "httpcore-0.9.1-py3-none-any.whl", hash = "sha256:9850fe97a166a794d7e920590d5ec49a05488884c9fc8b5dba8561effab0c2a0"}, @@ -1870,16 +1877,16 @@ hyperframe = [ {file = "hyperframe-5.2.0.tar.gz", hash = "sha256:a9f5c17f2cc3c719b917c4f33ed1c61bd1f8dfac4b1bd23b7c80b3400971b41f"}, ] hypothesis = [ - {file = "hypothesis-5.24.4-py3-none-any.whl", hash = "sha256:4d86b1d7bbec9caffc49dbd0037fa549c456d08aa99e468dbce5871fdbf2167b"}, - {file = "hypothesis-5.24.4.tar.gz", hash = "sha256:c3ac78ae0cebe7098bc00d8b3e16b65640c97593cceb64c9eb2331ac282fa607"}, + {file = "hypothesis-5.29.3-py3-none-any.whl", hash = "sha256:07b865184494a64cf2e18090ecfb876c97d303973c2f97139a07be361b0c3a28"}, + {file = "hypothesis-5.29.3.tar.gz", hash = "sha256:e6cf92a94a5108d326e45df5a2b256dc0d57f9663d13efdebcadcfbad9accc31"}, ] hypothesis-auto = [ {file = "hypothesis-auto-1.1.4.tar.gz", hash = "sha256:5e2c2fb09dc09842512d80630bb792359a1d33d2c0473ad47ee23da0be9e32b1"}, {file = "hypothesis_auto-1.1.4-py3-none-any.whl", hash = "sha256:fea8560c4522c0fd490ed8cc17e420b95dabebb11b9b334c59bf2d768839015f"}, ] hypothesmith = [ - {file = "hypothesmith-0.1.3-py3-none-any.whl", hash = "sha256:aceb0feae6029eeaa4502cd763debec313b1aec43db8805958e5a81036c3e483"}, - {file = "hypothesmith-0.1.3.tar.gz", hash = "sha256:4cf1e2ce43407ad1c9c2ab5a940760db3ea8c3c29134435bc0600f33a4a32de4"}, + {file = "hypothesmith-0.1.4-py3-none-any.whl", hash = "sha256:bc45f45808078d2bbe6c3806af3b3604bde35624964fcc6b849cecadf254d3a9"}, + {file = "hypothesmith-0.1.4.tar.gz", hash = "sha256:5628fb1a06233c70751105635bc3cee789c82358041b4518c2cab5300e73cd65"}, ] idna = [ {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, @@ -1931,11 +1938,11 @@ lark-parser = [ {file = "lark-parser-0.9.0.tar.gz", hash = "sha256:9e7589365d6b6de1cca40b0eaec31104a3fb96a37a11a9dfd5098e95b50aa6cd"}, ] libcst = [ - {file = "libcst-0.3.9-py3-none-any.whl", hash = "sha256:ca1744d9344f51c2c9226d0472a5a3096f8b39e4fe38441ebc2ba26babd00688"}, - {file = "libcst-0.3.9.tar.gz", hash = "sha256:b5185c84f0e4a38409aac59f53a71741bec8c1b1159c874996b3266daafe63e5"}, + {file = "libcst-0.3.10-py3-none-any.whl", hash = "sha256:e9395d952a490e6fc160f2bea8df139bdf1fdcb3fe4c01b88893da279eff00de"}, + {file = "libcst-0.3.10.tar.gz", hash = "sha256:b0dccbfc1cff7bfa3214980e1d2d90b4e00b2fed002d4b276a8a411217738df3"}, ] livereload = [ - {file = "livereload-2.6.2.tar.gz", hash = "sha256:d1eddcb5c5eb8d2ca1fa1f750e580da624c0f7fcb734aa5780dc81b7dcbd89be"}, + {file = "livereload-2.6.3.tar.gz", hash = "sha256:776f2f865e59fde56490a56bcc6773b6917366bce0c267c60ee8aaf1a0959869"}, ] lunr = [ {file = "lunr-0.5.8-py2.py3-none-any.whl", hash = "sha256:aab3f489c4d4fab4c1294a257a30fec397db56f0a50273218ccc3efdbf01d6ca"}, @@ -1993,8 +2000,8 @@ mkdocs = [ {file = "mkdocs-1.1.2.tar.gz", hash = "sha256:f0b61e5402b99d7789efa032c7a74c90a20220a9c81749da06dbfbcbd52ffb39"}, ] mkdocs-material = [ - {file = "mkdocs-material-5.5.6.tar.gz", hash = "sha256:08af704cdfaf2a07fd5f135831df9106c589bfd422f9ef026929981433e80b9d"}, - {file = "mkdocs_material-5.5.6-py2.py3-none-any.whl", hash = "sha256:29f3637d5fb758d076344b026a67b8e316743d0c2da84b9303383f6cbeabfd5f"}, + {file = "mkdocs-material-5.5.9.tar.gz", hash = "sha256:37d60947993b939318945c170c7b3a153646976badf57648fd70befc3b54c830"}, + {file = "mkdocs_material-5.5.9-py2.py3-none-any.whl", hash = "sha256:c8cb3c8c44bf10ed7ac1eb568d93a4346efe03fee2994b6a80e96559421cec49"}, ] mkdocs-material-extensions = [ {file = "mkdocs-material-extensions-1.0.tar.gz", hash = "sha256:17d7491e189af75700310b7ec33c6c48a22060b8b445001deca040cb60471cde"}, @@ -2162,8 +2169,8 @@ pydantic = [ {file = "pydantic-1.6.1.tar.gz", hash = "sha256:54122a8ed6b75fe1dd80797f8251ad2063ea348a03b77218d73ea9fe19bd4e73"}, ] pydocstyle = [ - {file = "pydocstyle-5.0.2-py3-none-any.whl", hash = "sha256:da7831660b7355307b32778c4a0dbfb137d89254ef31a2b2978f50fc0b4d7586"}, - {file = "pydocstyle-5.0.2.tar.gz", hash = "sha256:f4f5d210610c2d153fae39093d44224c17429e2ad7da12a8b419aba5c2f614b5"}, + {file = "pydocstyle-5.1.0-py3-none-any.whl", hash = "sha256:08374b9d4d2b7164bae50b71bb24eb0d74a56b309029d5d502264092fa7db0c3"}, + {file = "pydocstyle-5.1.0.tar.gz", hash = "sha256:4ca3c7736d36f92bb215dd74ef84ac3d6c146edd795c7afc5154c10f1eb1f65a"}, ] pyflakes = [ {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, @@ -2339,13 +2346,13 @@ typed-ast = [ {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, ] typer = [ - {file = "typer-0.3.1-py3-none-any.whl", hash = "sha256:778a9695e68eb26a0a0321ca9d3f1a8809783f6f083549b84c67bc2385bf014e"}, - {file = "typer-0.3.1.tar.gz", hash = "sha256:85b1e5f6369750b4220ad548ea30b881a2c502504e5a0d849db9bdf6b487bdbf"}, + {file = "typer-0.3.2-py3-none-any.whl", hash = "sha256:ba58b920ce851b12a2d790143009fa00ac1d05b3ff3257061ff69dbdfc3d161b"}, + {file = "typer-0.3.2.tar.gz", hash = "sha256:5455d750122cff96745b0dec87368f56d023725a7ebc9d2e54dd23dc86816303"}, ] typing-extensions = [ - {file = "typing_extensions-3.7.4.2-py2-none-any.whl", hash = "sha256:f8d2bd89d25bc39dabe7d23df520442fa1d8969b82544370e03d88b5a591c392"}, - {file = "typing_extensions-3.7.4.2-py3-none-any.whl", hash = "sha256:6e95524d8a547a91e08f404ae485bbb71962de46967e1b71a0cb89af24e761c5"}, - {file = "typing_extensions-3.7.4.2.tar.gz", hash = "sha256:79ee589a3caca649a9bfd2a8de4709837400dfa00b6cc81962a1e6a1815969ae"}, + {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, + {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, + {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, ] typing-inspect = [ {file = "typing_inspect-0.6.0-py2-none-any.whl", hash = "sha256:de08f50a22955ddec353876df7b2545994d6df08a2f45d54ac8c05e530372ca0"}, diff --git a/pyproject.toml b/pyproject.toml index 1e3e1e81..5f648f40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ vulture = "^1.0" bandit = "^1.6" safety = "^1.8" flake8-bugbear = "^19.8" -black = {version = "^19.10b0", allow-prereleases = true} +black = {version = "^20.08b1", allow-prereleases = true} mypy = "^0.761.0" ipython = "^7.7" pytest = "^5.0" @@ -79,7 +79,7 @@ smmap2 = "^3.0.1" gitdb2 = "^4.0.2" httpx = "^0.13.3" example_shared_isort_profile = "^0.0.1" -example_isort_formatting_plugin = "^0.0.1" +example_isort_formatting_plugin = "^0.0.2" [tool.poetry.scripts] isort = "isort.main:main" diff --git a/tests/integration/test_setting_combinations.py b/tests/integration/test_setting_combinations.py index c29c7742..7e236f9f 100644 --- a/tests/integration/test_setting_combinations.py +++ b/tests/integration/test_setting_combinations.py @@ -154,7 +154,8 @@ else: # 2.x @hypothesis.given( - config=st.from_type(isort.Config), disregard_skip=st.booleans(), + config=st.from_type(isort.Config), + disregard_skip=st.booleans(), ) def test_isort_is_idempotent(config: isort.Config, disregard_skip: bool) -> None: try: @@ -166,7 +167,8 @@ def test_isort_is_idempotent(config: isort.Config, disregard_skip: bool) -> None @hypothesis.given( - config=st.from_type(isort.Config), disregard_skip=st.booleans(), + config=st.from_type(isort.Config), + disregard_skip=st.booleans(), ) def test_isort_doesnt_lose_imports_or_comments(config: isort.Config, disregard_skip: bool) -> None: result = isort.code(CODE_SNIPPET, config=config, disregard_skip=disregard_skip) diff --git a/tests/unit/profiles/test_black.py b/tests/unit/profiles/test_black.py index 4b909731..0e54e706 100644 --- a/tests/unit/profiles/test_black.py +++ b/tests/unit/profiles/test_black.py @@ -1,46 +1,49 @@ import black + import isort -def black_format(code: str, is_pyi: bool=False, line_length: int=88) -> str: +def black_format(code: str, is_pyi: bool = False, line_length: int = 88) -> str: """Formats the provided code snippet using black""" try: return black.format_file_contents( code, fast=True, mode=black.FileMode( - is_pyi=is_pyi, line_length=line_length, + is_pyi=is_pyi, + line_length=line_length, ), ) except black.NothingChanged: return code -def black_test(code: str, expected_output: str=""): +def black_test(code: str, expected_output: str = ""): """Tests that the given code: - Behaves the same when formatted multiple times with isort. - Agrees with black formatting. - Matches the desired output or itself if none is provided. """ expected_output = expected_output or code - + # output should stay consistent over multiple runs output = isort.code(code, profile="black") assert output == isort.code(code, profile="black") - + # output should agree with black black_output = black_format(output) assert output == black_output - + # output should match expected output assert output == expected_output - + def test_black_snippet_one(): """Test consistent code formatting between isort and black for code snippet from black repository. See: https://github.com/psf/black/blob/master/tests/test_black.py """ - black_test("""#!/usr/bin/env python3 + black_test( + """#!/usr/bin/env python3 import asyncio import logging from concurrent.futures import ThreadPoolExecutor @@ -94,7 +97,7 @@ from .test_primer import PrimerCLITests # noqa: F401 DEFAULT_MODE = black.FileMode(experimental_string_processing=True) """, -"""#!/usr/bin/env python3 + """#!/usr/bin/env python3 import asyncio import inspect import logging @@ -145,15 +148,16 @@ from pathspec import PathSpec from .test_primer import PrimerCLITests # noqa: F401 DEFAULT_MODE = black.FileMode(experimental_string_processing=True) -""" -) - - +""", + ) + + def test_black_snippet_two(): """Test consistent code formatting between isort and black for code snippet from black repository. See: https://github.com/psf/black/blob/master/tests/test_primer.py """ - black_test('''#!/usr/bin/env python3 + black_test( + '''#!/usr/bin/env python3 import asyncio import sys @@ -188,7 +192,7 @@ Failed projects: Black didn't work """ ''', -'''#!/usr/bin/env python3 + '''#!/usr/bin/env python3 import asyncio import sys @@ -219,14 +223,16 @@ Failed projects: - stdout: Black didn't work """ -''' -) - +''', + ) + + def test_black_snippet_three(): """Test consistent code formatting between isort and black for code snippet from black repository. See: https://github.com/psf/black/blob/master/src/black/__init__.py """ - black_test('''import ast + black_test( + """import ast import asyncio from abc import ABC, abstractmethod from collections import defaultdict @@ -293,8 +299,8 @@ if TYPE_CHECKING: import colorama # noqa: F401 DEFAULT_LINE_LENGTH = 88 -''', -'''import ast +""", + """import ast import asyncio import io import itertools @@ -360,4 +366,5 @@ if TYPE_CHECKING: import colorama # noqa: F401 DEFAULT_LINE_LENGTH = 88 -''') +""", + ) diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py index a13595b3..949075bb 100644 --- a/tests/unit/test_isort.py +++ b/tests/unit/test_isort.py @@ -2940,12 +2940,15 @@ def test_not_splitted_sections() -> None: ) # in case when THIRDPARTY section is excluded from sections list, # it's ok to merge STDLIB and FIRSTPARTY - assert isort.code( - code=test_input, - sections=["STDLIB", "FIRSTPARTY", "LOCALFOLDER"], - no_lines_before=["FIRSTPARTY"], - known_first_party=["app"], - ) == (stdlib_section + firstparty_section + whiteline + local_section + whiteline + statement) + assert ( + isort.code( + code=test_input, + sections=["STDLIB", "FIRSTPARTY", "LOCALFOLDER"], + no_lines_before=["FIRSTPARTY"], + known_first_party=["app"], + ) + == (stdlib_section + firstparty_section + whiteline + local_section + whiteline + statement) + ) # it doesn't change output, because stdlib packages don't have any whitelines before them assert ( isort.code(test_input, no_lines_before=["STDLIB"], known_first_party=["app"]) == test_input diff --git a/tests/unit/test_ticketed_features.py b/tests/unit/test_ticketed_features.py index 86b39045..b387ec63 100644 --- a/tests/unit/test_ticketed_features.py +++ b/tests/unit/test_ticketed_features.py @@ -558,10 +558,16 @@ from a import b as y from a import c """ assert ( - isort.code(test_input, combine_star=True,) + isort.code( + test_input, + combine_star=True, + ) == isort.code(test_input, combine_star=True, force_single_line=True) == isort.code( - test_input, combine_star=True, force_single_line=True, combine_as_imports=True, + test_input, + combine_star=True, + force_single_line=True, + combine_as_imports=True, ) == """ from a import * |