diff --git a/.forgejo/workflows/config/.pylintrc b/.forgejo/workflows/config/.pylintrc index ef7698c..3ea99d4 100644 --- a/.forgejo/workflows/config/.pylintrc +++ b/.forgejo/workflows/config/.pylintrc @@ -1,3 +1,6 @@ [MESSAGES CONTROL] disable= line-too-long, + missing-module-docstring, + too-many-arguments, + too-few-public-methods, diff --git a/pyflowery/__init__.py b/pyflowery/__init__.py index 9b9dc00..7d8a8e6 100644 --- a/pyflowery/__init__.py +++ b/pyflowery/__init__.py @@ -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', ] diff --git a/pyflowery/models.py b/pyflowery/models.py index ec1ca02..b57cc8d 100644 --- a/pyflowery/models.py +++ b/pyflowery/models.py @@ -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 diff --git a/pyflowery/rest_adapter.py b/pyflowery/rest_adapter.py index add107b..9b1d490 100644 --- a/pyflowery/rest_adapter.py +++ b/pyflowery/rest_adapter.py @@ -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: diff --git a/pyflowery/version.py b/pyflowery/version.py index 11a716e..3277f64 100644 --- a/pyflowery/version.py +++ b/pyflowery/version.py @@ -1 +1 @@ -version = "1.0.0" +VERSION = "1.0.0" diff --git a/tests/tests.py b/tests/tests.py index 7cbca99..c0922a8 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -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: