Skip to content

[FIX]Ruff: lint errors for E731 #13018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ ignore = [
"E712", # true-false-comparison
"E721", # type-comparison
"E722", # bare-except
"E731", # lambda-assignment
"F821", # undefined-name
"F841", # unused-variable
"FURB113", # repeated-append
Expand Down
18 changes: 8 additions & 10 deletions api/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,10 @@ def environment_variables(self) -> Sequence[Variable]:

# decrypt secret variables value
def decrypt_func(var):
return (
var.model_copy(update={"value": encrypter.decrypt_token(tenant_id=tenant_id, token=var.value)})
if isinstance(var, SecretVariable)
else var
)
if isinstance(var, SecretVariable):
return var.model_copy(update={"value": encrypter.decrypt_token(tenant_id=tenant_id, token=var.value)})
else:
return var

results = list(map(decrypt_func, results))
return results
Expand All @@ -286,11 +285,10 @@ def environment_variables(self, value: Sequence[Variable]):

# encrypt secret variables value
def encrypt_func(var):
return (
var.model_copy(update={"value": encrypter.encrypt_token(tenant_id=tenant_id, token=var.value)})
if isinstance(var, SecretVariable)
else var
)
if isinstance(var, SecretVariable):
return var.model_copy(update={"value": encrypter.encrypt_token(tenant_id=tenant_id, token=var.value)})
else:
return var

encrypted_vars = list(map(encrypt_func, value))
environment_variables_json = json.dumps(
Expand Down
Loading