From ac1249015229e28f0b4d033f8be3fc0f1dbe8ac1 Mon Sep 17 00:00:00 2001 From: Diondra Peck Date: Fri, 19 Jul 2024 11:17:38 -0700 Subject: [PATCH] Fix flake8 errors --- .../promptflow/evals/evaluate/_eval_run.py | 17 ++++++++++------- .../evals/synthetic/_conversation/__init__.py | 14 +++++++------- .../jailbreak_adversarial_simulator.py | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py index 6cfa9b3bc55..8f597356a74 100644 --- a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py +++ b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py @@ -72,7 +72,9 @@ class RunStatus(enum.Enum): TERMINATED = 3 -class EvalRun(contextlib.AbstractContextManager): +class EvalRun( + contextlib.AbstractContextManager +): # pylint: disable=too-many-instance-attributes,docstring-missing-param """ The simple singleton run class, used for accessing artifact store. @@ -118,6 +120,7 @@ def __init__( self._run_name = run_name self._promptflow_run = promptflow_run self._status = RunStatus.NOT_STARTED + self._url_base = None self.info = None @property @@ -237,7 +240,7 @@ def __enter__(self): self._start_run() return self - def __exit__(self, exc_type, exc_value, exc_tb): + def __exit__(self, exc_type, exc_value, exc_tb): # pylint: disable=docstring-missing-param """The context manager exit call.""" self._end_run("FINISHED") @@ -332,11 +335,11 @@ def _log_warning(self, failed_op: str, response: requests.Response) -> None: ) def _check_state_and_log( - self, - action: str, - bad_states: Set[RunStatus], - should_raise: bool - ) -> bool: + self, + action: str, + bad_states: Set[RunStatus], + should_raise: bool + ) -> bool: """ Check that the run is in the correct state and log worning if it is not. diff --git a/src/promptflow-evals/promptflow/evals/synthetic/_conversation/__init__.py b/src/promptflow-evals/promptflow/evals/synthetic/_conversation/__init__.py index a864d133a6a..41b5936729c 100644 --- a/src/promptflow-evals/promptflow/evals/synthetic/_conversation/__init__.py +++ b/src/promptflow-evals/promptflow/evals/synthetic/_conversation/__init__.py @@ -230,13 +230,13 @@ class CallbackConversationBot(ConversationBot): :type kwargs: Any """ def __init__( - self, - callback: Callable, - user_template: str, - user_template_parameters: Dict, - *args, - **kwargs, - ) -> None: + self, + callback: Callable, + user_template: str, + user_template_parameters: Dict, + *args, + **kwargs, + ) -> None: self.callback = callback self.user_template = user_template self.user_template_parameters = user_template_parameters diff --git a/src/promptflow-evals/promptflow/evals/synthetic/jailbreak_adversarial_simulator.py b/src/promptflow-evals/promptflow/evals/synthetic/jailbreak_adversarial_simulator.py index 47fc8084c6c..065ad927b0b 100644 --- a/src/promptflow-evals/promptflow/evals/synthetic/jailbreak_adversarial_simulator.py +++ b/src/promptflow-evals/promptflow/evals/synthetic/jailbreak_adversarial_simulator.py @@ -19,7 +19,7 @@ def monitor_adversarial_scenario(func) -> Callable: """Decorator to monitor adversarial scenario. - + :param func: The function to be decorated. :type func: Callable :return: The decorated function.