Enable flake8-simplify linting rules (#267)

See https://docs.astral.sh/ruff/rules/#flake8-simplify-sim.
This commit is contained in:
Marc Wrobel
2023-12-30 11:51:49 +01:00
parent 4ce23c9953
commit 7458563fec
4 changed files with 6 additions and 5 deletions

View File

@@ -17,9 +17,10 @@ select = [
"N", # pep8-naming
"PIE", # flake8-pie
"PGH", # pygrep-hooks
"SLF", # flake8-self
"RET", # flake8-return
"RUF100", # unused noqa (yesqa)
"SLF", # flake8-self
"SIM", # flake8-simplify
"T10", # flake8-debugger
"UP", # pyupgrade
"W", # pycodestyle warnings

View File

@@ -117,7 +117,7 @@ class Product:
def check_latest(self) -> None:
for release in self.releases:
latest = release.latest()
if release.matched and latest not in self.versions.keys():
if release.matched and latest not in self.versions:
logging.info(f"latest version {latest} for {release.name} not found in {self.versions_path}")
def process_version(self, version: str, date_str: str) -> None:

View File

@@ -55,7 +55,7 @@ print("::group::apple")
soups = [BeautifulSoup(response.text, features="html5lib") for response in http.fetch_urls(URLS)]
print("::endgroup::")
for product_name in VERSION_PATTERNS.keys():
for product_name in VERSION_PATTERNS:
product = endoflife.Product(product_name)
print(f"::group::{product.name}")

View File

@@ -59,7 +59,7 @@ class ProductFrontmatter:
if "auto" in self.data:
for config in self.data["auto"]:
if method in config.keys():
if method in config:
configs.append(AutoConfig(method, config))
else:
logging.error(f"mixed auto-update methods declared for {self.name}, this is not yet supported")
@@ -154,7 +154,7 @@ def list_products(method: str, products_filter: str = None) -> list[str]:
with open(product_file) as f:
data = frontmatter.load(f)
if "auto" in data:
matching_configs = list(filter(lambda config: method in config.keys(), data["auto"]))
matching_configs = list(filter(lambda config: method in config, data["auto"]))
if len(matching_configs) > 0:
products.append(product_name)