Skip to content

Commit a97cf94

Browse files
chore: fix inconsistent indentation across multiple files
Standardize code indentation to improve readability and maintain uniform style. Changes include aligning parameters, fixing spacing issues, and cleaning unnecessary blank lines or comments. No functional logic was modified.
1 parent e8d824e commit a97cf94

File tree

11 files changed

+72
-71
lines changed

11 files changed

+72
-71
lines changed

WinxMusic/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import importlib
2-
import sys
32

43
from pyrogram import idle
54
from pytgcalls.exceptions import NoActiveGroupCall

WinxMusic/core/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ async def _set_default_commands(self):
175175
LOG_GROUP_ID = (
176176
f"@{config.LOG_GROUP_ID}"
177177
if isinstance(config.LOG_GROUP_ID, str)
178-
and not config.LOG_GROUP_ID.startswith("@")
178+
and not config.LOG_GROUP_ID.startswith("@")
179179
else config.LOG_GROUP_ID
180180
)
181181

WinxMusic/core/call.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ async def force_stop_stream(self, chat_id: int):
110110
pass
111111

112112
async def skip_stream(
113-
self,
114-
chat_id: int,
115-
link: str,
116-
video: Union[bool, str] = None,
117-
image: Union[bool, str] = None,
113+
self,
114+
chat_id: int,
115+
link: str,
116+
video: Union[bool, str] = None,
117+
image: Union[bool, str] = None,
118118
):
119119
assistant = await group_assistant(self, chat_id)
120120
audio_stream_quality = await get_audio_bitrate(chat_id)
@@ -250,12 +250,12 @@ async def join_chat(self, chat_id, attempts=1):
250250
raise AssistantErr(_["call_3"].format(type(e).__name__))
251251

252252
async def join_call(
253-
self,
254-
chat_id: int,
255-
original_chat_id: int,
256-
link,
257-
video: Union[bool, str] = None,
258-
image: Union[bool, str] = None,
253+
self,
254+
chat_id: int,
255+
original_chat_id: int,
256+
link,
257+
video: Union[bool, str] = None,
258+
image: Union[bool, str] = None,
259259
):
260260
assistant = await group_assistant(self, chat_id)
261261
audio_stream_quality = await get_audio_bitrate(chat_id)

WinxMusic/platforms/AnimeZey.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(self):
4949
self.session: Optional[aiohttp.ClientSession] = None
5050
self.session_headers: Dict[str, str] = {
5151
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) "
52-
"Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0",
52+
"Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0",
5353
"Content-Type": "application/json",
5454
}
5555
self.timeout: int = 60
@@ -61,12 +61,12 @@ async def _get_session(self) -> aiohttp.ClientSession:
6161
return self.session
6262

