diff --git a/base/actions/actions.py b/base/actions/actions.py index 879773a..9ac082e 100644 --- a/base/actions/actions.py +++ b/base/actions/actions.py @@ -173,7 +173,7 @@ def submit( domain: Dict[Text, Any], ) -> List[Dict]: """Define what the form has to do - after all required slots are filled""" + after all required slots are filled""" # utter submit template return [] @@ -516,7 +516,7 @@ def submit( domain: Dict[Text, Any], ) -> List[Dict]: """Define what the form has to do - after all required slots are filled""" + after all required slots are filled""" # utter submit template return [] @@ -796,7 +796,7 @@ async def submit( domain: Dict[Text, Any], ) -> List[Dict]: """Define what the form has to do - after all required slots are filled""" + after all required slots are filled""" data = self.get_risk_data(tracker) risk = utils.get_risk_level(data) study_a_arm = None diff --git a/base/tests/test_forms.py b/base/tests/test_forms.py index 59b1b58..e8b602e 100644 --- a/base/tests/test_forms.py +++ b/base/tests/test_forms.py @@ -245,7 +245,10 @@ async def test_validate_location_text(self): """ form = HealthCheckProfileForm() - tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",) + tracker = self.get_tracker_for_text_slot_with_message( + "location", + "Cape Town", + ) events = await form.validate(CollectingDispatcher(), tracker, {}) assert events == [ @@ -265,7 +268,10 @@ async def test_validate_location_google_places(self): "geometry": {"location": {"lat": 1.23, "lng": 4.56}}, } - tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",) + tracker = self.get_tracker_for_text_slot_with_message( + "location", + "Cape Town", + ) events = await form.validate(CollectingDispatcher(), tracker, {}) assert events == [ @@ -285,7 +291,10 @@ async def test_validate_location_google_places_no_results(self): form.places_lookup = utils.AsyncMock() form.places_lookup.return_value = None - tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",) + tracker = self.get_tracker_for_text_slot_with_message( + "location", + "Cape Town", + ) dispatcher = CollectingDispatcher() events = await form.validate(dispatcher, tracker, {}) @@ -308,7 +317,10 @@ async def test_validate_location_google_places_error(self): form.places_lookup = utils.AsyncMock() form.places_lookup.side_effect = Exception() - tracker = self.get_tracker_for_text_slot_with_message("location", "Cape Town",) + tracker = self.get_tracker_for_text_slot_with_message( + "location", + "Cape Town", + ) dispatcher = CollectingDispatcher() events = await form.validate(dispatcher, tracker, {}) @@ -505,7 +517,9 @@ def test_complete_form(self): form = HealthCheckProfileForm() dispatcher = CollectingDispatcher() tracker = utils.get_tracker_for_slot_from_intent( - form, "medical_condition", "no", + form, + "medical_condition", + "no", ) result = form.submit(dispatcher, tracker, {}) assert result == [] @@ -608,7 +622,7 @@ async def test_submit_to_eventstore(self): assert request.called [(request, response)] = request.calls - data = json.loads(request.stream.body) + data = json.loads(request.content) assert data.pop("deduplication_id") assert data == { "province": "ZA-WC", @@ -857,7 +871,14 @@ async def test_validate_yes_no_maybe(self): class TestActionSendStudyMessages: def get_tracker_with_slot(self, slots): return Tracker( - "default", slots, {"text": "test"}, [], False, None, {}, "action_listen", + "default", + slots, + {"text": "test"}, + [], + False, + None, + {}, + "action_listen", ) @pytest.mark.asyncio diff --git a/hh/actions/actions.py b/hh/actions/actions.py index 759b417..e44f40e 100644 --- a/hh/actions/actions.py +++ b/hh/actions/actions.py @@ -361,7 +361,7 @@ async def submit( domain: Dict[Text, Any], ) -> List[Dict]: """Define what the form has to do - after all required slots are filled""" + after all required slots are filled""" return [] diff --git a/hh/tests/test_actions.py b/hh/tests/test_actions.py index ce1b5ab..e363814 100644 --- a/hh/tests/test_actions.py +++ b/hh/tests/test_actions.py @@ -60,7 +60,8 @@ def test_validate_destination_province(self): dispatcher = CollectingDispatcher() response = form.validate_destination_province("1", dispatcher, tracker, {}) self.assertEqual( - response, {"destination_province": "ec"}, + response, + {"destination_province": "ec"}, ) def test_validate_university(self): @@ -108,7 +109,8 @@ def test_validate_university_confirm(self): dispatcher = CollectingDispatcher() response = form.validate_university_confirm("1", dispatcher, tracker, {}) self.assertEqual( - response, {"university_confirm": "AFDA", "campus_list": "*1.* Cenral"}, + response, + {"university_confirm": "AFDA", "campus_list": "*1.* Cenral"}, ) def test_validate_campus(self): @@ -126,7 +128,8 @@ def test_validate_campus(self): dispatcher = CollectingDispatcher() response = form.validate_campus("1", dispatcher, tracker, {}) self.assertEqual( - response, {"campus": "Cenral"}, + response, + {"campus": "Cenral"}, ) @patch("hh.actions.actions.CollectingDispatcher.utter_message") @@ -145,7 +148,8 @@ def test_validate_vaccine_uptake(self, mock_utter): dispatcher = CollectingDispatcher() response = form.validate_vaccine_uptake("3", dispatcher, tracker, {}) self.assertEqual( - response, {"vaccine_uptake": "NOT"}, + response, + {"vaccine_uptake": "NOT"}, ) mock_utter.assert_called_once_with(template="utter_not_vaccinated") @@ -466,7 +470,16 @@ async def test_assign_study_b_arm(self): } events = await action.run( dispatcher, - Tracker("27820001001", {}, {}, [], False, None, {}, "action_listen",), + Tracker( + "27820001001", + {}, + {}, + [], + False, + None, + {}, + "action_listen", + ), {}, ) assert SlotSet("start_time", "2022-03-09T07:33:29.046948Z") in events diff --git a/requirements-dev.txt b/requirements-dev.txt index 99642d4..8f52a11 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -black==19.10b0 +black==22.12.0 click==8.0.2 isort==4.3.21 mypy==0.780 @@ -6,4 +6,4 @@ flake8==3.8.3 pytest==5.4.3 pytest-cov==2.10.0 pytest-asyncio==0.14.0 -respx==0.8.2 +respx==0.8.1 diff --git a/requirements.txt b/requirements.txt index c34228e..4b1f2b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,137 +1,5 @@ -absl-py==0.9.0 -aiofiles==0.5.0 -aiohttp==3.6.2 -APScheduler==3.6.3 -astor==0.8.1 -async-generator==1.10 -async-lru==1.0.2 -async-timeout==3.0.1 -asyncpg==0.21.0 -attrs==19.3.0 -boto3==1.13.11 -botocore==1.16.11 -cachetools==4.1.0 -certifi==2020.4.5.1 -cffi==1.14.0 -chardet==3.0.4 -cloudpickle==1.3.0 -colorclass==2.2.0 -coloredlogs==10.0 -colorhash==1.0.2 -cryptography==2.9.2 -cycler==0.10.0 -decorator==4.4.2 -dnspython==1.16.0 -docopt==0.6.2 -docutils==0.15.2 -fbmessenger==6.0.0 -future==0.18.2 -gast==0.2.2 -gevent==1.5.0 -google-auth==1.14.3 -google-auth-oauthlib==0.4.1 -google-pasta==0.2.0 greenlet==0.4.15 -grpcio==1.29.0 -h11==0.8.1 -h2==3.2.0 -h5py==2.10.0 -hpack==3.0.0 -hstspreload==2020.5.16 -httplib2==0.17.3 -httptools==0.1.1 +importlib-metadata==4.13.0 httpx==0.9.3 -humanfriendly==8.2 -hyperframe==5.2.0 -idna==2.8 -importlib-metadata==1.6.0 -ipaddress==1.0.23 -iso6709==0.1.5 -jmespath==0.10.0 -joblib==0.15.1 -jsonpickle==1.4.1 -jsonschema==3.2.0 -kafka-python==1.4.7 -Keras-Applications==1.0.8 -Keras-Preprocessing==1.1.2 -kiwisolver==1.2.0 -Markdown==3.2.2 -matplotlib==3.2.1 -mattermostwrapper==2.2 -multidict==4.7.6 -networkx==2.4 -numpy==1.18.4 -oauth2client==4.1.3 -oauthlib==3.1.0 -opt-einsum==3.2.1 -packaging==20.3 -pika==1.1.0 -prompt-toolkit==2.0.10 -protobuf==3.12.0 -psycopg2-binary==2.8.5 -pyasn1==0.4.8 -pyasn1-modules==0.2.8 -pycparser==2.21 -pydot==1.4.1 -PyJWT==1.7.1 -pykwalify==1.7.0 -pymongo==3.8.0 -pyparsing==2.4.7 -pyrsistent==0.16.0 -PySocks==1.7.1 -python-crfsuite==0.9.7 -python-dateutil==2.8.1 -python-engineio==3.12.1 -python-socketio==4.5.1 -python-telegram-bot==12.7 -pytz==2019.3 -PyYAML==5.3.1 -questionary==1.5.2 -rasa==1.10.2 -rasa-sdk==1.10.1 -redis==3.5.2 -requests==2.23.0 -requests-oauthlib==1.3.0 -requests-toolbelt==0.9.1 -rfc3986==1.4.0 -rocketchat-API==1.3.1 -rsa==4.0 -ruamel.yaml==0.16.10 -ruamel.yaml.clib==0.2.0 -s3transfer==0.3.3 -sanic==19.12.2 -Sanic-Cors==0.10.0.post3 -sanic-jwt==1.4.1 -Sanic-Plugins-Framework==0.9.2 -scikit-learn==0.22.2.post1 -scipy==1.4.1 -sentry-sdk==0.15.1 -six==1.14.0 -sklearn-crfsuite==0.3.6 -slackclient==2.5.0 -sniffio==1.1.0 -SQLAlchemy==1.3.17 -tabulate==0.8.7 -tensorboard==2.1.1 -tensorflow==2.1.0 -tensorflow-addons==0.7.1 -tensorflow-estimator==2.1.0 -tensorflow-hub==0.8.0 -tensorflow-probability==0.9.0 -termcolor==1.1.0 -terminaltables==3.1.0 -tornado==6.0.4 -tqdm==4.45.0 -# Editable install with no version control (turn-rasa-connector==0.0.1) -twilio==6.26.3 -tzlocal==2.1 -ujson==2.0.3 -urllib3==1.25.9 -uvloop==0.14.0 -wcwidth==0.1.9 -webexteamssdk==1.3 -websockets==8.0.2 -Werkzeug==1.0.1 -wrapt==1.12.1 -yarl==1.4.2 -zipp==3.1.0 \ No newline at end of file +protobuf==3.19.4 +rasa==1.10.2 \ No newline at end of file