refactoring repository

This commit is contained in:
Yanis Rigaudeau 2023-05-19 22:41:29 +02:00
parent d09c2b7a89
commit 0d6e0e4c19
Signed by: yanis
GPG Key ID: 4DD2841DF1C94D83
42 changed files with 1259 additions and 50 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
PIPENV_VENV_IN_PROJECT=1

View File

@ -1,9 +0,0 @@
[flake8]
ignore =
E501,
E731,
W503
exclude =
.git,
__pycache__,
__init__.py

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
Pipfile.lock merge=binary

5
.gitignore vendored
View File

@ -1,4 +1,7 @@
.mypy_cache
__pycache__
.mypy_cache
.venv
config.toml
download

View File

@ -1,2 +0,0 @@
[settings]
profile = black

View File

@ -1,2 +0,0 @@
[mypy]
ignore_missing_imports = True

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}",
"program": "${workspaceFolder}/dj-embe",
"console": "integratedTerminal",
"justMyCode": true
}

View File

@ -1,5 +1,6 @@
{
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.analysis.typeCheckingMode": "off"
"python.defaultInterpreterPath": ".venv/bin/python",
"python.formatting.provider": "black",
"python.terminal.activateEnvironment": false
}

29
Pipfile Normal file
View File

@ -0,0 +1,29 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[scripts]
lint = "bash -c 'isort dj-embe && black dj-embe && flake8 dj-embe && mypy dj-embe'"
[packages]
py-cord = "*"
pynacl = "*"
redis = "*"
spotipy = "*"
toml = "*"
youtube-search-python = "*"
yt-dlp = "*"
[dev-packages]
black = "*"
flake8 = "*"
flake8-pyproject = "*"
isort = "*"
mypy = "*"
types-redis = "*"
types-requests = "*"
types-toml = "*"
[requires]
python_version = ">=3.10"

1204
Pipfile.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,12 @@
from os import mkdir, path
from discord import Bot, Intents
from toml import TomlDecodeError
from cog import Greetings, Music
from config import Config
from discord import Bot, Intents
from framework import DiscordPlayer, Downloader, Redis, Spotify, Youtube
from logger import Logger
from service import FileManager, PlaybackManager, QueueManager
from toml import TomlDecodeError
from usecase import Sources
if __name__ == "__main__":

View File

@ -1,7 +1,6 @@
from logging import Logger
from discord import ApplicationContext, Bot, Cog, default_permissions, slash_command
from framework.redis import Redis

View File

@ -1,7 +1,6 @@
from logging import Logger
from discord import ApplicationContext, Bot, Cog, Embed, Interaction, slash_command
from service import PlaybackManager, QueueManager
from usecase import Sources

View File

@ -1,5 +1,4 @@
from discord import FFmpegOpusAudio, VoiceChannel, VoiceClient
from entity import File

View File

@ -1,9 +1,8 @@
import pickle
from logging import Logger
from redis.asyncio import Redis as RedisClient
from config import RedisConfig
from redis.asyncio import Redis as RedisClient
class Redis:

View File

@ -1,11 +1,10 @@
from asyncio import AbstractEventLoop
import spotipy
from config import SpotifyConfig
from spotipy import MemoryCacheHandler
from spotipy.oauth2 import SpotifyClientCredentials
from config import SpotifyConfig
class Spotify:
def __init__(self, loop: AbstractEventLoop, config: SpotifyConfig) -> None:

View File

@ -2,11 +2,10 @@ import re
from asyncio import AbstractEventLoop
from os import path, stat
from youtubesearchpython.__future__ import VideosSearch
from yt_dlp import YoutubeDL
from config import YoutubeConfig
from entity import File
from youtubesearchpython.__future__ import VideosSearch
from yt_dlp import YoutubeDL
class Youtube:

View File

@ -4,7 +4,6 @@ from os import path, stat
from time import time
from discord import Interaction
from entity import Entry, File
from framework import Downloader, Youtube

View File

@ -1,5 +1,4 @@
from discord import TextChannel, VoiceChannel
from entity import Queue
from framework import DiscordPlayer

View File

@ -1,7 +1,6 @@
import re
from discord import Interaction
from entity import Album, Artist, Entry, Playlist, Title
from framework import Spotify, Youtube
from service import FileManager

View File

@ -1,2 +0,0 @@
#!/bin/sh
isort . && black . && flake8 . && mypy .

10
pyproject.toml Normal file
View File

@ -0,0 +1,10 @@
[tool.flake8]
exclude = [".git", "__pycache__"]
ignore = ["E501", "E731", "W503"]
per-file-ignores = ["__init__.py:F401"]
[tool.isort]
profile = "black"
[tool.mypy]
ignore_missing_imports = "true"

View File

@ -1,8 +0,0 @@
types-redis==4.5.5.0
types-requests==2.30.0.0
types-toml==0.10.8.6
black==23.3.0
flake8==6.0.0
isort==5.12.0
mypy==1.2.0

View File

@ -1,7 +0,0 @@
PyNaCl==1.5.0
py-cord==2.4.1
redis==4.5.4
spotipy==2.23.0
toml==0.10.2
youtube-search-python==1.6.6
yt-dlp==2023.3.4