Skip to content

Commit

Permalink
Merge pull request #746 from praekeltfoundation/dependabot/pip/black-…
Browse files Browse the repository at this point in the history
…24.3.0

Bump black from 22.12.0 to 24.3.0
  • Loading branch information
erikh360 authored Mar 21, 2024
2 parents 5308ca7 + 1c8b8d7 commit 5f1a7ca
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 204 deletions.
204 changes: 42 additions & 162 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ requests = "^2.31.0"
websockets = "~10"

[tool.poetry.dev-dependencies]
black = "^22.8.0"
black = "^24.3.0"
isort = "^5.7.0"
flake8 = "^3.8.4"
pytest = "^7.2.0"
Expand Down
8 changes: 5 additions & 3 deletions vaccine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ def reply(self, content, continue_session=True, **kw):
if f in kw:
raise TypeError(f"{f} my not be overridden")
fields = {
"session_event": Message.SESSION_EVENT.NONE
if continue_session
else Message.SESSION_EVENT.CLOSE,
"session_event": (
Message.SESSION_EVENT.NONE
if continue_session
else Message.SESSION_EVENT.CLOSE
),
"to_addr": self.from_addr,
"from_addr": self.to_addr,
"group": self.group,
Expand Down
97 changes: 96 additions & 1 deletion vaccine/sacoronavirus_powerbi_request_body
Original file line number Diff line number Diff line change
@@ -1 +1,96 @@
{"version":"1.0.0","queries":[{"Query":{"Commands":[{"SemanticQueryDataShapeCommand":{"Query":{"Version":2,"From":[{"Name":"v","Entity":"Vaccinations Administered Measures","Type":0},{"Name":"r","Entity":"rtc za_covid19_province_vw","Type":0}],"Select":[{"Measure":{"Expression":{"SourceRef":{"Source":"v"}},"Property":"Total Vaccinations 1st & 2nd Dose & Booster Dose"},"Name":"Vaccinations Administered Measures.Total Vaccinations 1st & 2nd Dose & Booster Dose"}],"Where":[{"Condition":{"Not":{"Expression":{"In":{"Expressions":[{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"province"}}],"Values":[[{"Literal":{"Value":"null"}}]]}}}}}]},"Binding":{"Primary":{"Groupings":[{"Projections":[0]}]},"DataReduction":{"DataVolume":3,"Primary":{"Top":{}}},"Version":1},"ExecutionMetricsKind":1}}]},"CacheKey":"{\"Commands\":[{\"SemanticQueryDataShapeCommand\":{\"Query\":{\"Version\":2,\"From\":[{\"Name\":\"v\",\"Entity\":\"Vaccinations Administered Measures\",\"Type\":0},{\"Name\":\"r\",\"Entity\":\"rtc za_covid19_province_vw\",\"Type\":0}],\"Select\":[{\"Measure\":{\"Expression\":{\"SourceRef\":{\"Source\":\"v\"}},\"Property\":\"Total Vaccinations 1st & 2nd Dose & Booster Dose\"},\"Name\":\"Vaccinations Administered Measures.Total Vaccinations 1st & 2nd Dose & Booster Dose\"}],\"Where\":[{\"Condition\":{\"Not\":{\"Expression\":{\"In\":{\"Expressions\":[{\"Column\":{\"Expression\":{\"SourceRef\":{\"Source\":\"r\"}},\"Property\":\"province\"}}],\"Values\":[[{\"Literal\":{\"Value\":\"null\"}}]]}}}}}]},\"Binding\":{\"Primary\":{\"Groupings\":[{\"Projections\":[0]}]},\"DataReduction\":{\"DataVolume\":3,\"Primary\":{\"Top\":{}}},\"Version\":1},\"ExecutionMetricsKind\":1}}]}","QueryId":"","ApplicationContext":{"DatasetId":"6f42ba54-a8f6-46a6-afab-bedcd3dd1563","Sources":[{"ReportId":"f31bda4b-2754-475d-ad4b-e7ae4e213621","VisualId":"0c0297dfa5cd0e11eed9"}]}}],"cancelQueries":[],"modelId":4449930}
{
"version": "1.0.0",
"queries": [
{
"Query": {
"Commands": [
{
"SemanticQueryDataShapeCommand": {
"Query": {
"Version": 2,
"From": [
{
"Name": "v",
"Entity": "Vaccinations Administered Measures",
"Type": 0,
},
{
"Name": "r",
"Entity": "rtc za_covid19_province_vw",
"Type": 0,
},
],
"Select": [
{
"Measure": {
"Expression": {
"SourceRef": {"Source": "v"}
},
"Property": "Total Vaccinations 1st & 2nd Dose & Booster Dose",
},
"Name": "Vaccinations Administered Measures.Total Vaccinations 1st & 2nd Dose & Booster Dose",
}
],
"Where": [
{
"Condition": {
"Not": {
"Expression": {
"In": {
"Expressions": [
{
"Column": {
"Expression": {
"SourceRef": {
"Source": "r"
}
},
"Property": "province",
}
}
],
"Values": [
[
{
"Literal": {
"Value": "null"
}
}
]
],
}
}
}
}
}
],
},
"Binding": {
"Primary": {"Groupings": [{"Projections": [0]}]},
"DataReduction": {
"DataVolume": 3,
"Primary": {"Top": {}},
},
"Version": 1,
},
"ExecutionMetricsKind": 1,
}
}
]
},
"CacheKey": '{"Commands":[{"SemanticQueryDataShapeCommand":{"Query":{"Version":2,"From":[{"Name":"v","Entity":"Vaccinations Administered Measures","Type":0},{"Name":"r","Entity":"rtc za_covid19_province_vw","Type":0}],"Select":[{"Measure":{"Expression":{"SourceRef":{"Source":"v"}},"Property":"Total Vaccinations 1st & 2nd Dose & Booster Dose"},"Name":"Vaccinations Administered Measures.Total Vaccinations 1st & 2nd Dose & Booster Dose"}],"Where":[{"Condition":{"Not":{"Expression":{"In":{"Expressions":[{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"province"}}],"Values":[[{"Literal":{"Value":"null"}}]]}}}}}]},"Binding":{"Primary":{"Groupings":[{"Projections":[0]}]},"DataReduction":{"DataVolume":3,"Primary":{"Top":{}}},"Version":1},"ExecutionMetricsKind":1}}]}',
"QueryId": "",
"ApplicationContext": {
"DatasetId": "6f42ba54-a8f6-46a6-afab-bedcd3dd1563",
"Sources": [
{
"ReportId": "f31bda4b-2754-475d-ad4b-e7ae4e213621",
"VisualId": "0c0297dfa5cd0e11eed9",
}
],
},
}
],
"cancelQueries": [],
"modelId": 4449930,
}
18 changes: 9 additions & 9 deletions vaccine/tests/test_vaccine_reg_whatsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ def get_suburbs(request):
url = config.EVDS_URL
username = config.EVDS_USERNAME
password = config.EVDS_PASSWORD
s_config.EVDS_URL = (
m_config.EVDS_URL
) = config.EVDS_URL = f"http://{server.host}:{server.port}"
s_config.EVDS_URL = m_config.EVDS_URL = config.EVDS_URL = (
f"http://{server.host}:{server.port}"
)
s_config.EVDS_USERNAME = m_config.EVDS_USERNAME = config.EVDS_USERNAME = "test"
s_config.EVDS_PASSWORD = m_config.EVDS_PASSWORD = config.EVDS_PASSWORD = "test"
server.tstate = tstate
yield server
s_config.EVDS_URL = m_config.EVDS_URL = config.EVDS_URL = url
s_config.EVDS_USERNAME = (
m_config.EVDS_USERNAME
) = config.EVDS_USERNAME = username
s_config.EVDS_PASSWORD = (
m_config.EVDS_PASSWORD
) = config.EVDS_PASSWORD = password
s_config.EVDS_USERNAME = m_config.EVDS_USERNAME = config.EVDS_USERNAME = (
username
)
s_config.EVDS_PASSWORD = m_config.EVDS_PASSWORD = config.EVDS_PASSWORD = (
password
)


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion vaccine/vaccine_eligibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ async def check_age(content: Optional[str]):
except (ValueError, TypeError, AssertionError):
raise ErrorMessage("⚠️ Reply using numbers only. Example *27*")

