Fix pylint

This commit is contained in:
ekzyis 2021-11-04 01:07:42 +01:00
parent a26de66f08
commit 1277e6d00b
4 changed files with 7 additions and 6 deletions

View File

@ -12,7 +12,8 @@ disable=
wrong-import-position, wrong-import-position,
redefined-outer-name, redefined-outer-name,
invalid-name, invalid-name,
no-self-use no-self-use,
too-many-instance-attributes
[FORMAT] [FORMAT]
indent-string=' ' indent-string=' '

View File

@ -91,7 +91,7 @@ class Music(commands.Cog):
def after(err): def after(err):
if err: if err:
self.logger.error(f"Player error: {err}") self.logger.error("Player error: %s", err)
self._next() self._next()
ctx.voice_client.play(audio, after=after) ctx.voice_client.play(audio, after=after)
embed = NowPlayingMessage(title=song.title, url=song.webpage_url) embed = NowPlayingMessage(title=song.title, url=song.webpage_url)
@ -99,7 +99,7 @@ class Music(commands.Cog):
await self._add_skip_button(msg) await self._add_skip_button(msg)
# pylint: disable=broad-except # pylint: disable=broad-except
except Exception as err: except Exception as err:
self.logger.error(f"Error during playback: {err}") self.logger.error("Error during playback: %s", err)
if ctx: if ctx:
embed = ErrorMessage(str(err)) embed = ErrorMessage(str(err))
await ctx.send(embed=embed) await ctx.send(embed=embed)
@ -172,7 +172,7 @@ if __name__ == "__main__":
@bot.event @bot.event
async def on_ready(): async def on_ready():
logger.info(f"Logged in as {bot.user} ({bot.user.id})") logger.info("Logged in as %s (%s)", bot.user, bot.user.id)
logger.info('------') logger.info('------')
bot.add_cog(Music(bot, logger=logger)) bot.add_cog(Music(bot, logger=logger))

View File

@ -22,7 +22,7 @@ def create_logger(name: str) -> logging.Logger:
COMMIT = os.getenv('GIT_COMMIT') or 'no-commit' COMMIT = os.getenv('GIT_COMMIT') or 'no-commit'
timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S") timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
log_path = "%s_%s.log" % (COMMIT, timestamp) log_path = f"{COMMIT}_{timestamp}.log"
file_handler = logging.FileHandler(log_path) file_handler = logging.FileHandler(log_path)

View File

@ -16,7 +16,7 @@ from bot import Music
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
def start_xvfb_server(request): def global_teardown():
yield yield
logs = glob.glob('*.log') logs = glob.glob('*.log')
for log in logs: for log in logs: