Skip to content

Commit

Permalink
Tweak mypy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed May 14, 2024
1 parent ea7ac53 commit 21bde76
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lms/services/application_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def create_application_instance( # pylint:disable=too-many-arguments
"Hypothesis" + secrets.token_hex(16) if not deployment_id else None
)

application_instance = ApplicationInstance( # type: ignore
application_instance = ApplicationInstance(
name=name,
consumer_key=consumer_key,
shared_secret=secrets.token_hex(32),
Expand Down
4 changes: 2 additions & 2 deletions lms/services/lti_role_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_roles(self, role_description: str) -> list[LTIRole]:
role.update_from_value()

if missing := (set(role_strings) - set(role.value for role in roles)):
new_roles = [LTIRole(value=value) for value in missing] # type: ignore
new_roles = [LTIRole(value=value) for value in missing]
self._db.add_all(new_roles)

roles.extend(new_roles)
Expand All @@ -43,7 +43,7 @@ def get_roles_for_application_instance(
) -> list[Role]:
self._db.flush() # Make sure roles have IDs
# pylint:disable=no-member
overrides = self._db.execute( # type: ignore
overrides = self._db.execute(
select(
LTIRole.value.label("value"),
func.coalesce(LTIRoleOverride.type, LTIRole.type).label("type"),
Expand Down
3 changes: 1 addition & 2 deletions lms/services/lti_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ def serialize(lti_user: LTIUser) -> dict:
},
}

def deserialize(self, **kwargs: dict) -> LTIUser: # type: ignore
def deserialize(self, **kwargs: dict) -> LTIUser:
"""Create an LTIUser based on kwargs."""
# type: ignore
application_instance = self._application_instance_service.get_for_launch(
kwargs["application_instance_id"] # type: ignore
)
Expand Down
2 changes: 1 addition & 1 deletion lms/views/admin/_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def deserialize(self, value, attr, data, **kwargs):
# pylint:disable=compare-to-empty-string
if value == missing or value.strip() == "":
return None
return super().deserialize(value, attr, data, **kwargs) # type: ignore
return super().deserialize(value, attr, data, **kwargs)


class EmptyStringInt(EmptyStringNoneMixin, fields.Int): # type: ignore
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ project_type = "application"

[tool.mypy]
python_version = 3.11
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true


disable_error_code = [
"import-untyped",
Expand Down

0 comments on commit 21bde76

Please sign in to comment.