progress_bar = "◼️◼️◼️◻️◻️"
return FreeText(
self,
question="\n".join(
["◼️◼️◼️◻️◻️", "", "How old are you? (Reply with a number)"]
[progress_bar, "", "How old are you? (Reply with a number)"]
),
next="state_location",
check=check_age,
Expand Down
6 changes: 3 additions & 3 deletions yal/tests/test_askaquestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def tester():
def get_rapidpro_contact(urn):
return {
"fields": {
"feedback_type": "ask_a_question"
if ("27820001001" in urn)
else "ask_a_question_2",
"feedback_type": (
"ask_a_question" if ("27820001001" in urn) else "ask_a_question_2"
),
"feedback_sent": "TRUE",
},
}
Expand Down
6 changes: 3 additions & 3 deletions yal/tests/test_change_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,9 @@ async def test_state_update_location_confirm_incorrect(
async def test_state_update_location_submit(tester: AppTester, rapidpro_mock):
tester.user.metadata["new_latitude"] = 56.78
tester.user.metadata["new_longitude"] = 12.34
tester.user.metadata[
"new_location_description"
] = "277 Bedford Avenue, Brooklyn, NY"
tester.user.metadata["new_location_description"] = (
"277 Bedford Avenue, Brooklyn, NY"
)
tester.setup_state("state_update_location_confirm")

await tester.user_input("yes")
Expand Down
36 changes: 18 additions & 18 deletions yal/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ async def test_state_start_to_mainmenu(
rapidpro_mock.tstate.contact_fields["terms_accepted"] = "TRUE"
rapidpro_mock.tstate.contact_fields["latitude"] = "-26.2031026"
rapidpro_mock.tstate.contact_fields["longitude"] = "28.0251783"
rapidpro_mock.tstate.contact_fields[
"location_description"
] = "99 high level, cape town, FS"
rapidpro_mock.tstate.contact_fields["location_description"] = (
"99 high level, cape town, FS"
)
await tester.user_input("hi")
tester.assert_state("state_mainmenu")
tester.assert_num_messages(2)
Expand Down Expand Up @@ -506,9 +506,9 @@ async def test_assessment_reminder_keywords(
rapidpro_mock.tstate.contact_fields["onboarding_completed"] = True
rapidpro_mock.tstate.contact_fields["terms_accepted"] = True
rapidpro_mock.tstate.contact_fields["assessment_reminder_sent"] = True
rapidpro_mock.tstate.contact_fields[
"assessment_reminder_name"
] = "locus_of_control_endline"
rapidpro_mock.tstate.contact_fields["assessment_reminder_name"] = (
"locus_of_control_endline"
)

await tester.user_input("continue now")
tester.assert_state("state_relationship_status_endline")
Expand Down Expand Up @@ -1070,9 +1070,9 @@ async def test_aaq_timeout_response_to_handler(
):
rapidpro_mock.tstate.contact_fields["feedback_survey_sent"] = "TRUE"
rapidpro_mock.tstate.contact_fields["feedback_type"] = "ask_a_question_2"
rapidpro_mock.tstate.contact_fields[
"feedback_timestamp"
] = get_current_datetime().isoformat()
rapidpro_mock.tstate.contact_fields["feedback_timestamp"] = (
get_current_datetime().isoformat()
)
tester.user.metadata["inbound_id"] = "inbound-id"
tester.user.metadata["feedback_secret_key"] = "feedback-secret-key"
tester.user.metadata["faq_id"] = "1"
Expand Down Expand Up @@ -1107,9 +1107,9 @@ async def test_content_feedback_response(tester: AppTester, rapidpro_mock):
If this is in response to a content feedback push message, then it should be handled
by the content feedback state
"""
rapidpro_mock.tstate.contact_fields[
"feedback_timestamp"
] = get_current_datetime().isoformat()
rapidpro_mock.tstate.contact_fields["feedback_timestamp"] = (
get_current_datetime().isoformat()
)
rapidpro_mock.tstate.contact_fields["feedback_type"] = "content"
rapidpro_mock.tstate.contact_fields["feedback_survey_sent"] = "TRUE"
await tester.user_input("1")
Expand All @@ -1126,9 +1126,9 @@ async def test_facebook_crossover_feedback_response(tester: AppTester, rapidpro_
by the fb feedback state
"""
# Test session resume
rapidpro_mock.tstate.contact_fields[
"feedback_timestamp"
] = get_current_datetime().isoformat()
rapidpro_mock.tstate.contact_fields["feedback_timestamp"] = (
get_current_datetime().isoformat()
)
rapidpro_mock.tstate.contact_fields["feedback_type"] = "facebook_banner"
rapidpro_mock.tstate.contact_fields["feedback_survey_sent"] = "TRUE"
await tester.user_input("yes, I did")
Expand All @@ -1145,9 +1145,9 @@ async def test_servicefinder_feedback_response(tester: AppTester, rapidpro_mock)
handled by the servicefinder feedback application
"""
rapidpro_mock.tstate.contact_fields["feedback_type"] = "servicefinder"
rapidpro_mock.tstate.contact_fields[
"feedback_timestamp"
] = get_current_datetime().isoformat()
rapidpro_mock.tstate.contact_fields["feedback_timestamp"] = (
get_current_datetime().isoformat()
)
rapidpro_mock.tstate.contact_fields["feedback_survey_sent"] = "TRUE"
# test new session
await tester.user_input("yes, thanks", session=Message.SESSION_EVENT.NEW)
Expand Down
6 changes: 3 additions & 3 deletions yal/tests/test_onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ async def test_assessment_complete(tester: AppTester, rapidpro_mock):
"""
Start pushmessage optin flow after assessment
"""
tester.user.metadata[
"assessment_end_state"
] = "state_locus_of_control_assessment_end"
tester.user.metadata["assessment_end_state"] = (
"state_locus_of_control_assessment_end"
)
tester.user.metadata["assessment_section"] = 2
tester.setup_state("state_survey_question")
await tester.user_input(session=Message.SESSION_EVENT.NEW)
Expand Down

0 comments on commit 5f1a7ca

Please sign in to comment.