-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
197 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
from typing import Any, Dict, List, Optional, Tuple | ||
from typing import List, Optional, Tuple | ||
|
||
|
||
def calculate_inherited_groups_helper( | ||
access_group_ids: Optional[List[int]], | ||
parent_is_public: Optional[bool], | ||
parent_inherited_access_group_ids: Optional[List[int]], | ||
) -> Tuple[bool, Optional[List[int]]]: | ||
|
||
parent: Dict[str, Any] = dict() | ||
parent["inherited_access_group_ids"] = parent_inherited_access_group_ids | ||
parent["is_public"] = parent_is_public | ||
|
||
if not parent["inherited_access_group_ids"]: | ||
inherited_access_group_ids = access_group_ids | ||
elif not access_group_ids: | ||
inherited_access_group_ids = parent.get("inherited_access_group_ids", []) | ||
else: | ||
) -> Tuple[bool, List[int]]: | ||
inherited_access_group_ids: List[int] | ||
if parent_inherited_access_group_ids and access_group_ids: | ||
inherited_access_group_ids = [ | ||
id_ | ||
for id_ in access_group_ids | ||
if id_ in parent.get("inherited_access_group_ids", []) | ||
id_ for id_ in access_group_ids if id_ in parent_inherited_access_group_ids | ||
] | ||
is_public = not bool(inherited_access_group_ids) and bool(parent["is_public"]) | ||
elif access_group_ids: | ||
inherited_access_group_ids = access_group_ids | ||
elif parent_inherited_access_group_ids: | ||
inherited_access_group_ids = parent_inherited_access_group_ids | ||
else: | ||
inherited_access_group_ids = [] | ||
is_public = not bool(inherited_access_group_ids) and parent_is_public is not False | ||
return is_public, inherited_access_group_ids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.