Skip to content

Commit

Permalink
test: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-pisman committed Oct 4, 2023
1 parent 581249f commit 46dd4e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/unipoll_api/actions/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async def get_policies(policy_holder: Account | Group | None = None,

# Helper function to get policies from a resource
async def get_policies_from_resource(resource: Resource) -> list[Policy]:
req_permissions = None
req_permissions: Permissions.Permissions | None = None
if resource.resource_type == "workspace":
req_permissions = Permissions.WorkspacePermissions["get_workspace_policies"]
elif resource.resource_type == "group":
Expand Down Expand Up @@ -59,7 +59,7 @@ async def get_policy(policy: Policy) -> PolicySchemas.PolicyShort:
if not policy_holder:
raise PolicyExceptions.PolicyHolderNotFound(ph_ref)

policy_holder = MemberSchemas.Member(**policy_holder.dict())
policy_holder = MemberSchemas.Member(**policy_holder.dict()) # type: ignore
permissions = Permissions.WorkspacePermissions(policy.permissions).name.split('|') # type: ignore
return PolicySchemas.PolicyShort(id=policy.id,
policy_holder_type=policy.policy_holder_type,
Expand Down
3 changes: 2 additions & 1 deletion src/unipoll_api/actions/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ async def get_polls(workspace: Workspace | None = None) -> PollSchemas.PollList:
if Permissions.check_permission(permissions, req_permissions):
poll_list.append(poll)
# Build poll list and return the result
poll_list = [PollSchemas.PollShort(**poll.dict(exclude={'questions', 'policies'})) for poll in poll_list]
for poll in poll_list:
poll_list.append(PollSchemas.PollShort(**poll.dict())) # type: ignore
return PollSchemas.PollList(polls=poll_list)


Expand Down

0 comments on commit 46dd4e8

Please sign in to comment.