Skip to content

Commit

Permalink
Check f-strings (#1184)
Browse files Browse the repository at this point in the history
stephanebruckert authored Jan 24, 2025
1 parent 1d920ff commit c738376
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@
'pymemcache>=3.5.2'
],
'test': [
'autopep8>=2.3.2',
'flake8>=7.1.1',
'flake8-string-format>=0.3.0',
'isort>=5.13.2'
]
}
6 changes: 2 additions & 4 deletions spotipy/client.py
Original file line number Diff line number Diff line change
@@ -1244,10 +1244,8 @@ def playlist_is_following(
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.
10 changes: 6 additions & 4 deletions spotipy/oauth2.py
Original file line number Diff line number Diff line change
@@ -1224,19 +1224,21 @@ def do_GET(self):
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"))

0 comments on commit c738376

Please sign in to comment.