From eaa46e0dc0d2233aaf9229724bff9112ae826a8a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 11 May 2024 13:29:52 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in bc582d8 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- self_correction/self_corrector.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/self_correction/self_corrector.py b/self_correction/self_corrector.py index c4f39c687..aa26b65a1 100644 --- a/self_correction/self_corrector.py +++ b/self_correction/self_corrector.py @@ -1,5 +1,6 @@ import random + class SelfCorrector: def __init__(self, feedback_loop, transaction_parameters): self.feedback_loop = feedback_loop @@ -10,16 +11,25 @@ def adjust_parameters(self, user_feedback=None, system_performance=None): Adjusts the transaction parameters based on user feedback or system performance. """ if user_feedback is not None: - if user_feedback == 'increase': - self.feedback_loop.add_correction(IncreaseParameterCorrection(self.transaction_parameters)) - elif user_feedback == 'decrease': - self.feedback_loop.add_correction(DecreaseParameterCorrection(self.transaction_parameters)) + if user_feedback == "increase": + self.feedback_loop.add_correction( + IncreaseParameterCorrection(self.transaction_parameters) + ) + elif user_feedback == "decrease": + self.feedback_loop.add_correction( + DecreaseParameterCorrection(self.transaction_parameters) + ) if system_performance is not None: if system_performance < 0.9: - self.feedback_loop.add_correction(IncreaseParameterCorrection(self.transaction_parameters)) + self.feedback_loop.add_correction( + IncreaseParameterCorrection(self.transaction_parameters) + ) elif system_performance > 0.95: - self.feedback_loop.add_correction(DecreaseParameterCorrection(self.transaction_parameters)) + self.feedback_loop.add_correction( + DecreaseParameterCorrection(self.transaction_parameters) + ) + class IncreaseParameterCorrection: def __init__(self, transaction_parameters): @@ -33,6 +43,7 @@ def apply(self, transaction_parameters): transaction_parameters[parameter_name] += random.uniform(0.1, 0.5) return transaction_parameters + class DecreaseParameterCorrection: def __init__(self, transaction_parameters): self.transaction_parameters = transaction_parameters