Refactor core.py and update pyproject.toml configuration

Within core.py, the import statement for the 'Sized' attribute from 'collections.abc' is moved under a TYPE_CHECKING condition for better import flow control. The Ruff lint configuration in pyproject.toml has been simplified to select specific error codes and the `show-fixes` option has been enabled, allowing visibility of possible fixes for erring lines.
This commit is contained in:
L1ghtn1ng 2024-03-17 22:27:42 +00:00
parent d36e326f77
commit 03e9bb34ef
2 changed files with 6 additions and 6 deletions

View file

@ -79,13 +79,11 @@ exclude = [
] ]
line-length = 130 line-length = 130
target-version = "py310" target-version = "py310"
show-fixes = true
[tool.ruff.lint] [tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. select = ["E4", "E7", "E9", "F", "I", "UP", "TCH"]
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
select = ["E4", "E7", "E9", "F", "I", "UP"]
ignore = [] ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided. # Allow fix for all enabled rules (when `--fix`) is provided.

View file

@ -4,9 +4,8 @@
import contextlib import contextlib
import random import random
import ssl import ssl
from collections.abc import Sized
from pathlib import Path from pathlib import Path
from typing import Any from typing import TYPE_CHECKING, Any
import aiohttp import aiohttp
import certifi import certifi
@ -17,6 +16,9 @@
from .version import version from .version import version
if TYPE_CHECKING:
from collections.abc import Sized
DATA_DIR = Path(__file__).parents[1] / 'data' DATA_DIR = Path(__file__).parents[1] / 'data'
CONFIG_DIRS = [ CONFIG_DIRS = [
Path('/etc/theHarvester/'), Path('/etc/theHarvester/'),