From 8c6283a687f7864d9d2a1443322947b7a5c3bf8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 03:45:45 +0000 Subject: [PATCH 1/2] chore(deps-dev): bump ruff from 0.7.4 to 0.8.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.7.4 to 0.8.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.7.4...0.8.0) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index d946da086..5cdea9ba1 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,7 +7,7 @@ -r docs/requirements-docs.txt coveralls==4.0.1 -ruff==0.7.4 +ruff==0.8.0 mypy==1.13.0 pre-commit==4.0.1 pytest==8.3.3 From 748233ca70d120e1cf989a6125a27ffbdb84dd57 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Nov 2024 06:39:18 +0100 Subject: [PATCH 2/2] chore: update imports to prevent shadowing internal exceptions --- ft_client/freqtrade_client/ft_rest_client.py | 4 ++-- ft_client/test_client/test_rest_client.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ft_client/freqtrade_client/ft_rest_client.py b/ft_client/freqtrade_client/ft_rest_client.py index 1763cc1a9..851583ee0 100755 --- a/ft_client/freqtrade_client/ft_rest_client.py +++ b/ft_client/freqtrade_client/ft_rest_client.py @@ -12,7 +12,7 @@ from urllib.parse import urlencode, urlparse, urlunparse import requests from requests.adapters import HTTPAdapter -from requests.exceptions import ConnectionError +from requests.exceptions import ConnectionError as RequestConnectionError logger = logging.getLogger("ft_rest_client") @@ -53,7 +53,7 @@ class FtRestClient: resp = self._session.request(method, url, headers=hd, data=json.dumps(data)) # return resp.text return resp.json() - except ConnectionError: + except RequestConnectionError: logger.warning(f"Connection error - could not connect to {netloc}.") def _get(self, apipath, params: ParamsT = None): diff --git a/ft_client/test_client/test_rest_client.py b/ft_client/test_client/test_rest_client.py index 1a709b9c5..c1af6ded2 100644 --- a/ft_client/test_client/test_rest_client.py +++ b/ft_client/test_client/test_rest_client.py @@ -2,7 +2,7 @@ import re from unittest.mock import ANY, MagicMock import pytest -from requests.exceptions import ConnectionError +from requests.exceptions import ConnectionError as RequestsConnectionError from freqtrade_client import FtRestClient from freqtrade_client.ft_client import add_arguments, main_exec @@ -45,7 +45,7 @@ def test_FtRestClient_call_invalid(caplog): with pytest.raises(ValueError): client._call("PUTTY", "/dummytest") - client._session.request = MagicMock(side_effect=ConnectionError()) + client._session.request = MagicMock(side_effect=RequestsConnectionError()) client._call("GET", "/dummytest") assert log_has_re("Connection error", caplog)