Skip to content

Commit

Permalink
Explicit code formatting with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyfuture committed Dec 15, 2023
1 parent cc5adb9 commit a7fbb52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
5 changes: 1 addition & 4 deletions src/hatch/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ def __get_username(self) -> str:
self._app.abort('Missing required option: user')

self.__username_was_read = True
return (
self._app.prompt(f"Username for '{self._repo_config['url']}' [__token__]")
or "__token__"
)
return self._app.prompt(f"Username for '{self._repo_config['url']}' [__token__]") or '__token__'

def _read_previous_working_user_data(self) -> str | None:
if self._pwu_path.is_file():
Expand Down
28 changes: 14 additions & 14 deletions tests/utils/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def test_pypirc(fs):
fs.create_file(
Path.home() / ".pypirc",
Path.home() / '.pypirc',
contents="""\
[other]
username: guido
Expand All @@ -18,27 +18,27 @@ def test_pypirc(fs):
)

credentials = AuthenticationCredentials(
app=None, cache_dir=Path("/none"), options={}, repo="", repo_config={"url": ""}
app=None, cache_dir=Path('/none'), options={}, repo='', repo_config={'url': ''}
)
assert credentials.username == "guido"
assert credentials.password == "sprscrt"
assert credentials.username == 'guido'
assert credentials.password == 'sprscrt'

credentials = AuthenticationCredentials(
app=None,
cache_dir=Path("/none"),
cache_dir=Path('/none'),
options={},
repo="other",
repo_config={"url": ""},
repo='other',
repo_config={'url': ''},
)
assert credentials.username == "guido"
assert credentials.password == "gat"
assert credentials.username == 'guido'
assert credentials.password == 'gat'

credentials = AuthenticationCredentials(
app=None,
cache_dir=Path("/none"),
cache_dir=Path('/none'),
options={},
repo="arbritrary",
repo_config={"url": "https://kaashandel.nl/"},
repo='arbritrary',
repo_config={'url': 'https://kaashandel.nl/'},
)
assert credentials.username == "guido"
assert credentials.password == "gat"
assert credentials.username == 'guido'
assert credentials.password == 'gat'

0 comments on commit a7fbb52

Please sign in to comment.