lint: reformat python code with black
This commit is contained in:
parent
331beb01b4
commit
a406a7974b
88 changed files with 2579 additions and 1608 deletions
|
@ -55,26 +55,36 @@ class ListAutomation(TerraformAutomation):
|
|||
MirrorList.destroyed.is_(None),
|
||||
MirrorList.provider == self.provider,
|
||||
).all(),
|
||||
global_namespace=app.config['GLOBAL_NAMESPACE'],
|
||||
terraform_modules_path=os.path.join(*list(os.path.split(app.root_path))[:-1], 'terraform-modules'),
|
||||
global_namespace=app.config["GLOBAL_NAMESPACE"],
|
||||
terraform_modules_path=os.path.join(
|
||||
*list(os.path.split(app.root_path))[:-1], "terraform-modules"
|
||||
),
|
||||
backend_config=f"""backend "http" {{
|
||||
lock_address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
|
||||
unlock_address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
|
||||
address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
|
||||
}}""",
|
||||
**{
|
||||
k: app.config[k.upper()]
|
||||
for k in self.template_parameters
|
||||
}
|
||||
**{k: app.config[k.upper()] for k in self.template_parameters},
|
||||
)
|
||||
for pool in Pool.query.filter(Pool.destroyed.is_(None)).all():
|
||||
for key, formatter in lists.items():
|
||||
formatted_pool = formatter(pool)
|
||||
for obfuscate in [True, False]:
|
||||
with open(os.path.join(
|
||||
self.working_dir, f"{key}.{pool.pool_name}{'.jsno' if obfuscate else '.json'}"),
|
||||
'w', encoding="utf-8") as out:
|
||||
with open(
|
||||
os.path.join(
|
||||
self.working_dir,
|
||||
f"{key}.{pool.pool_name}{'.jsno' if obfuscate else '.json'}",
|
||||
),
|
||||
"w",
|
||||
encoding="utf-8",
|
||||
) as out:
|
||||
out.write(json_encode(formatted_pool, obfuscate))
|
||||
with open(os.path.join(self.working_dir, f"{key}.{pool.pool_name}{'.jso' if obfuscate else '.js'}"),
|
||||
'w', encoding="utf-8") as out:
|
||||
with open(
|
||||
os.path.join(
|
||||
self.working_dir,
|
||||
f"{key}.{pool.pool_name}{'.jso' if obfuscate else '.js'}",
|
||||
),
|
||||
"w",
|
||||
encoding="utf-8",
|
||||
) as out:
|
||||
out.write(javascript_encode(formatted_pool, obfuscate))
|
||||
|
|
|
@ -11,9 +11,7 @@ class ListGithubAutomation(ListAutomation):
|
|||
# TODO: file an issue in the github about this, GitLab had a similar issue but fixed it
|
||||
parallelism = 1
|
||||
|
||||
template_parameters = [
|
||||
"github_api_key"
|
||||
]
|
||||
template_parameters = ["github_api_key"]
|
||||
|
||||
template = """
|
||||
terraform {
|
||||
|
|
|
@ -15,7 +15,7 @@ class ListGitlabAutomation(ListAutomation):
|
|||
"gitlab_token",
|
||||
"gitlab_author_email",
|
||||
"gitlab_author_name",
|
||||
"gitlab_commit_message"
|
||||
"gitlab_commit_message",
|
||||
]
|
||||
|
||||
template = """
|
||||
|
@ -56,5 +56,5 @@ class ListGitlabAutomation(ListAutomation):
|
|||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
if 'GITLAB_URL' in current_app.config:
|
||||
if "GITLAB_URL" in current_app.config:
|
||||
self.template_parameters.append("gitlab_url")
|
||||
|
|
|
@ -6,10 +6,7 @@ class ListS3Automation(ListAutomation):
|
|||
description = "Update mirror lists in AWS S3 buckets"
|
||||
provider = "s3"
|
||||
|
||||
template_parameters = [
|
||||
"aws_access_key",
|
||||
"aws_secret_key"
|
||||
]
|
||||
template_parameters = ["aws_access_key", "aws_secret_key"]
|
||||
|
||||
template = """
|
||||
terraform {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue