Skip to content

Commit

Permalink
Upgrade mypy t 1.5 (#1964)
Browse files Browse the repository at this point in the history
* upgrade mypy

* Upgrade mypy

* fix

* fix mypy issueS

* formatting

* try

* fix
  • Loading branch information
jzbahrai authored Aug 25, 2023
1 parent b21c966 commit f201dad
Show file tree
Hide file tree
Showing 9 changed files with 481 additions and 3,017 deletions.
2 changes: 1 addition & 1 deletion app/celery/scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def check_job_status():

# temporarily mark them as ERROR so that they don't get picked up by future check_job_status tasks
# if they haven't been re-processed in time.
job_ids: List[str] = []
job_ids: List[str] = [] # type: ignore
for job in jobs_not_complete_after_30_minutes:
job.job_status = JOB_STATUS_ERROR
dao_update_job(job)
Expand Down
6 changes: 3 additions & 3 deletions app/celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def save_smss(self, service_id: Optional[str], signed_notifications: List[Signed
"template_version": template.version,
"recipient": _notification.get("to"),
"personalisation": _notification.get("personalisation"),
"notification_type": SMS_TYPE,
"notification_type": SMS_TYPE, # type: ignore
"simulated": _notification.get("simulated", None),
"api_key_id": _notification.get("api_key", None),
"created_at": datetime.utcnow(),
Expand All @@ -278,7 +278,7 @@ def save_smss(self, service_id: Optional[str], signed_notifications: List[Signed

verified_notifications.append(notification)
notification_id_queue[notification_id] = notification.get("queue") # type: ignore
process_type = template.process_type
process_type = template.process_type # type: ignore

try:
# If the data is not present in the encrypted data then fallback on whats needed for process_job.
Expand Down Expand Up @@ -379,7 +379,7 @@ def save_emails(self, _service_id: Optional[str], signed_notifications: List[Sig
"template_version": template.version,
"recipient": _notification.get("to"),
"personalisation": _notification.get("personalisation"),
"notification_type": EMAIL_TYPE,
"notification_type": EMAIL_TYPE, # type: ignore
"simulated": _notification.get("simulated", None),
"api_key_id": _notification.get("api_key", None),
"created_at": datetime.utcnow(),
Expand Down
4 changes: 2 additions & 2 deletions app/json_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
def default_encoder(o):
# Support for sqlalchemy.engine.row.Row
if isinstance(o, Row):
row: Row = o
m: dict = row._asdict()
row: Row = o # type: ignore
m: dict = row._asdict() # type: ignore
return m
# Redirect to default
return _default(o)
Expand Down
72 changes: 32 additions & 40 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ rfc3987 = "1.3.8"
jinja2-cli = { extras = ["yaml"], version = "0.8.2" }
black = "23.7.0"
locust = "2.16.1"
mypy = "0.991"
mypy = "1.5"
sqlalchemy-stubs = "0.4"
sqlalchemy2-stubs = "0.0.2a34"
networkx = "2.8.8" # not directly required, pinned by Snyk to avoid a vulnerability
Expand Down
2 changes: 1 addition & 1 deletion tests/app/aws/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class TestBatchSavingMetricsFunctions:
@pytest.fixture(autouse=True)
def app(self):
config: Config = Test()
config: Config = Test() # type: ignore
config.REDIS_ENABLED = True
app = Flask(config.NOTIFY_ENVIRONMENT)
create_app(app, config)
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_json_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ def row(self, mocker):

def test_serialization_row(self, notify_api, row):
jp = NotifyJSONProvider(notify_api)
serialized: str = jp.dumps(row)
serialized: str = jp.dumps(row) # type: ignore
assert '{"key1": "value1", "key2": "value2"}' in serialized
4 changes: 2 additions & 2 deletions tests/app/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_when_get_inflight_name_suffix_process_type_is_supplied(self):
class TestRedisQueue:
@pytest.fixture(autouse=True)
def app(self):
config: Config = Test()
config: Config = Test() # type: ignore
config.REDIS_ENABLED = True
app = Flask(config.NOTIFY_ENVIRONMENT)
create_app(app, config)
Expand Down Expand Up @@ -344,7 +344,7 @@ def test_acknowledged_messages(self, mock_queue):
class TestRedisQueueMetricUsage:
@pytest.fixture(autouse=True)
def app(self):
config: Config = Test()
config: Config = Test() # type: ignore
config.REDIS_ENABLED = True
app = Flask(config.NOTIFY_ENVIRONMENT)
create_app(app, config)
Expand Down
Loading

0 comments on commit f201dad

Please sign in to comment.