6363
async def request(
64-
self, endpoint: str, method: str, data: Optional[Dict[str, Any]] = None
64+
self, endpoint: str, method: str, data: Optional[Dict[str, Any]] = None
6565
) -> Union[Dict[str, Any], str, None]:
6666
session = await self._get_session()
6767
try:
6868
async with session.request(
69-
method, f"{self.base_url}{endpoint}", json=data
69+
method, f"{self.base_url}{endpoint}", json=data
7070
) as response:
7171
response.raise_for_status()
7272
content_type = response.headers.get("Content-Type", "")
@@ -83,14 +83,14 @@ async def request(
8383
return None
8484

8585
async def search_anime(
86-
self, query: str, page_token: Optional[str] = None
86+
self, query: str, page_token: Optional[str] = None
8787
) -> Union[Dict[str, Any], str, None]:
8888
return await self.request(
8989
"/0:search", "POST", {"q": query, "page_token": page_token, "page_index": 0}
9090
)
9191

9292
async def search_movie(
93-
self, query: str, page_token: Optional[str] = None
93+
self, query: str, page_token: Optional[str] = None
9494
) -> Optional[SearchMovieResponse]:
9595
response: Union[Dict[str, Any], str, None] = await self.request(
9696
"/1:search",

WinxMusic/platforms/Carbon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self):
7979

8080
async def generate(self, text: str, user_id):
8181
async with aiohttp.ClientSession(
82-
headers={"Content-Type": "application/json"},
82+
headers={"Content-Type": "application/json"},
8383
) as ses:
8484
params = {
8585
"code": text,

WinxMusic/platforms/Telegram.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self):
2828

2929
async def send_split_text(self, message, string):
3030
n = self.chars_limit
31-
out = [(string[i : i + n]) for i in range(0, len(string), n)]
31+
out = [(string[i: i + n]) for i in range(0, len(string), n)]
3232
j = 0
3333
for x in out:
3434
if j <= 2:
@@ -61,28 +61,28 @@ async def get_duration(self, file: Union[Video, Voice, Message]):
6161
return dur
6262

6363
async def get_filepath(
64-
self,
65-
audio: Union[Voice, Message, bool, str] = None,
66-
video: Union[Video, Message, bool, str] = None,
64+
self,
65+
audio: Union[Voice, Message, bool, str] = None,
66+
video: Union[Video, Message, bool, str] = None,
6767
):
6868
if audio:
6969
try:
7070
file_name = (
71-
audio.file_unique_id
72-
+ "."
73-
+ (
74-
(audio.file_name.split(".")[-1])
75-
if (not isinstance(audio, Voice))
76-
else "ogg"
77-
)
71+
audio.file_unique_id
72+
+ "."
73+
+ (
74+
(audio.file_name.split(".")[-1])
75+
if (not isinstance(audio, Voice))
76+
else "ogg"
77+
)
7878
)
7979
except Exception:
8080
file_name = audio.file_unique_id + "." + ".ogg"
8181
file_name = os.path.join(os.path.realpath("downloads"), file_name)
8282
if video:
8383
try:
8484
file_name = (
85-
video.file_unique_id + "." + (video.file_name.split(".")[-1])
85+
video.file_unique_id + "." + (video.file_name.split(".")[-1])
8686
)
8787
except Exception:
8888
file_name = video.file_unique_id + "." + "mp4"
@@ -96,20 +96,20 @@ async def is_streamable_url(self, url: str) -> bool:
9696
if response.status == 200:
9797
content_type = response.headers.get("Content-Type", "")
9898
if (
99-
"application/vnd.apple.mpegurl" in content_type
100-
or "application/x-mpegURL" in content_type
99+
"application/vnd.apple.mpegurl" in content_type
100+
or "application/x-mpegURL" in content_type
101101
):
102102
return True
103103
if any(
104-
keyword in content_type
105-
for keyword in [
106-
"audio",
107-
"video",
108-
"mp4",
109-
"mpegurl",
110-
"m3u8",
111-
"mpeg",
112-
]
104+
keyword in content_type
105+
for keyword in [
106+
"audio",
107+
"video",
108+
"mp4",
109+
"mpegurl",
110+
"m3u8",
111+
"mpeg",
112+
]
113113
):
114114
return True
115115
if url.endswith((".m3u8", ".index", ".mp4", ".mpeg", ".mpd")):

WinxMusic/plugins/extras/chat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ async def save_message_history(_, message: Message):
154154

155155
assistant = await get_assistant(message.chat.id)
156156
async for message in assistant.get_chat_history(message.chat.id, limit=100):
157-
if message.text and message.from_user.id != app.id and not message.text.startswith(tuple(PREFIXES)):
157+
if (
158+
message.text and
159+
message.from_user and
160+
message.from_user.id != app.id and
161+
not message.text.startswith(tuple(PREFIXES))
162+
):
158163
context["conversation_history"].append({
159164
"role": "user",
160165
"content": message.text,

WinxMusic/utils/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@
66
from .inline import *
77
from .pastebin import *
88
from .sys import *
9-
10-

WinxMusic/utils/cache/cache_manager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33

44

5-
65
class CacheManager:
76
def __init__(self, max_size=100, ttl=None):
87
"""
@@ -11,14 +10,14 @@ def __init__(self, max_size=100, ttl=None):
1110
:param max_size: Maximum number of items in the cache before removing the oldest (default 100).
1211
:param ttl: Time-to-live for items in the cache in seconds (default None, no expiration).
1312
"""
14-
#LOGGER(__name__).info(f"Initializing cache with max_size: {max_size} and ttl: {ttl}")
13+
# LOGGER(__name__).info(f"Initializing cache with max_size: {max_size} and ttl: {ttl}")
1514
self.cache = {}
1615
self.max_size = max_size
1716
self.ttl = ttl
1817
self.order = collections.OrderedDict() # To keep track of the insertion order
1918

2019
def set(self, key, value):
21-
#LOGGER(__name__).info(f"Setting cache key: {key}")
20+
# LOGGER(__name__).info(f"Setting cache key: {key}")
2221
current_time = time.time()
2322
if len(self.cache) >= self.max_size:
2423
# Evict the oldest item when the cache reaches its maximum size
@@ -28,7 +27,7 @@ def set(self, key, value):
2827
self.order[key] = current_time # Keeps track of insertion order
2928

3029
def get(self, key):
31-
#LOGGER(__name__).info(f"Getting cache key: {key}")
30+
# LOGGER(__name__).info(f"Getting cache key: {key}")
3231
current_time = time.time()
3332
if key in self.cache:
3433
item = self.cache[key]
@@ -42,13 +41,13 @@ def get(self, key):
4241
return None
4342

4443
def delete(self, key):
45-
#LOGGER(__name__).info(f"Deleting cache key: {key}")
44+
# LOGGER(__name__).info(f"Deleting cache key: {key}")
4645
if key in self.cache:
4746
del self.cache[key]
4847
del self.order[key]
4948

5049
def clear(self):
51-
#LOGGER(__name__).info("Clearing cache")
50+
# LOGGER(__name__).info("Clearing cache")
5251
self.cache.clear()
5352
self.order.clear()
5453

config/README.pt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ obrigatórias para que o bot funcione e ative as funcionalidades básicas.
2828
/set_video_limit no Telegram. Padrão para 3 chats.
2929
4. `SERVER_PLAYLIST_LIMIT`: Limite máximo para usuários salvarem playlists no servidor do bot. Padrão para 30.
3030
5. `PLAYLIST_FETCH_LIMIT`: Limite máximo para buscar faixas da playlist de links do YouTube, Spotify, Apple. Padrão para
31-
25.
31+
25.
3232
6. `CLEANMODE_MINS`: Tempo após o qual o bot apagará suas mensagens antigas dos chats. Padrão para 5 min.
3333
7. `SUPPORT_CHANNEL`: Se você tiver um canal para seu bot de música, insira o link do canal aqui.
3434
8. `SUPPORT_GROUP`: Se você tiver um grupo de suporte para o bot, insira o link do grupo aqui.

config/config.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246

247247
def time_to_seconds(time):
248248
stringt = str(time)
249-
return sum(int(x) * 60**i for i, x in enumerate(reversed(stringt.split(":"))))
249+
return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":"))))
250250

