Skip to content

Commit b5fa957

Browse files
authored
Update formatters (#690)
* Update black formatting * Update isort configuration
1 parent 88b87fe commit b5fa957

17 files changed

Lines changed: 68 additions & 73 deletions

.isort.cfg

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
[settings]
2-
# NOTE: Consider single_line_exclusions=typing in next version of isort
2+
profile=black
33
force_single_line=True
4-
multi_line_output=3
5-
include_trailing_comma=True
6-
force_grid_wrap=0
7-
use_parentheses=True
8-
line_length=88
4+
single_line_exclusions=typing
95
default_section=THIRDPARTY
106
known_first_party=twine,helpers

tests/test_check.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class TestWarningStream:
2525
def setup(self):
2626
self.stream = check._WarningStream()
2727
self.stream.output = pretend.stub(
28-
write=pretend.call_recorder(lambda a: None), getvalue=lambda: "result",
28+
write=pretend.call_recorder(lambda a: None),
29+
getvalue=lambda: "result",
2930
)
3031

3132
def test_write_match(self):

tests/test_register.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def test_exception_for_redirect(register_settings):
4949
redirect_url = "https://malicious.website.org/danger"
5050

5151
stub_response = pretend.stub(
52-
is_redirect=True, status_code=301, headers={"location": redirect_url},
52+
is_redirect=True,
53+
status_code=301,
54+
headers={"location": redirect_url},
5355
)
5456

5557
stub_repository = pretend.stub(

tests/test_repository.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ def test_package_is_uploaded_with_releases_using_cache(default_repo):
127127
"""Return True when the package is in the releases cache."""
128128
default_repo._releases_json_data = {"fake": {"0.1": [{"filename": "fake.whl"}]}}
129129
package = pretend.stub(
130-
safe_name="fake", basefilename="fake.whl", metadata=pretend.stub(version="0.1"),
130+
safe_name="fake",
131+
basefilename="fake.whl",
132+
metadata=pretend.stub(version="0.1"),
131133
)
132134

133135
assert default_repo.package_is_uploaded(package) is True
@@ -143,7 +145,9 @@ def test_package_is_uploaded_with_releases_not_using_cache(default_repo):
143145
),
144146
)
145147
package = pretend.stub(
146-
safe_name="fake", basefilename="fake.whl", metadata=pretend.stub(version="0.1"),
148+
safe_name="fake",
149+
basefilename="fake.whl",
150+
metadata=pretend.stub(version="0.1"),
147151
)
148152

149153
assert default_repo.package_is_uploaded(package, bypass_cache=True) is True
@@ -159,7 +163,9 @@ def test_package_is_uploaded_different_filenames(default_repo):
159163
),
160164
)
161165
package = pretend.stub(
162-
safe_name="fake", basefilename="foo.whl", metadata=pretend.stub(version="0.1"),
166+
safe_name="fake",
167+
basefilename="foo.whl",
168+
metadata=pretend.stub(version="0.1"),
163169
)
164170

165171
assert default_repo.package_is_uploaded(package) is False
@@ -313,7 +319,9 @@ def test_release_urls(package_meta, repository_url, release_urls):
313319
]
314320

315321
repo = repository.Repository(
316-
repository_url=repository_url, username="username", password="password",
322+
repository_url=repository_url,
323+
username="username",
324+
password="password",
317325
)
318326

319327
assert repo.release_urls(packages) == release_urls

tests/test_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def test_setup_logging(verbose, log_level):
6969

7070

7171
@pytest.mark.parametrize(
72-
"verbose", [True, False],
72+
"verbose",
73+
[True, False],
7374
)
7475
def test_print_config_path_if_verbose(tmpdir, capsys, make_settings, verbose):
7576
"""Print the location of the .pypirc config used by the user."""

tests/test_utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ def test_get_repository_config_with_invalid_url(tmpdir, repo_url, message):
196196
pypirc = os.path.join(str(tmpdir), ".pypirc")
197197

198198
with pytest.raises(
199-
exceptions.UnreachableRepositoryURLDetected, match=message,
199+
exceptions.UnreachableRepositoryURLDetected,
200+
match=message,
200201
):
201202
utils.get_repository_from_config(pypirc, "pypi", repo_url)
202203

@@ -253,7 +254,10 @@ def test_default_to_environment_action(env_name, default, environ, expected):
253254
dest = "example"
254255
with helpers.set_env(**environ):
255256
action = utils.EnvironmentDefault(
256-
env=env_name, default=default, option_strings=option_strings, dest=dest,
257+
env=env_name,
258+
default=default,
259+
option_strings=option_strings,
260+
dest=dest,
257261
)
258262
assert action.env == env_name
259263
assert action.default == expected
@@ -271,10 +275,12 @@ def test_check_status_code_for_deprecated_pypi_url(repo_url):
271275

272276

273277
@pytest.mark.parametrize(
274-
"repo_url", ["https://pypi.python.org", "https://testpypi.python.org"],
278+
"repo_url",
279+
["https://pypi.python.org", "https://testpypi.python.org"],
275280
)
276281
@pytest.mark.parametrize(
277-
"verbose", [True, False],
282+
"verbose",
283+
[True, False],
278284
)
279285
def test_check_status_code_for_missing_status_code(
280286
capsys, repo_url, verbose, make_settings

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ deps =
4545
isort
4646
black
4747
commands =
48-
isort --recursive twine/ tests/
48+
isort twine/ tests/
4949
black twine/ tests/
5050

5151
[testenv:lint]
@@ -55,7 +55,7 @@ deps =
5555
flake8
5656
flake8-docstrings
5757
commands =
58-
isort --check-only --diff --recursive twine/ tests/
58+
isort --check-only --diff twine/ tests/
5959
black --check --diff twine/ tests/
6060
flake8 twine/ tests/
6161

twine/auth.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import functools
22
import getpass
33
import warnings
4-
from typing import Callable
5-
from typing import Optional
6-
from typing import Type
7-
from typing import cast
4+
from typing import Callable, Optional, Type, cast
85

96
import keyring
107

twine/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import argparse
15-
from typing import Any
16-
from typing import Dict
17-
from typing import List
18-
from typing import Tuple
15+
from typing import Any, Dict, List, Tuple
1916

2017
import pkg_resources
2118
import pkginfo
@@ -69,10 +66,13 @@ def dispatch(argv: List[str]) -> Any:
6966
help="disable colored output",
7067
)
7168
parser.add_argument(
72-
"command", choices=registered_commands.keys(),
69+
"command",
70+
choices=registered_commands.keys(),
7371
)
7472
parser.add_argument(
75-
"args", help=argparse.SUPPRESS, nargs=argparse.REMAINDER,
73+
"args",
74+
help=argparse.SUPPRESS,
75+
nargs=argparse.REMAINDER,
7676
)
7777

7878
parser.parse_args(argv, namespace=args)

twine/commands/check.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
import re
1818
import sys
1919
import textwrap
20-
from typing import IO
21-
from typing import List
22-
from typing import Optional
23-
from typing import Tuple
24-
from typing import cast
20+
from typing import IO, List, Optional, Tuple, cast
2521

2622
import readme_renderer.rst
2723

0 commit comments

Comments
 (0)