Skip to content

Commit f055326

Browse files
MarcelGeowonder-sk
authored andcommitted
Try black formating
1 parent a33443e commit f055326

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

mergin/client.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,7 @@ def set_project_access(self, project_path, access):
763763
:param project_path: project full name (<namespace>/<name>)
764764
:param access: dict <readersnames, editorsnames, writersnames, ownersnames> -> list of str username we want to give access to (editorsnames are only supported on servers at version 2024.4.0 or later)
765765
"""
766-
if "editorsnames" in access and not is_version_acceptable(
767-
self.server_version(), "2024.4"
768-
):
766+
if "editorsnames" in access and not is_version_acceptable(self.server_version(), "2024.4"):
769767
raise NotImplementedError("Editors are only supported on servers at version 2024.4.0 or later")
770768

771769
if not self._user_info:
@@ -792,8 +790,7 @@ def add_user_permissions_to_project(self, project_path, usernames, permission_le
792790
Editor permission_level is only supported on servers at version 2024.4.0 or later.
793791
"""
794792
if permission_level not in ["owner", "reader", "writer", "editor"] or (
795-
permission_level == "editor"
796-
and not is_version_acceptable(self.server_version(), "2024.4")
793+
permission_level == "editor" and not is_version_acceptable(self.server_version(), "2024.4")
797794
):
798795
raise ClientError("Unsupported permission level")
799796

@@ -841,7 +838,7 @@ def project_user_permissions(self, project_path):
841838
project_info = self.project_info(project_path)
842839
access = project_info.get("access")
843840
result = {}
844-
if ("editorsnames" in access):
841+
if "editorsnames" in access:
845842
result["editors"] = access.get("editorsnames", [])
846843

847844
result["owners"] = access.get("ownersnames", [])

mergin/test/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ def server_has_editor_support(mc, access):
9797
Returns:
9898
bool: True if the server has editor support, False otherwise.
9999
"""
100-
return "editorsnames" in access and is_version_acceptable(
101-
mc.server_version(), "2024.4"
102-
)
100+
return "editorsnames" in access and is_version_acceptable(mc.server_version(), "2024.4")
103101

104102
def test_login(mc):
105103
token = mc._auth_session["token"]
@@ -682,6 +680,7 @@ def test_set_read_write_access(mc):
682680
if editor_support:
683681
assert API_USER2 in access["editorsnames"]
684682

683+
685684
def test_set_editor_access(mc):
686685
test_project = "test_set_editor_access"
687686
test_project_fullname = API_USER + "/" + test_project
@@ -698,7 +697,8 @@ def test_set_editor_access(mc):
698697
# Stop test if server does not support editor access
699698
if not server_has_editor_support(mc, access):
700699
return
701-
700+
701+
702702
access["readersnames"].append(API_USER2)
703703
access["editorsnames"].append(API_USER2)
704704
mc.set_project_access(test_project_fullname, access)

0 commit comments

Comments
 (0)