Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint errors on 3.10+ for auth protos #479

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,20 @@ disallow_any_expr = false
module = "momento.internal._utilities._momento_version"
ignore_errors = true

[[tool.mypy.overrides]]
# reading an enum in a protobuf generated class
module = "momento.internal._utilities._permissions"
ignore_errors = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_any_expr = false
disallow_any_decorated = false
disallow_untyped_decorators = false

[[tool.mypy.overrides]]
module = "tests.momento.auth_client.test_permissions"
ignore_errors = true

[tool.ruff]
select = [
Expand Down
2 changes: 1 addition & 1 deletion src/momento/internal/_utilities/_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SuperuserPermissions(PredefinedScope):

def permissions_from_permission_scope(scope: PermissionScope) -> permissions_pb.Permissions:
if isinstance(scope.permission_scope, SuperuserPermissions):
return permissions_pb.Permissions(super_user=permissions_pb.SuperUserPermissions.SuperUser)
return permissions_pb.Permissions(super_user=permissions_pb.SuperUserPermissions.SuperUser) # type: ignore[attr-defined,misc]
elif isinstance(scope.permission_scope, Permissions) and not isinstance(scope.permission_scope, PredefinedScope):
converted_perms = [
token_permission_to_grpc_permission(permission) for permission in scope.permission_scope.permissions
Expand Down
2 changes: 1 addition & 1 deletion tests/momento/auth_client/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def test_creates_expected_grpc_permissions_for_internal_superuser_permissions() -> None:
expected_permission = permissions_pb.Permissions(super_user=permissions_pb.SuperUserPermissions.SuperUser)
expected_permission = permissions_pb.Permissions(super_user=permissions_pb.SuperUserPermissions.SuperUser) # type: ignore[attr-defined]
constructed_permission = permissions_from_permission_scope(PermissionScope(SuperuserPermissions()))
assert expected_permission == constructed_permission

Expand Down
Loading