pylint fixes
This commit is contained in:
parent
78b87fd940
commit
997fd5437e
6 changed files with 13 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
|||
[MESSAGES CONTROL]
|
||||
disable=
|
||||
line-too-long,
|
||||
missing-module-docstring,
|
||||
too-many-arguments,
|
||||
too-few-public-methods,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from pyflowery.models import FloweryAPIConfig, Language, Result, Voice
|
||||
from pyflowery.pyflowery import FloweryAPI
|
||||
from pyflowery.version import version
|
||||
from pyflowery.version import VERSION
|
||||
|
||||
__all__ = [
|
||||
'FloweryAPI',
|
||||
|
@ -8,5 +8,5 @@ __all__ = [
|
|||
'Result',
|
||||
'Voice',
|
||||
'Language',
|
||||
'version',
|
||||
'VERSION',
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@ from dataclasses import dataclass, field
|
|||
from logging import Logger, getLogger
|
||||
from typing import Dict, List, Union
|
||||
|
||||
from pyflowery.version import version
|
||||
from pyflowery.version import VERSION
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -57,6 +57,6 @@ class FloweryAPIConfig:
|
|||
user_agent (str): User-Agent string to use for the HTTP requests
|
||||
logger (Logger): Logger to use for logging messages
|
||||
"""
|
||||
user_agent: str = f"PyFlowery/{version}"
|
||||
user_agent: str = f"PyFlowery/{VERSION}"
|
||||
logger: Logger = getLogger('pyflowery')
|
||||
allow_truncation: bool = False
|
||||
|
|
|
@ -37,7 +37,7 @@ class RestAdapter:
|
|||
'User-Agent': self._user_agent,
|
||||
}
|
||||
sanitized_params = {k: str(v) if isinstance(v, bool) else v for k, v in params.items()} if params else None
|
||||
self._logger.debug(f"Making {http_method} request to {full_url} with params {sanitized_params}")
|
||||
self._logger.debug("Making %s request to %s with params %s", http_method, full_url, sanitized_params)
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.request(method=http_method, url=full_url, params=sanitized_params, headers=headers, timeout=timeout) as response:
|
||||
|
@ -52,7 +52,7 @@ class RestAdapter:
|
|||
message=response.reason,
|
||||
data=data,
|
||||
)
|
||||
self._logger.debug(f"Received response: {result.status_code} {result.message}")
|
||||
self._logger.debug("Received response: %s %s", response.status, response.reason)
|
||||
return result
|
||||
|
||||
async def get(self, endpoint: str, params: dict = None, timeout: float = 60) -> Result:
|
||||
|
|
|
@ -1 +1 @@
|
|||
version = "1.0.0"
|
||||
VERSION = "1.0.0"
|
||||
|
|
|
@ -17,16 +17,18 @@ root.addHandler(handler)
|
|||
api = FloweryAPI(FloweryAPIConfig())
|
||||
|
||||
async def test_get_voices():
|
||||
"""Test the get_voices method"""
|
||||
async for voice in api.get_voices():
|
||||
if 'en' in voice.language.code:
|
||||
api.config.logger.info(voice)
|
||||
|
||||
async def test_get_tts():
|
||||
"""Test the get_tts method"""
|
||||
tts = await api.get_tts(text="BLAST HIM!", voice="191c5adc-a092-5eea-b4ff-ce01f66153ae")
|
||||
try:
|
||||
with open('test.mp3', 'wb') as f:
|
||||
f.write(tts)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
api.config.logger.error(e, exc_info=True)
|
||||
long_string = 'a' * 2049
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue