fixes from fixit 2
This commit is contained in:
parent
b031b0f940
commit
f524b78368
|
@ -211,6 +211,12 @@ exclude = [
|
|||
[tool.ruff.isort]
|
||||
force-single-line = true
|
||||
|
||||
# pip install fixit && fixit fix -a src
|
||||
[tool.fixit]
|
||||
disable = [
|
||||
"fixit.rules:CompareSingletonPrimitivesByIs",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
|
|
@ -64,7 +64,7 @@ class ApiError(Exception):
|
|||
if self.line_number:
|
||||
msg += "Error is on line %i. " % self.line_number
|
||||
if self.file_name:
|
||||
msg += "In file %s. " % self.file_name
|
||||
msg += f"In file {self.file_name}. "
|
||||
return msg
|
||||
|
||||
@classmethod
|
||||
|
@ -288,11 +288,7 @@ def handle_exception(exception: Exception) -> flask.wrappers.Response:
|
|||
|
||||
error_code = "internal_server_error"
|
||||
status_code = 500
|
||||
if (
|
||||
isinstance(exception, NotAuthorizedError)
|
||||
or isinstance(exception, TokenNotProvidedError)
|
||||
or isinstance(exception, TokenInvalidError)
|
||||
):
|
||||
if isinstance(exception, NotAuthorizedError | TokenNotProvidedError | TokenInvalidError):
|
||||
error_code = "not_authorized"
|
||||
status_code = 403
|
||||
if isinstance(exception, UserNotLoggedInError):
|
||||
|
|
|
@ -131,6 +131,6 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel):
|
|||
def with_substitutions(self, field_value: Any, substitution_variables: dict) -> Any:
|
||||
if substitution_variables is not None:
|
||||
for key, value in substitution_variables.items():
|
||||
if isinstance(value, str) or isinstance(value, int):
|
||||
if isinstance(value, str | int):
|
||||
field_value = str(field_value).replace("{{" + key + "}}", str(value))
|
||||
return field_value
|
||||
|
|
|
@ -47,7 +47,7 @@ class GetAllPermissions(Script):
|
|||
|
||||
# sort list of strings based on a specific order
|
||||
def sort_by_order(string_list: list, order: list) -> list:
|
||||
return sorted(string_list, key=lambda x: order.index(x))
|
||||
return sorted(string_list, key=order.index)
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ class Script:
|
|||
) -> Any:
|
||||
raise ApiError(
|
||||
"invalid_script",
|
||||
"This is an internal error. The script you are trying to execute '%s' " % self.__class__.__name__
|
||||
f"This is an internal error. The script you are trying to execute '{self.__class__.__name__}' "
|
||||
+ "does not properly implement the run function.",
|
||||
)
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class GitService:
|
|||
ssh_key_path = current_app.config.get("SPIFFWORKFLOW_BACKEND_GIT_SSH_PRIVATE_KEY_PATH")
|
||||
if ssh_key_path is not None:
|
||||
my_env["GIT_SSH_COMMAND"] = (
|
||||
"ssh -F /dev/null -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i %s" % ssh_key_path
|
||||
f"ssh -F /dev/null -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {ssh_key_path}"
|
||||
)
|
||||
|
||||
command_to_run = command
|
||||
|
|
|
@ -1283,8 +1283,10 @@ class ProcessInstanceProcessor:
|
|||
raise (
|
||||
ApiError(
|
||||
error_code="could_not_find_bpmn_process_identifier",
|
||||
message="Could not find the the given bpmn process identifier from any sources: %s"
|
||||
% bpmn_process_identifier,
|
||||
message=(
|
||||
"Could not find the the given bpmn process identifier from any sources:"
|
||||
f" {bpmn_process_identifier}"
|
||||
),
|
||||
)
|
||||
)
|
||||
return os.path.abspath(bpmn_file_full_path)
|
||||
|
@ -1353,7 +1355,7 @@ class ProcessInstanceProcessor:
|
|||
raise (
|
||||
ApiError(
|
||||
error_code="no_primary_bpmn_error",
|
||||
message="There is no primary BPMN process id defined for process_model %s" % process_model_info.id,
|
||||
message=f"There is no primary BPMN process id defined for process_model {process_model_info.id}",
|
||||
)
|
||||
)
|
||||
ProcessInstanceProcessor.update_spiff_parser_with_all_process_dependency_files(parser)
|
||||
|
@ -1366,7 +1368,7 @@ class ProcessInstanceProcessor:
|
|||
except ValidationException as ve:
|
||||
raise ApiError(
|
||||
error_code="process_instance_validation_error",
|
||||
message="Failed to parse the Workflow Specification. " + "Error is '%s.'" % str(ve),
|
||||
message="Failed to parse the Workflow Specification. " + f"Error is '{str(ve)}.'",
|
||||
file_name=ve.file_name,
|
||||
task_name=ve.name,
|
||||
task_id=ve.id,
|
||||
|
|
|
@ -345,7 +345,7 @@ class ProcessInstanceService:
|
|||
else:
|
||||
raise ApiError.from_task(
|
||||
error_code="task_lane_user_error",
|
||||
message="Spiff Task %s lane user is not a string or dict" % spiff_task.task_spec.name,
|
||||
message=f"Spiff Task {spiff_task.task_spec.name} lane user is not a string or dict",
|
||||
task=spiff_task,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue