aboutsummaryrefslogtreecommitdiff
path: root/pydora
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2019-04-07 18:17:11 +0300
committerMike Crute <crutem@amazon.com>2019-04-07 10:11:23 -0700
commit6b7990a3de49ebf9483a70003a20dd6636e8c000 (patch)
tree7fa4c6eefe49067588d5cef3640cf12bba9cf90e /pydora
parent5087590bff74bb5bb71c9ae6c51bc6f27646a04b (diff)
downloadpydora-6b7990a3de49ebf9483a70003a20dd6636e8c000.tar.bz2
pydora-6b7990a3de49ebf9483a70003a20dd6636e8c000.tar.xz
pydora-6b7990a3de49ebf9483a70003a20dd6636e8c000.zip
Upgrade Python syntax with pyupgrade --py3-plus
Diffstat (limited to 'pydora')
-rw-r--r--pydora/audio_backend.py8
-rw-r--r--pydora/configure.py6
-rw-r--r--pydora/player.py12
-rw-r--r--pydora/utils.py16
4 files changed, 21 insertions, 21 deletions
diff --git a/pydora/audio_backend.py b/pydora/audio_backend.py
index d39bb9b..bd778ad 100644
--- a/pydora/audio_backend.py
+++ b/pydora/audio_backend.py
@@ -30,7 +30,7 @@ class PlayerUnusable(PlayerException):
30 pass 30 pass
31 31
32 32
33class BasePlayer(object): 33class BasePlayer:
34 """Audio Backend Process Manager 34 """Audio Backend Process Manager
35 35
36 Starts and owns a handle to an audio backend process then feeds commands to 36 Starts and owns a handle to an audio backend process then feeds commands to
@@ -208,7 +208,7 @@ class MPG123Player(BasePlayer):
208 """ 208 """
209 209
210 def __init__(self, callbacks, control_channel): 210 def __init__(self, callbacks, control_channel):
211 super(MPG123Player, self).__init__(callbacks, control_channel) 211 super().__init__(callbacks, control_channel)
212 self._cmd.extend(["-q", "-R", "--ignore-mime", "."]) 212 self._cmd.extend(["-q", "-R", "--ignore-mime", "."])
213 213
214 def _find_path(self): 214 def _find_path(self):
@@ -246,7 +246,7 @@ class VLCPlayer(BasePlayer):
246 VOL_STEPS = 5 246 VOL_STEPS = 5
247 247
248 def __init__(self, callbacks, control_channel): 248 def __init__(self, callbacks, control_channel):
249 super(VLCPlayer, self).__init__(callbacks, control_channel) 249 super().__init__(callbacks, control_channel)
250 self._cmd.extend(["-I", "rc", "--advanced", "--rc-fake-tty", "-q"]) 250 self._cmd.extend(["-I", "rc", "--advanced", "--rc-fake-tty", "-q"])
251 self._last_poll = 0 251 self._last_poll = 0
252 252
@@ -300,7 +300,7 @@ class RemoteVLC(VLCPlayer):
300 def __init__(self, host, port, callbacks, control_channel): 300 def __init__(self, host, port, callbacks, control_channel):
301 self._connect_to = (host, int(port)) 301 self._connect_to = (host, int(port))
302 self._control_sock = None 302 self._control_sock = None
303 super(RemoteVLC, self).__init__(callbacks, control_channel) 303 super().__init__(callbacks, control_channel)
304 304
305 def _get_select_readers(self): 305 def _get_select_readers(self):
306 return [self._control_channel, self._control_sock] 306 return [self._control_channel, self._control_sock]
diff --git a/pydora/configure.py b/pydora/configure.py
index 7c051df..d31c097 100644
--- a/pydora/configure.py
+++ b/pydora/configure.py
@@ -10,7 +10,7 @@ from pandora.clientbuilder import PydoraConfigFileBuilder
10from .utils import Screen, Colors 10from .utils import Screen, Colors
11 11
12 12
13class Umask(object): 13class Umask:
14 """Set/Restore Umask Context Manager 14 """Set/Restore Umask Context Manager
15 """ 15 """
16 16
@@ -25,7 +25,7 @@ class Umask(object):
25 os.umask(self.old_umask) 25 os.umask(self.old_umask)
26 26
27 27
28class PandoraKeysConfigParser(object): 28class PandoraKeysConfigParser:
29 """Parser for Pandora Keys Source Page 29 """Parser for Pandora Keys Source Page
30 30
31 This is an extremely naive restructured text parser designed only to parse 31 This is an extremely naive restructured text parser designed only to parse
@@ -97,7 +97,7 @@ class PandoraKeysConfigParser(object):
97 return partners 97 return partners
98 98
99 99
100class Configurator(object): 100class Configurator:
101 """Interactive Configuration Builder 101 """Interactive Configuration Builder
102 102
103 Allows a user to configure pydora interactively. Ultimately writes the 103 Allows a user to configure pydora interactively. Ultimately writes the
diff --git a/pydora/player.py b/pydora/player.py
index 74b6110..fdacc63 100644
--- a/pydora/player.py
+++ b/pydora/player.py
@@ -18,7 +18,7 @@ from .audio_backend import MPG123Player, VLCPlayer
18from .audio_backend import UnsupportedEncoding, PlayerUnusable 18from .audio_backend import UnsupportedEncoding, PlayerUnusable
19 19
20 20
21class PlayerCallbacks(object): 21class PlayerCallbacks:
22 """Interface for Player Callbacks 22 """Interface for Player Callbacks
23 23
24 This class simply exists to document the interface for callback 24 This class simply exists to document the interface for callback
@@ -46,7 +46,7 @@ class PlayerCallbacks(object):
46 pass 46 pass
47 47
48 48
49class PlayerApp(object): 49class PlayerApp:
50 50
51 CMD_MAP = { 51 CMD_MAP = {
52 "n": ("play next song", "skip_song"), 52 "n": ("play next song", "skip_song"),
@@ -122,7 +122,7 @@ class PlayerApp(object):
122 122
123 for i, station in enumerate(self.stations): 123 for i, station in enumerate(self.stations):
124 i = "{:>3}".format(i) 124 i = "{:>3}".format(i)
125 print(u"{}: {}".format(Colors.yellow(i), station.name)) 125 print("{}: {}".format(Colors.yellow(i), station.name))
126 126
127 return self.stations[self.screen.get_integer("Station: ")] 127 return self.stations[self.screen.get_integer("Station: ")]
128 128
@@ -130,10 +130,10 @@ class PlayerApp(object):
130 """Play callback 130 """Play callback
131 """ 131 """
132 if song.is_ad: 132 if song.is_ad:
133 print(u"{} ".format(Colors.cyan("Advertisement"))) 133 print("{} ".format(Colors.cyan("Advertisement")))
134 else: 134 else:
135 print(u"{} by {}".format(Colors.cyan(song.song_name), 135 print("{} by {}".format(Colors.cyan(song.song_name),
136 Colors.yellow(song.artist_name))) 136 Colors.yellow(song.artist_name)))
137 137
138 def skip_song(self, song): 138 def skip_song(self, song):
139 if song.is_ad: 139 if song.is_ad:
diff --git a/pydora/utils.py b/pydora/utils.py
index ca40095..6675773 100644
--- a/pydora/utils.py
+++ b/pydora/utils.py
@@ -13,15 +13,15 @@ class TerminalPlatformUnsupported(Exception):
13 pass 13 pass
14 14
15 15
16class Colors(object): 16class Colors:
17 17
18 def __wrap_with(raw_code): 18 def __wrap_with(raw_code):
19 @staticmethod 19 @staticmethod
20 def inner(text, bold=False): 20 def inner(text, bold=False):
21 code = raw_code 21 code = raw_code
22 if bold: 22 if bold:
23 code = u"1;{}".format(code) 23 code = "1;{}".format(code)
24 return u"\033[{}m{}\033[0m".format(code, text) 24 return "\033[{}m{}\033[0m".format(code, text)
25 return inner 25 return inner
26 26
27 red = __wrap_with("31") 27 red = __wrap_with("31")
@@ -33,7 +33,7 @@ class Colors(object):
33 white = __wrap_with("37") 33 white = __wrap_with("37")
34 34
35 35
36class PosixEchoControl(object): 36class PosixEchoControl:
37 """Posix Console Echo Control Driver 37 """Posix Console Echo Control Driver
38 38
39 Uses termios on POSIX compliant platforms to control console echo. Is not 39 Uses termios on POSIX compliant platforms to control console echo. Is not
@@ -63,7 +63,7 @@ class PosixEchoControl(object):
63 self.termios.tcsetattr(handle, self.termios.TCSANOW, attrs) 63 self.termios.tcsetattr(handle, self.termios.TCSANOW, attrs)
64 64
65 65
66class Win32EchoControl(object): 66class Win32EchoControl:
67 """Windows Console Echo Control Driver 67 """Windows Console Echo Control Driver
68 68
69 This uses the console API from WinCon.h and ctypes to control console echo 69 This uses the console API from WinCon.h and ctypes to control console echo
@@ -109,7 +109,7 @@ class Win32EchoControl(object):
109 self._SetConsoleMode(stdin, mode & self.DISABLE_ECHO_INPUT) 109 self._SetConsoleMode(stdin, mode & self.DISABLE_ECHO_INPUT)
110 110
111 111
112class Screen(object): 112class Screen:
113 113
114 def __init__(self): 114 def __init__(self):
115 try: 115 try:
@@ -201,8 +201,8 @@ class SilentPopen(subprocess.Popen):
201 kwargs["stdin"] = subprocess.PIPE 201 kwargs["stdin"] = subprocess.PIPE
202 kwargs["stdout"] = subprocess.PIPE 202 kwargs["stdout"] = subprocess.PIPE
203 kwargs["stderr"] = self._dev_null 203 kwargs["stderr"] = self._dev_null
204 super(SilentPopen, self).__init__(*args, **kwargs) 204 super().__init__(*args, **kwargs)
205 205
206 def __del__(self): 206 def __del__(self):
207 self._dev_null.close() 207 self._dev_null.close()
208 super(SilentPopen, self).__del__() 208 super().__del__()