From 127c777dc9022c6e0d30d257b2d5d211e208151d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20Su=C3=A1rez?= Date: Thu, 3 Sep 2020 18:05:07 -0700 Subject: [PATCH 1/3] Update botbuilder-python-ci.yml pinned right version of black in the pipeline --- pipelines/botbuilder-python-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/botbuilder-python-ci.yml b/pipelines/botbuilder-python-ci.yml index c5d11005f..a55083ff1 100644 --- a/pipelines/botbuilder-python-ci.yml +++ b/pipelines/botbuilder-python-ci.yml @@ -59,7 +59,7 @@ jobs: pip install -r ./libraries/botbuilder-ai/tests/requirements.txt pip install coveralls pip install pylint==2.4.4 - pip install black + pip install black==19.10b0 displayName: 'Install dependencies' - script: | From 4b71d3e4913eaaf0532a8c4b3b1819e201631f16 Mon Sep 17 00:00:00 2001 From: Axel Suarez Date: Thu, 3 Sep 2020 18:17:48 -0700 Subject: [PATCH 2/3] black compliant --- libraries/botbuilder-ai/tests/qna/test_qna.py | 15 +++++---------- .../connector/auth/jwt_token_validation.py | 4 +++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libraries/botbuilder-ai/tests/qna/test_qna.py b/libraries/botbuilder-ai/tests/qna/test_qna.py index 03e176d6e..08e56bcc1 100644 --- a/libraries/botbuilder-ai/tests/qna/test_qna.py +++ b/libraries/botbuilder-ai/tests/qna/test_qna.py @@ -171,9 +171,7 @@ async def test_returns_answer_using_requests_module(self): response_path: str = "ReturnsAnswer.json" response_json = QnaApplicationTest._get_json_for_file(response_path) - qna = QnAMaker( - endpoint=QnaApplicationTest.tests_endpoint, http_client=requests - ) + qna = QnAMaker(endpoint=QnaApplicationTest.tests_endpoint, http_client=requests) context = QnaApplicationTest._get_context(question, TestAdapter()) with patch("requests.post", return_value=response_json): @@ -185,7 +183,7 @@ async def test_returns_answer_using_requests_module(self): self.assertEqual( "BaseCamp: You can use a damp rag to clean around the Power Pack", answers[0].answer, - ) + ) async def test_returns_answer_using_options(self): # Arrange @@ -287,7 +285,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self): context=None, qna_id=None, is_test=False, - ranker_type="Default" + ranker_type="Default", ) response_path = "ReturnsAnswer.json" response_json = QnaApplicationTest._get_json_for_file(response_path) @@ -296,10 +294,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self): with patch("requests.post", return_value=response_json): result = await http_request_helper.execute_http_request( - url, - question, - QnaApplicationTest.tests_endpoint, - timeout=None + url, question, QnaApplicationTest.tests_endpoint, timeout=None ) answers = result["answers"] @@ -308,7 +303,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self): self.assertEqual( "BaseCamp: You can use a damp rag to clean around the Power Pack", answers[0]["answer"], - ) + ) async def test_telemetry_returns_answer(self): # Arrange diff --git a/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py b/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py index aecf27ce6..737ba39ad 100644 --- a/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py +++ b/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py @@ -167,7 +167,9 @@ async def validate_claims( await auth_config.claims_validator(claims) elif SkillValidation.is_skill_claim(claims): # Skill claims must be validated using AuthenticationConfiguration claims_validator - raise PermissionError("Unauthorized Access. Request is not authorized. Skill Claims require validation.") + raise PermissionError( + "Unauthorized Access. Request is not authorized. Skill Claims require validation." + ) @staticmethod def is_government(channel_service: str) -> bool: From 02b924b63bc3b8576637766eb2dc412374371021 Mon Sep 17 00:00:00 2001 From: Axel Suarez Date: Thu, 3 Sep 2020 18:43:50 -0700 Subject: [PATCH 3/3] pylint compliant --- libraries/botbuilder-ai/tests/qna/test_qna.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/botbuilder-ai/tests/qna/test_qna.py b/libraries/botbuilder-ai/tests/qna/test_qna.py index 08e56bcc1..e733b6564 100644 --- a/libraries/botbuilder-ai/tests/qna/test_qna.py +++ b/libraries/botbuilder-ai/tests/qna/test_qna.py @@ -4,12 +4,13 @@ # pylint: disable=protected-access # pylint: disable=too-many-lines -import json -import requests +import unittest from os import path from typing import List, Dict -import unittest from unittest.mock import patch + +import json +import requests from aiohttp import ClientSession import aiounittest