From 816c7e47942c15b0ca35276fad8d23d33100798e Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sat, 19 Dec 2020 21:36:08 +0000 Subject: New version of black moved the cheese :-( --- pandora/clientbuilder.py | 3 +-- pandora/errors.py | 5 ++++- pandora/models/_base.py | 9 +++------ pydora/audio_backend.py | 39 ++++++++++++------------------------ pydora/configure.py | 3 +-- pydora/player.py | 21 +++++++------------ pydora/utils.py | 3 +-- tests/test_pandora/test_client.py | 4 +++- tests/test_pandora/test_models.py | 11 ++++++++-- tests/test_pandora/test_transport.py | 5 ++++- 10 files changed, 46 insertions(+), 57 deletions(-) diff --git a/pandora/clientbuilder.py b/pandora/clientbuilder.py index 2b11ffb..5adebd1 100644 --- a/pandora/clientbuilder.py +++ b/pandora/clientbuilder.py @@ -226,8 +226,7 @@ class PydoraConfigFileBuilder(FileBasedClientBuilder): class PianobarSettingsDict(TranslatingDict): - """Pianobar Translating Dictionary - """ + """Pianobar Translating Dictionary""" KEY_TRANSLATIONS = { "DECRYPT_PASSWORD": "DECRYPTION_KEY", diff --git a/pandora/errors.py b/pandora/errors.py index 3b03db2..f240e0f 100644 --- a/pandora/errors.py +++ b/pandora/errors.py @@ -89,7 +89,10 @@ class PandoraException(Exception): exception = type( name, (PandoraException,), - {"code": code, "message": api_message,}, + { + "code": code, + "message": api_message, + }, ) export_to[name] = __API_EXCEPTIONS__[code] = exception diff --git a/pandora/models/_base.py b/pandora/models/_base.py index 8904be1..c39050b 100644 --- a/pandora/models/_base.py +++ b/pandora/models/_base.py @@ -98,8 +98,7 @@ class PandoraModel(metaclass=ModelMetaClass): @classmethod def from_json_list(cls, api_client, data): - """Convert a list of JSON values to a list of models - """ + """Convert a list of JSON values to a list of models""" return [cls.from_json(api_client, item) for item in data] def __init__(self, api_client): @@ -147,15 +146,13 @@ class PandoraModel(metaclass=ModelMetaClass): @classmethod def from_json(cls, api_client, data): - """Convert one JSON value to a model object - """ + """Convert one JSON value to a model object""" self = cls(api_client) PandoraModel.populate_fields(api_client, self, data) return self def _base_repr(self, and_also=None): - """Common repr logic for subclasses to hook - """ + """Common repr logic for subclasses to hook""" items = [ "=".join((key, repr(getattr(self, key)))) for key in sorted(self._fields.keys()) diff --git a/pydora/audio_backend.py b/pydora/audio_backend.py index aecd87e..1186d93 100644 --- a/pydora/audio_backend.py +++ b/pydora/audio_backend.py @@ -13,22 +13,19 @@ log = logging.getLogger("pydora.audio_backend") class PlayerException(Exception): - """Base class for all player exceptions - """ + """Base class for all player exceptions""" pass class UnsupportedEncoding(PlayerException): - """Song encoding is not supported by player backend - """ + """Song encoding is not supported by player backend""" pass class PlayerUnusable(PlayerException): - """Player can not be used on this system - """ + """Player can not be used on this system""" pass @@ -67,13 +64,11 @@ class BasePlayer: raise NotImplementedError def _load_track(self, song): - """Load a track into the audio backend by song model - """ + """Load a track into the audio backend by song model""" raise NotImplementedError def _player_stopped(self, value): - """Determine if player has stopped - """ + """Determine if player has stopped""" raise NotImplementedError def raise_volume(self): @@ -93,13 +88,11 @@ class BasePlayer: raise NotImplementedError def _post_start(self): - """Optionally, do something after the audio backend is started - """ + """Optionally, do something after the audio backend is started""" return def _loop_hook(self): - """Optionally, do something each main loop iteration - """ + """Optionally, do something each main loop iteration""" return def _read_from_process(self, handle): @@ -111,19 +104,16 @@ class BasePlayer: return handle.readline().strip() def _send_cmd(self, cmd): - """Write command to remote process - """ + """Write command to remote process""" self._process.stdin.write("{}\n".format(cmd).encode("utf-8")) self._process.stdin.flush() def stop(self): - """Stop the currently playing song - """ + """Stop the currently playing song""" self._send_cmd("stop") def pause(self): - """Pause the player - """ + """Pause the player""" self._send_cmd("pause") def __del__(self): @@ -138,8 +128,7 @@ class BasePlayer: self._ensure_started() def _ensure_started(self): - """Ensure player backing process is started - """ + """Ensure player backing process is started""" if self._process and self._process.poll() is None: return @@ -189,8 +178,7 @@ class BasePlayer: self._callbacks.post_poll() def end_station(self): - """Stop playing the station - """ + """Stop playing the station""" raise StopIteration def play_station(self, station): @@ -208,8 +196,7 @@ class BasePlayer: class MPG123Player(BasePlayer): - """Player Backend Using mpg123 - """ + """Player Backend Using mpg123""" def __init__(self, callbacks, control_channel): super().__init__(callbacks, control_channel) diff --git a/pydora/configure.py b/pydora/configure.py index d58d445..1124746 100644 --- a/pydora/configure.py +++ b/pydora/configure.py @@ -11,8 +11,7 @@ from .utils import Screen, Colors class Umask: - """Set/Restore Umask Context Manager - """ + """Set/Restore Umask Context Manager""" def __init__(self, umask): self.umask = umask diff --git a/pydora/player.py b/pydora/player.py index c4ce2e0..18209b1 100644 --- a/pydora/player.py +++ b/pydora/player.py @@ -26,23 +26,19 @@ class PlayerCallbacks: """ def play(self, song): - """Called once when a song starts playing - """ + """Called once when a song starts playing""" pass def pre_poll(self): - """Called before polling for process status - """ + """Called before polling for process status""" pass def post_poll(self): - """Called after polling for process status - """ + """Called after polling for process status""" pass def input(self, value, song): - """Called after user input during song playback - """ + """Called after user input during song playback""" pass @@ -113,8 +109,7 @@ class PlayerApp: sys.exit(1) def station_selection_menu(self, error=None): - """Format a station menu and make the user select a station - """ + """Format a station menu and make the user select a station""" self.screen.clear() if error: @@ -127,8 +122,7 @@ class PlayerApp: return self.stations[self.screen.get_integer("Station: ")] def play(self, song): - """Play callback - """ + """Play callback""" if song.is_ad: print("{} ".format(Colors.cyan("Advertisement"))) else: @@ -231,8 +225,7 @@ class PlayerApp: print("") def input(self, input, song): - """Input callback, handles key presses - """ + """Input callback, handles key presses""" try: cmd = getattr(self, self.CMD_MAP[input][1]) except (IndexError, KeyError): diff --git a/pydora/utils.py b/pydora/utils.py index 5a96ff1..b38fb5b 100644 --- a/pydora/utils.py +++ b/pydora/utils.py @@ -194,8 +194,7 @@ def iterate_forever(func, *args, **kwargs): class SilentPopen(subprocess.Popen): - """A Popen varient that dumps it's output and error - """ + """A Popen varient that dumps it's output and error""" def __init__(self, *args, **kwargs): self._dev_null = open(os.devnull, "w") diff --git a/tests/test_pandora/test_client.py b/tests/test_pandora/test_client.py index 4262d34..7d3e7bd 100644 --- a/tests/test_pandora/test_client.py +++ b/tests/test_pandora/test_client.py @@ -203,7 +203,9 @@ class TestCreatingStation(TestCase): class TestCreatingGenreStation(TestCase): def test_has_initial_checksum(self): fake_data = { - "categories": [{"categoryName": "foo", "stations": []},], + "categories": [ + {"categoryName": "foo", "stations": []}, + ], # Not actually part of the genre station response but is needed to # fake out the mock for get_genre_stations_checksum "checksum": "foo", diff --git a/tests/test_pandora/test_models.py b/tests/test_pandora/test_models.py index a155588..11f9f6a 100644 --- a/tests/test_pandora/test_models.py +++ b/tests/test_pandora/test_models.py @@ -64,7 +64,12 @@ class TestAdditionalUrlField(TestCase): self.assertEqual(ret, {"foo": "test"}) def test_multiple_urls(self): - dummy_data = {"_paramAdditionalUrls": ["abc", "def",]} + dummy_data = { + "_paramAdditionalUrls": [ + "abc", + "def", + ] + } field = plm.AdditionalUrlField("additionalAudioUrl") @@ -708,7 +713,9 @@ class TestGenreStationList(TestCase): TEST_DATA = { "checksum": "bar", - "categories": [{"categoryName": "foo", "stations": []},], + "categories": [ + {"categoryName": "foo", "stations": []}, + ], } def test_has_changed(self): diff --git a/tests/test_pandora/test_transport.py b/tests/test_pandora/test_transport.py index 28ca6b2..ac32acf 100644 --- a/tests/test_pandora/test_transport.py +++ b/tests/test_pandora/test_transport.py @@ -118,7 +118,10 @@ class TestTransportSetters(TestCase): def test_set_user(self): self.transport.set_user( - {"userId": "user", "userAuthToken": "auth",} + { + "userId": "user", + "userAuthToken": "auth", + } ) self.assertEqual("user", self.transport.user_id) -- cgit v1.2.3