Skip to content

Commit

Permalink
style: fixed flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-pisman committed Oct 5, 2023
1 parent 51f81a1 commit 41f5339
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/unipoll_api/actions/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ async def get_group(group: Group, include_members: bool = False, include_policie
members = (await get_group_members(group)).members if include_members else None
policies = (await get_group_policies(group)).policies if include_policies else None
workspace = WorkspaceSchemas.Workspace(**group.workspace.model_dump(exclude={"members", # type: ignore
"policies",
"groups"}))
"policies",
"groups"}))
# Return the workspace with the fetched resources
return GroupSchemas.Group(id=group.id,
name=group.name,
Expand Down
8 changes: 4 additions & 4 deletions src/unipoll_api/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def remove_member(self, account, save: bool = True) -> bool:
for i, member in enumerate(self.members):
if account.id == member.id: # type: ignore
self.members.remove(member)
Debug.info(f"Removed member {member.id} from {self.resource_type} {self.id}") # type: ignore
Debug.info(f"Removed member {member.id} from {self.resource_type} {self.id}")
break

# Remove the policy from the group
Expand Down Expand Up @@ -103,22 +103,22 @@ class Workspace(Resource):

class Group(Resource):
resource_type: Literal["group"] = "group"
workspace: BackLink[Workspace] = Field(original_field="groups") # type: ignore
workspace: BackLink[Workspace] = Field(original_field="groups")
members: list[Link["Account"]] = []
groups: list[Link["Group"]] = []


class Policy(Document):
id: ResourceID = Field(default_factory=ResourceID, alias="_id")
parent_resource: BackLink["Workspace"] | BackLink["Group"] | BackLink["Poll"] = Field(original_field="policies") # type: ignore
parent_resource: BackLink["Workspace"] | BackLink["Group"] | BackLink["Poll"] = Field(original_field="policies")
policy_holder_type: Literal["account", "group"]
policy_holder: Link["Group"] | Link["Account"]
permissions: int


class Poll(Resource):
id: ResourceID = Field(default_factory=ResourceID, alias="_id")
workspace: BackLink["Workspace"] = Field(original_field="polls") # type: ignore
workspace: BackLink["Workspace"] = Field(original_field="polls")
resource_type: Literal["poll"] = "poll"
public: bool
published: bool
Expand Down
2 changes: 1 addition & 1 deletion src/unipoll_api/routes/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
response_model=AccountSchemas.AccountList)
async def get_all_accounts():
try:
accounts = [AccountSchemas.AccountShort(**account.model_dump()) for account in await Account.find_all().to_list()]
accounts = [AccountSchemas.AccountShort(**a.model_dump()) for a in await Account.find_all().to_list()]
return AccountSchemas.AccountList(accounts=accounts)
except APIException as e:
raise HTTPException(status_code=e.code, detail=str(e))
Expand Down

0 comments on commit 41f5339

Please sign in to comment.