From 6c83f09898393facc8f3276c74e3f972957a8c69 Mon Sep 17 00:00:00 2001 From: "Sebastien (Work)" Date: Mon, 23 Oct 2017 23:02:17 +0100 Subject: [PATCH] Format examples Add spaces after ':' and ','. Remove spaces before and after '(', '{', '[', ']', '}' and ')'. --- examples/artist_albums.py | 2 +- examples/audio_analysis_for_track.py | 2 +- examples/audio_features.py | 2 +- examples/audio_features_for_track.py | 2 +- examples/change_playlist_details.py | 2 +- examples/errors.py | 8 ++++---- examples/remove_specific_tracks_from_playlist.py | 4 ++-- examples/show_new_releases.py | 2 +- examples/user_starred_playlist.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/artist_albums.py b/examples/artist_albums.py index 6b9f6ce..4213985 100644 --- a/examples/artist_albums.py +++ b/examples/artist_albums.py @@ -20,7 +20,7 @@ def show_artist_albums(artist): results = sp.next(results) albums.extend(results['items']) seen = set() # to avoid dups - albums.sort(key=lambda album:album['name'].lower()) + albums.sort(key=lambda album: album['name'].lower()) for album in albums: name = album['name'] if name not in seen: diff --git a/examples/audio_analysis_for_track.py b/examples/audio_analysis_for_track.py index 39e8347..1f728a5 100644 --- a/examples/audio_analysis_for_track.py +++ b/examples/audio_analysis_for_track.py @@ -20,4 +20,4 @@ start = time.time() analysis = sp.audio_analysis(tid) delta = time.time() - start print(json.dumps(analysis, indent=4)) -print ("analysis retrieved in %.2f seconds" % (delta,)) +print("analysis retrieved in %.2f seconds" % (delta,)) diff --git a/examples/audio_features.py b/examples/audio_features.py index 079f4f9..989c852 100644 --- a/examples/audio_features.py +++ b/examples/audio_features.py @@ -33,4 +33,4 @@ for feature in features: analysis = sp._get(feature['analysis_url']) print(json.dumps(analysis, indent=4)) print() -print ("features retrieved in %.2f seconds" % (delta,)) +print("features retrieved in %.2f seconds" % (delta,)) diff --git a/examples/audio_features_for_track.py b/examples/audio_features_for_track.py index cdc980a..0565298 100644 --- a/examples/audio_features_for_track.py +++ b/examples/audio_features_for_track.py @@ -22,4 +22,4 @@ if len(sys.argv) > 1: features = sp.audio_features(tids) delta = time.time() - start print(json.dumps(features, indent=4)) - print ("features retrieved in %.2f seconds" % (delta,)) + print("features retrieved in %.2f seconds" % (delta,)) diff --git a/examples/change_playlist_details.py b/examples/change_playlist_details.py index 621f5d0..42044aa 100644 --- a/examples/change_playlist_details.py +++ b/examples/change_playlist_details.py @@ -24,7 +24,7 @@ if len(sys.argv) > 3: description = sys.argv[6] else: - print ("Usage: %s username playlist_id name [public collaborative " + print("Usage: %s username playlist_id name [public collaborative " "description]" % (sys.argv[0])) sys.exit() diff --git a/examples/errors.py b/examples/errors.py index 36bcaf9..546fcb4 100644 --- a/examples/errors.py +++ b/examples/errors.py @@ -9,12 +9,12 @@ client_credentials_manager = SpotifyClientCredentials() sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) sp.trace=True try: - print ('bad call 0') + print('bad call 0') bad_artist_call = sp.artist('spotify:artist:12341234') except spotipy.client.SpotifyException: - print ('bad call 0 exception' ) + print('bad call 0 exception') -print ('bad call 1') +print('bad call 1') bad_artist_call = sp.artist('spotify:artist:12341234') -print ('bad artist', bad_artist_call) +print('bad artist', bad_artist_call) diff --git a/examples/remove_specific_tracks_from_playlist.py b/examples/remove_specific_tracks_from_playlist.py index a99dc94..5821f0e 100644 --- a/examples/remove_specific_tracks_from_playlist.py +++ b/examples/remove_specific_tracks_from_playlist.py @@ -11,10 +11,10 @@ if len(sys.argv) > 3: username = sys.argv[1] playlist_id = sys.argv[2] track_ids_and_positions = sys.argv[3:] - track_ids = [ ] + track_ids = [] for t_pos in sys.argv[3:]: tid, pos = t_pos.split(',') - track_ids.append( { "uri" : tid, "positions": [ int(pos)] } ) + track_ids.append({"uri": tid, "positions": [int(pos)]}) else: print("Usage: %s username playlist_id track_id,pos track_id,pos ..." % (sys.argv[0],)) sys.exit() diff --git a/examples/show_new_releases.py b/examples/show_new_releases.py index c728eee..d4bd5fa 100644 --- a/examples/show_new_releases.py +++ b/examples/show_new_releases.py @@ -21,7 +21,7 @@ if token: while response: albums = response['albums'] for i, item in enumerate(albums['items']): - print(albums['offset'] + i,item['name']) + print(albums['offset'] + i, item['name']) if albums['next']: response = sp.next(albums) diff --git a/examples/user_starred_playlist.py b/examples/user_starred_playlist.py index 914344a..645384c 100644 --- a/examples/user_starred_playlist.py +++ b/examples/user_starred_playlist.py @@ -23,7 +23,7 @@ if token: while tracks: for item in tracks['items']: track = item['track'] - print(which, track['name' ], ' --', track['artists'][0]['name']) + print(which, track['name'], ' --', track['artists'][0]['name']) which += 1 tracks = sp.next(tracks)