Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kingosticks committed Sep 25, 2024
1 parent 3d90a23 commit d1317cb
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/mopidy_spotify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def get_default_config(self):
def get_config_schema(self):
schema = super().get_config_schema()

schema["username"] = config.Deprecated() # since 5.0
schema["password"] = config.Deprecated() # since 5.0
schema["username"] = config.Deprecated() # since 5.0
schema["password"] = config.Deprecated() # since 5.0

schema["client_id"] = config.String()
schema["client_secret"] = config.Secret()
Expand Down
6 changes: 3 additions & 3 deletions src/mopidy_spotify/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def token(self):
try:
if self._should_refresh_token():
self._refresh_token()
logger.info(f"Providing access token: {self._access_token}")
return self._access_token
except OAuthTokenRefreshError as e:
logger.error(e) # noqa: TRY400
return None

Check warning on line 80 in src/mopidy_spotify/web.py

View check run for this annotation

Codecov / codecov/patch

src/mopidy_spotify/web.py#L74-L80

Added lines #L74 - L80 were not covered by tests
else:
return self._access_token

Check warning on line 82 in src/mopidy_spotify/web.py

View check run for this annotation

Codecov / codecov/patch

src/mopidy_spotify/web.py#L82

Added line #L82 was not covered by tests

def get(self, path, cache=None, *args, **kwargs):
if self._authorization_failed:
Expand Down Expand Up @@ -161,7 +161,7 @@ def _refresh_token(self):
f"wrong token_type: {result.get('token_type')}"
)

self._access_token = result['access_token']
self._access_token = result["access_token"]
self._headers["Authorization"] = f"Bearer {self._access_token}"
self._expires = time.time() + result.get("expires_in", float("Inf"))

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
from mopidy import backend as backend_api
from mopidy import models

from mopidy_spotify import backend, library, utils, web


Expand Down
2 changes: 1 addition & 1 deletion tests/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from unittest import mock, skip

from mopidy import backend as backend_api

from mopidy_spotify import backend, library, playlists
from mopidy_spotify.backend import SpotifyPlaybackProvider

from tests import ThreadJoiner


Expand Down
1 change: 1 addition & 0 deletions tests/test_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from mopidy import models

from mopidy_spotify.browse import BROWSE_DIR_URIS


Expand Down
1 change: 1 addition & 0 deletions tests/test_distinct.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from mopidy import models

from mopidy_spotify import distinct, playlists, search


Expand Down
1 change: 1 addition & 0 deletions tests/test_images.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from mopidy import models

from mopidy_spotify import images
from mopidy_spotify.web import LinkType, WebLink

Expand Down
1 change: 1 addition & 0 deletions tests/test_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import mopidy
import pytest

from mopidy_spotify import lookup


Expand Down
1 change: 1 addition & 0 deletions tests/test_playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
from mopidy import audio
from mopidy import backend as backend_api

from mopidy_spotify import backend, web


Expand Down
2 changes: 1 addition & 1 deletion tests/test_playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
from mopidy import backend as backend_api
from mopidy.models import Ref
from mopidy_spotify import playlists

from mopidy_spotify import playlists
from tests import ThreadJoiner


Expand Down
1 change: 1 addition & 0 deletions tests/test_search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from mopidy import models

from mopidy_spotify import lookup, search, translator


Expand Down
1 change: 1 addition & 0 deletions tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest
from mopidy import models

from mopidy_spotify import translator


Expand Down
5 changes: 3 additions & 2 deletions tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from datetime import UTC, datetime
from unittest import mock

import mopidy_spotify
import pytest
import requests
import responses
from mopidy_spotify import web
from responses import matchers

import mopidy_spotify
from mopidy_spotify import web


@pytest.fixture()
def oauth_client(config):
Expand Down

0 comments on commit d1317cb

Please sign in to comment.