cq: Scripts: Fix ruff errors
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from typing import Any
|
||||
from typing import Iterator
|
||||
|
||||
import functools
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Iterator
|
||||
from ftplib import FTP_TLS
|
||||
from pathlib import Path
|
||||
from shutil import make_archive
|
||||
@@ -44,12 +45,11 @@ console = Console()
|
||||
def ftp_connection(func: Any) -> Any:
|
||||
@functools.wraps(func)
|
||||
def func_wrapper(*args: Any) -> None:
|
||||
ftp = FTP_TLS(FTP_URL, FTP_USER, FTP_PASS)
|
||||
ftp = FTP_TLS(FTP_URL, FTP_USER, FTP_PASS) # noqa: S321
|
||||
console.print("Successfully connected to", FTP_URL)
|
||||
func(ftp, *args)
|
||||
ftp.quit()
|
||||
console.print("Quit")
|
||||
return
|
||||
|
||||
return func_wrapper
|
||||
|
||||
@@ -61,7 +61,7 @@ def is_manifest_valid(manifest: ManifestT) -> bool:
|
||||
|
||||
def download_package_index() -> ManifestT:
|
||||
console.print("Download package index")
|
||||
r = requests.get(PACKAGE_INDEX_URL)
|
||||
r = requests.get(PACKAGE_INDEX_URL, timeout=30)
|
||||
if r.status_code == 404:
|
||||
return {}
|
||||
|
||||
@@ -81,7 +81,7 @@ def find_plugins_to_publish(index: PackageIndexT) -> list[PackageT]:
|
||||
packages_to_publish: list[PackageT] = []
|
||||
for manifest, path in iter_manifests():
|
||||
if not is_manifest_valid(manifest):
|
||||
exit("Invalid manifest found")
|
||||
sys.exit("Invalid manifest found")
|
||||
|
||||
short_name = manifest["short_name"]
|
||||
version = manifest["version"]
|
||||
|
||||
@@ -154,6 +154,9 @@ exclude = [
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"scripts/*" = ["S603", "S607"]
|
||||
|
||||
[tool.ruff.lint.mccabe]
|
||||
max-complexity = 15
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Keep this file python 3.7 compatible because it is executed on the server
|
||||
|
||||
from typing import Any
|
||||
from typing import Iterator
|
||||
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ TRANSLATABLE_FILES = [
|
||||
|
||||
|
||||
def template_is_equal(old_template_path: Path, new_template: str) -> bool:
|
||||
with open(old_template_path, "r") as f:
|
||||
with open(old_template_path) as f:
|
||||
old_template = f.read()
|
||||
|
||||
pattern = r'"POT-Creation-Date: .*\n"'
|
||||
|
||||
Reference in New Issue
Block a user