Check f-strings (#1184)

This commit is contained in:
Stéphane Bruckert 2025-01-24 15:11:58 +00:00 committed by GitHub
parent 1d920ff5df
commit c738376b80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 11 deletions

View File

@ -49,6 +49,7 @@ Add your changes below.
- featured_playlists
- category_playlists
- Added FAQ entry for inaccessible playlists
- Workflow to check for f-strings
### Changed

View File

@ -29,19 +29,18 @@ $ source env/bin/activate
### Lint
pip install .[test]
To automatically fix some of the code style:
pip install autopep8
autopep8 --in-place --aggressive --recursive .
To verify the code style:
pip install flake8
flake8 .
To make sure if the import lists are stored correctly:
pip install isort
isort . -c
Sort them automatically with:

View File

@ -12,7 +12,9 @@ extra_reqs = {
'pymemcache>=3.5.2'
],
'test': [
'autopep8>=2.3.2',
'flake8>=7.1.1',
'flake8-string-format>=0.3.0',
'isort>=5.13.2'
]
}

View File

@ -1244,10 +1244,8 @@ class Spotify:
if they follow the playlist. Maximum: 5 ids.
"""
endpoint = "playlists/{}/followers/contains?ids={}"
return self._get(
endpoint.format(playlist_id, ",".join(user_ids))
)
endpoint = f"playlists/{playlist_id}/followers/contains?ids={','.join(user_ids)}"
return self._get(endpoint)
def me(self):
""" Get detailed profile information about the current user.

View File

@ -1224,19 +1224,21 @@ class RequestHandler(BaseHTTPRequestHandler):
self._write("<html><body><h1>Invalid request</h1></body></html>")
return
self._write("""<html>
self._write(f"""<html>
<script>
window.close()
</script>
<body>
<h1>Authentication status: {}</h1>
<h1>Authentication status: {status}</h1>
This window can be closed.
<script>
window.close()
</script>
<button class="closeButton" style="cursor: pointer" onclick="window.close();">Close Window</button>
<button class="closeButton" style="cursor: pointer" onclick="window.close();">
Close Window
</button>
</body>
</html>""".format(status))
</html>""")
def _write(self, text):
return self.wfile.write(text.encode("utf-8"))