Enable flake8-bugbear linting rules (#267)
See https://docs.astral.sh/ruff/rules/#flake8-bugbear-b.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
select = [
|
||||
"B", # flake8-bugbear
|
||||
"C90", # mccabe
|
||||
"E", # pycodestyle errors
|
||||
"F", # pyflakes errors
|
||||
|
||||
@@ -9,7 +9,7 @@ Ideally we would want to use the git repository directly, but cgit-managed repos
|
||||
METHOD = "cgit"
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -137,10 +137,10 @@ class Product:
|
||||
return f"<{self.name}>"
|
||||
|
||||
|
||||
def list_products(method, products_filter=None) -> dict[str, list[dict]]:
|
||||
def list_products(method, products_filter=None) -> list[str]:
|
||||
"""Return a list of products that are using the same given update method.
|
||||
"""
|
||||
products_with_method = {}
|
||||
products = []
|
||||
|
||||
for product_file in glob(f"{PRODUCTS_PATH}/*.md"):
|
||||
product_name = os.path.splitext(os.path.basename(product_file))[0]
|
||||
@@ -150,11 +150,8 @@ def list_products(method, products_filter=None) -> dict[str, list[dict]]:
|
||||
with open(product_file) as f:
|
||||
data = frontmatter.load(f)
|
||||
if "auto" in data:
|
||||
configs = list(filter(
|
||||
lambda config: method in config.keys(),
|
||||
data["auto"]
|
||||
))
|
||||
if len(configs) > 0:
|
||||
products_with_method[product_name] = configs
|
||||
matching_configs = list(filter(lambda config: method in config.keys(), data["auto"]))
|
||||
if len(matching_configs) > 0:
|
||||
products.append(product_name)
|
||||
|
||||
return products_with_method
|
||||
return products
|
||||
|
||||
@@ -20,7 +20,7 @@ class Git:
|
||||
child = run(f"git {cmd}", capture_output=True, timeout=300, check=True, shell=True, cwd=self.repo_dir)
|
||||
return child.stdout.decode("utf-8").strip().split("\n")
|
||||
except ChildProcessError as ex:
|
||||
raise RuntimeError(f"Failed to run '{cmd}': {ex}")
|
||||
raise RuntimeError(f"Failed to run '{cmd}': {ex}") from ex
|
||||
|
||||
def setup(self, bare: bool = False):
|
||||
"""Creates the repository path and runs:
|
||||
|
||||
@@ -6,7 +6,7 @@ from common import dates, endoflife, http
|
||||
METHOD = 'distrowatch'
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def fetch_releases(product, config, url):
|
||||
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from common.git import Git
|
||||
METHOD = 'git'
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ query($endCursor: String) {
|
||||
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from common import endoflife, http
|
||||
METHOD = "maven"
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from common import dates, endoflife, http
|
||||
METHOD = "npm"
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from common import dates, endoflife, http
|
||||
METHOD = "pypi"
|
||||
|
||||
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
for product_name, configs in endoflife.list_products(METHOD, p_filter).items():
|
||||
for product_name in endoflife.list_products(METHOD, p_filter):
|
||||
product = endoflife.Product(product_name)
|
||||
print(f"::group::{product.name}")
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ for detail_id in [f"detail{row['id']}" for row in sles_header_rows]:
|
||||
for row in minor_versions_table.find_all("tr")[1:]:
|
||||
# For each minor release there is an FCS date, general support end date and LTSS end date
|
||||
cells = row.find_all("td")
|
||||
version = cells[0].text.strip("SUSE Linux Enterprise Server ").replace(' SP', '.')
|
||||
version = cells[0].text.replace("SUSE Linux Enterprise Server ", '').replace(' SP', '.')
|
||||
date_str = cells[1].text
|
||||
|
||||
try:
|
||||
|
||||
@@ -23,8 +23,8 @@ def get_latest_minor_versions(versions):
|
||||
|
||||
# For each group, find the version with the highest patch version
|
||||
latest_versions = []
|
||||
for major_minor, group in version_groups.items():
|
||||
latest_patch = max(group, key=lambda version: int(version[2]))
|
||||
for version_group in version_groups.values():
|
||||
latest_patch = max(version_group, key=lambda v: int(v[2]))
|
||||
latest_versions.append('.'.join(latest_patch))
|
||||
|
||||
return latest_versions
|
||||
|
||||
Reference in New Issue
Block a user