From d72dae3aa721a99e3793892bd972f4de96a71aaf Mon Sep 17 00:00:00 2001 From: Diondra <16376603+diondrapeck@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:25:37 -0400 Subject: [PATCH] Remove pylint-azure-guidelines references (#3640) # Description pylint-azure-guidelines is an additional package added to precommit in #3547 but it requires a local installation of azure-sdk-for-python, so shelving it until promptflow-evals moves to azure-sdk-for-python repo # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](https://github.com/microsoft/promptflow/blob/main/CONTRIBUTING.md).** - [ ] **I confirm that all new dependencies are compatible with the MIT license.** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --- pylintrc | 3 +-- .../evals/evaluate/_batch_run_client/code_client.py | 4 +--- src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py | 6 ++---- .../evals/synthetic/_model_tools/_proxy_completion_model.py | 4 ++-- .../promptflow/evals/synthetic/_model_tools/_rai_client.py | 3 ++- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pylintrc b/pylintrc index 0b8147bab77..bdb713cf12b 100644 --- a/pylintrc +++ b/pylintrc @@ -3,7 +3,6 @@ py-version=3.9 ignore-patterns=test_*,conftest,setup,.*_utils\.py ignore-paths=src\promptflow-evals\tests,src\promptflow-evals\samples,promptflow\evals\evaluate\_telemetry,promptflow\evals\evaluate\_batch_run_client\code_client.py,promptflow\evals\evaluate\_batch_run_client\proxy_client.py reports=no -load-plugins=pylint_guidelines_checker [MESSAGES CONTROL] # For all codes, run 'pylint --list-msgs' or go to 'https://pylint.pycqa.org/en/latest/technical_reference/features.html' @@ -13,7 +12,7 @@ load-plugins=pylint_guidelines_checker # Let's black deal with bad-continuation # Added disables from super-with-arguments -disable=useless-object-inheritance,missing-timeout,missing-client-constructor-parameter-kwargs,logging-fstring-interpolation,locally-disabled,fixme,cyclic-import,unnecessary-lambda-assignment,client-method-missing-type-annotations,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,client-paging-methods-use-list,docstring-keyword-should-match-keyword-only,docstring-type-do-not-use-class,client-accepts-api-version-keyword,networking-import-outside-azure-core-transport,protected-access,missing-module-docstring,missing-client-constructor-parameter-credential +disable=useless-object-inheritance,missing-timeout,logging-fstring-interpolation,locally-disabled,fixme,cyclic-import,unnecessary-lambda-assignment,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,unnecessary-dunder-call,unnecessary-ellipsis,protected-access,missing-module-docstring [FORMAT] max-line-length=120 diff --git a/src/promptflow-evals/promptflow/evals/evaluate/_batch_run_client/code_client.py b/src/promptflow-evals/promptflow/evals/evaluate/_batch_run_client/code_client.py index 97358439a17..c85b6c376c5 100644 --- a/src/promptflow-evals/promptflow/evals/evaluate/_batch_run_client/code_client.py +++ b/src/promptflow-evals/promptflow/evals/evaluate/_batch_run_client/code_client.py @@ -124,9 +124,7 @@ def run(self, flow, data, evaluator_name=None, column_mapping=None, **kwargs): ) from exc input_df = pd.DataFrame(json_data) - eval_future = self._thread_pool.submit( - self._calculate_metric, flow, input_df, column_mapping, evaluator_name - ) # pylint: disable=specify-parameter-names-in-call + eval_future = self._thread_pool.submit(self._calculate_metric, flow, input_df, column_mapping, evaluator_name) run = CodeRun(run=eval_future, input_data=data, evaluator_name=evaluator_name, aggregated_metrics=None) aggregation_future = self._thread_pool.submit(self._calculate_aggregations, evaluator=flow, run=run) run.aggregated_metrics = aggregation_future diff --git a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py index 74bee5c579a..e98f6d050b8 100644 --- a/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py +++ b/src/promptflow-evals/promptflow/evals/evaluate/_eval_run.py @@ -73,9 +73,7 @@ class RunStatus(enum.Enum): TERMINATED = 3 -class EvalRun( - contextlib.AbstractContextManager -): # pylint: disable=too-many-instance-attributes,docstring-missing-param +class EvalRun(contextlib.AbstractContextManager): # pylint: disable=too-many-instance-attributes """ The simple singleton run class, used for accessing artifact store. @@ -236,7 +234,7 @@ def __enter__(self): self._start_run() return self - def __exit__(self, exc_type, exc_value, exc_tb): # pylint: disable=docstring-missing-param + def __exit__(self, exc_type, exc_value, exc_tb): """The context manager exit call.""" self._end_run("FINISHED") diff --git a/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_proxy_completion_model.py b/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_proxy_completion_model.py index 1c7318e3975..708aafa8446 100644 --- a/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_proxy_completion_model.py +++ b/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_proxy_completion_model.py @@ -9,8 +9,8 @@ import uuid from typing import Dict, List -from aiohttp.web import HTTPException # pylint: disable=networking-import-outside-azure-core-transport -from aiohttp_retry import JitterRetry, RetryClient # pylint: disable=networking-import-outside-azure-core-transport +from aiohttp.web import HTTPException +from aiohttp_retry import JitterRetry, RetryClient from promptflow.evals._user_agent import USER_AGENT diff --git a/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_rai_client.py b/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_rai_client.py index 2e101db04c2..447373c883f 100644 --- a/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_rai_client.py +++ b/src/promptflow-evals/promptflow/evals/synthetic/_model_tools/_rai_client.py @@ -6,7 +6,7 @@ from typing import Any, Dict from urllib.parse import urljoin, urlparse -import requests # pylint: disable=networking-import-outside-azure-core-transport +import requests from promptflow.evals._user_agent import USER_AGENT @@ -28,6 +28,7 @@ class RAIClient: :param token_manager: The token manager :type token_manage: ~promptflow.evals.synthetic._model_tools._identity_manager.APITokenManager """ + def __init__(self, azure_ai_project: Dict, token_manager: APITokenManager) -> None: self.azure_ai_project = azure_ai_project self.token_manager = token_manager