251251

252252
def seconds_to_time(seconds):
@@ -288,8 +288,8 @@ def seconds_to_time(seconds):
288288

289289
if PING_IMG_URL:
290290
if (
291-
PING_IMG_URL
292-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/ping_img.png"
291+
PING_IMG_URL
292+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/ping_img.png"
293293
):
294294
if not re.match("(?:http|https)://", PING_IMG_URL):
295295
print(
@@ -299,8 +299,8 @@ def seconds_to_time(seconds):
299299

300300
if PLAYLIST_IMG_URL:
301301
if (
302-
PLAYLIST_IMG_URL
303-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/playlist_img.png"
302+
PLAYLIST_IMG_URL
303+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/playlist_img.png"
304304
):
305305
if not re.match("(?:http|https)://", PLAYLIST_IMG_URL):
306306
print(
@@ -310,8 +310,8 @@ def seconds_to_time(seconds):
310310

311311
if GLOBAL_IMG_URL:
312312
if (
313-
GLOBAL_IMG_URL
314-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/global_stats_img.png"
313+
GLOBAL_IMG_URL
314+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/global_stats_img.png"
315315
):
316316
if not re.match("(?:http|https)://", GLOBAL_IMG_URL):
317317
print(
@@ -321,8 +321,8 @@ def seconds_to_time(seconds):
321321

322322
if STATS_IMG_URL:
323323
if (
324-
STATS_IMG_URL
325-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/stats_img.png"
324+
STATS_IMG_URL
325+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/stats_img.png"
326326
):
327327
if not re.match("(?:http|https)://", STATS_IMG_URL):
328328
print(
@@ -332,8 +332,8 @@ def seconds_to_time(seconds):
332332

333333
if TELEGRAM_AUDIO_URL:
334334
if (
335-
TELEGRAM_AUDIO_URL
336-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/telegram_audio_img.png"
335+
TELEGRAM_AUDIO_URL
336+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/telegram_audio_img.png"
337337
):
338338
if not re.match("(?:http|https)://", TELEGRAM_AUDIO_URL):
339339
print(
@@ -343,8 +343,8 @@ def seconds_to_time(seconds):
343343

344344
if STREAM_IMG_URL:
345345
if (
346-
STREAM_IMG_URL
347-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/stream_img.png"
346+
STREAM_IMG_URL
347+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/stream_img.png"
348348
):
349349
if not re.match("(?:http|https)://", STREAM_IMG_URL):
350350
print(
@@ -354,8 +354,8 @@ def seconds_to_time(seconds):
354354

355355
if SOUNCLOUD_IMG_URL:
356356
if (
357-
SOUNCLOUD_IMG_URL
358-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/soundcloud_img.png"
357+
SOUNCLOUD_IMG_URL
358+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/soundcloud_img.png"
359359
):
360360
if not re.match("(?:http|https)://", SOUNCLOUD_IMG_URL):
361361
print(
@@ -365,8 +365,8 @@ def seconds_to_time(seconds):
365365

366366
if YOUTUBE_IMG_URL:
367367
if (
368-
YOUTUBE_IMG_URL
369-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/youtube_img.png"
368+
YOUTUBE_IMG_URL
369+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/youtube_img.png"
370370
):
371371
if not re.match("(?:http|https)://", YOUTUBE_IMG_URL):
372372
print(
@@ -376,8 +376,8 @@ def seconds_to_time(seconds):
376376

377377
if TELEGRAM_VIDEO_URL:
378378
if (
379-
TELEGRAM_VIDEO_URL
380-
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/telegram_video_img.png"
379+
TELEGRAM_VIDEO_URL
380+
!= "https://raw.githubusercontent.com/gabrielmaialva33/winx-music-bot/refs/heads/master/assets/telegram_video_img.png"
381381
):
382382
if not re.match("(?:http|https)://", TELEGRAM_VIDEO_URL):
383383
print(

0 commit comments

Comments
 (0)