From fe81b9458e6ecfdb65c24dcf46c8c68472a7ad79 Mon Sep 17 00:00:00 2001 From: Kev Date: Sat, 17 Aug 2024 19:40:48 +0000 Subject: [PATCH] Fix Lint Error --- .ruff.toml | 18 +++++++++--------- custom_components/pirateweather/__init__.py | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 0a1d8e9..51618ff 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -5,6 +5,12 @@ target-version = "py312" [lint] select = [ "A001", # Variable {name} is shadowing a Python builtin + "ASYNC210", # Async functions should not call blocking HTTP methods + "ASYNC220", # Async functions should not create subprocesses with blocking methods + "ASYNC221", # Async functions should not run processes with blocking methods + "ASYNC222", # Async functions should not wait on processes with blocking methods + "ASYNC230", # Async functions should not open files with blocking methods like open + "ASYNC251", # Async functions should not call time.sleep "B002", # Python does not support the unary prefix increment "B005", # Using .strip() with multi-character strings is misleading "B007", # Loop control variable {name} not used within loop body @@ -26,6 +32,7 @@ select = [ "E", # pycodestyle "F", # pyflakes/autoflake "FLY", # flynt + "FURB", # refurb "G", # flake8-logging-format "I", # isort "INP", # flake8-no-pep420 @@ -47,6 +54,7 @@ select = [ "RUF006", # Store a reference to the return value of asyncio.create_task "RUF010", # Use explicit conversion flag "RUF013", # PEP 484 prohibits implicit Optional + "RUF017", # Avoid quadratic list summation "RUF018", # Avoid assignment expressions in assert statements "RUF019", # Unnecessary key check before dictionary access # "RUF100", # Unused `noqa` directive; temporarily every now and then to clean them up @@ -123,15 +131,7 @@ ignore = [ "ISC001", # Disabled because ruff does not understand type of __all__ generated by a function - "PLE0605", - - # temporarily disabled - "PT019", - "PYI024", # Use typing.NamedTuple instead of collections.namedtuple - "RET503", - "RET501", - "TRY002", - "TRY301" + "PLE0605" ] [lint.flake8-pytest-style] diff --git a/custom_components/pirateweather/__init__.py b/custom_components/pirateweather/__init__.py index c9f368e..d01bdc0 100644 --- a/custom_components/pirateweather/__init__.py +++ b/custom_components/pirateweather/__init__.py @@ -58,8 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: if not pw_scan_Int: pw_scan_Int = 1200 - if pw_scan_Int < 60: - pw_scan_Int = 60 + pw_scan_Int = max(pw_scan_Int, 60) # Extract list of int from forecast days/ hours string if present # _LOGGER.warning('forecast_days_type: ' + str(type(forecast_days)))