ruff: pyupgrade
This commit is contained in:
parent
6a3924dbf0
commit
b87c783d45
4 changed files with 7 additions and 6 deletions
|
|
@ -56,6 +56,7 @@ line-length = 110
|
|||
ignore = [ "F403", "F405", "F821", "E731" ]
|
||||
extend-select = [
|
||||
"I", # isort
|
||||
"UP", # pyupgrade
|
||||
]
|
||||
|
||||
[tool.mypy]
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class TestOAuth:
|
|||
assert Path(oauth_filepath).exists()
|
||||
|
||||
json_mock.side_effect = None
|
||||
with open(oauth_filepath, mode="r", encoding="utf8") as oauth_file:
|
||||
with open(oauth_filepath, encoding="utf8") as oauth_file:
|
||||
oauth_token = json.loads(oauth_file.read())
|
||||
|
||||
assert oauth_token["expires_at"] != 0
|
||||
|
|
@ -67,7 +67,7 @@ class TestOAuth:
|
|||
assert yt_oauth._token is not None
|
||||
|
||||
# set reference file
|
||||
with open(oauth_filepath, "r") as f:
|
||||
with open(oauth_filepath) as f:
|
||||
first_json = json.load(f)
|
||||
|
||||
# pull reference values from underlying token
|
||||
|
|
@ -89,7 +89,7 @@ class TestOAuth:
|
|||
# check token is propagating properly
|
||||
assert second_token == second_token_inner
|
||||
|
||||
with open(oauth_filepath, "r") as f2:
|
||||
with open(oauth_filepath) as f2:
|
||||
second_json = json.load(f2)
|
||||
|
||||
# ensure token is updating local file
|
||||
|
|
@ -100,7 +100,7 @@ class TestOAuth:
|
|||
):
|
||||
# ensure client works/ignores alt if browser credentials passed as auth
|
||||
assert yt_alt_oauth.auth_type != AuthType.OAUTH_CUSTOM_CLIENT
|
||||
with open(oauth_filepath, "r") as f:
|
||||
with open(oauth_filepath) as f:
|
||||
token_dict = json.load(f)
|
||||
# oauth token dict entry and alt
|
||||
yt_alt_oauth = YTMusic(token_dict, oauth_credentials=alt_oauth_credentials)
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ class BrowsingMixin(MixinProtocol):
|
|||
|
||||
for artist in artists:
|
||||
if artist not in taste_profile:
|
||||
raise Exception("The artist, {}, was not present in taste!".format(artist))
|
||||
raise Exception(f"The artist, {artist}, was not present in taste!")
|
||||
formData["selectedValues"].append(taste_profile[artist]["selectionValue"])
|
||||
|
||||
body = {"browseId": "FEmusic_home", "formData": formData}
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ class LibraryMixin(MixinProtocol):
|
|||
"""
|
||||
url = song["playbackTracking"]["videostatsPlaybackUrl"]["baseUrl"]
|
||||
CPNA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
|
||||
cpn = "".join((CPNA[randint(0, 256) & 63] for _ in range(0, 16)))
|
||||
cpn = "".join(CPNA[randint(0, 256) & 63] for _ in range(0, 16))
|
||||
params = {"ver": 2, "c": "WEB_REMIX", "cpn": cpn}
|
||||
return self._send_get_request(url, params)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue