Skip to content

Commit d3dfeb9

Browse files
committed
🎨 fmt with autopep8
1 parent 4184bdf commit d3dfeb9

3 files changed

Lines changed: 24 additions & 13 deletions

File tree

src/badapple/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929

3030
parser.add_argument(
3131
'-i', '--input',
32-
help='video file (use _BADAPPLE_MP4 or _BADAPPLE_BADAPPLE to load built-in video)',
32+
help='video file ' +
33+
'(use _BADAPPLE_MP4 or _BADAPPLE_BADAPPLE to load built-in video)',
3334
default=D_MP4
3435
)
3536
parser.add_argument(
@@ -45,7 +46,8 @@
4546
)
4647
parser.add_argument(
4748
'--audio',
48-
help='audio file (use _BADAPPLE_MP3 or _BADAPPLE_WAV to load built-in audio)',
49+
help='audio file ' +
50+
'(use _BADAPPLE_MP3 or _BADAPPLE_WAV to load built-in audio)',
4951
default=''
5052
)
5153
parser.add_argument(
@@ -111,8 +113,8 @@
111113

112114
p_list: list[Process] = list()
113115

114-
video=D_FILES.get(a.input, a.input)
115-
audio=D_FILES.get(a.audio, a.audio)
116+
video = D_FILES.get(a.input, a.input)
117+
audio = D_FILES.get(a.audio, a.audio)
116118

117119
try:
118120
play(

src/badapple/audio.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88

99

1010
def help_audio() -> None:
11-
l = get_players()
12-
r = get_availables()
11+
players = get_players()
12+
availables = get_availables()
1313
s = 'usage: badapple --audio_player AUDIO_PLAYER [options] ... \n\n'
1414
s += get_info() + '\n\navailable AUDIO_PLAYER:\n'
15-
for i in l:
16-
s += ' ' + i + ' '*(14-len(i)) + (' ' if i in r else 'un') + 'available\n'
15+
for i in players:
16+
s += ' ' + i
17+
s += ' '*(14-len(i))
18+
s += ' ' if i in availables else 'un'
19+
s += 'available\n'
1720
print(s)
1821

1922

src/badapple/players.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def which(program: str) -> str:
2121
__AVPLAY = 'avplay' # all
2222
__MPV = 'mpv'
2323
__VLC = 'vlc'
24-
__MPG123 = 'mpg123' # mp3
24+
__MPG123 = 'mpg123' # mp3
2525
__CMUS = 'cmus'
2626
__SIMPLEAUDIO = 'simpleaudio' # wav
2727
__PYAUDIO = 'pyaudio' # wav
@@ -64,7 +64,9 @@ def which(program: str) -> str:
6464
player_play = dict()
6565

6666

67-
def reg_check(player: str) -> Callable[[Callable[[], bool]], Callable[[], bool]]:
67+
def reg_check(
68+
player: str
69+
) -> Callable[[Callable[[], bool]], Callable[[], bool]]:
6870
def __get_f(f: Callable[[], bool]) -> Callable[[], bool]:
6971
if player not in __PLAYERS_AND_AUTO:
7072
raise ValueError(player)
@@ -75,7 +77,9 @@ def __get_f(f: Callable[[], bool]) -> Callable[[], bool]:
7577
return __get_f
7678

7779

78-
def reg_play(player: str) -> Callable[[Callable[[], bool]], Callable[[], bool]]:
80+
def reg_play(
81+
player: str
82+
) -> Callable[[Callable[[], bool]], Callable[[], bool]]:
7983
def __get_f(f: Callable[[str], None]) -> Callable[[str], None]:
8084
if player not in __PLAYERS_AND_AUTO:
8185
raise ValueError(player)
@@ -274,6 +278,7 @@ def play_pydub(audio: str) -> None:
274278
def check_auto() -> bool:
275279
return True
276280

281+
277282
@reg_play(__AUTO)
278283
def play_auto(audio: str) -> None:
279284
for i in __PLAYERS:
@@ -297,11 +302,13 @@ def is_player(player: str) -> bool:
297302

298303

299304
def is_available(player: str) -> bool:
300-
return player_check.get(realias(player), lambda:False)()
305+
return player_check.get(realias(player), lambda: False)()
306+
301307

302308
def get_players() -> list:
303309
return __PLAYERS_AND_AUTO.copy()
304310

311+
305312
def get_availables() -> list:
306313
return [i for i in __PLAYERS_AND_AUTO if is_available(i)]
307314

@@ -318,4 +325,3 @@ def playa(audio: str, player: str) -> None:
318325
assert len(__PLAYERS_AND_AUTO) == len(ALIAS)
319326
assert len(__PLAYERS_AND_AUTO) == len(player_check)
320327
assert len(__PLAYERS_AND_AUTO) == len(player_play)
321-

0 commit comments

Comments
 (0)