Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 13, 2024
1 parent 6e68f87 commit 1684e10
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/jupytercad_lab/jupytercad_lab/notebook/cad_document.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import annotations
from copy import deepcopy

import json
import logging
Expand Down Expand Up @@ -178,7 +177,9 @@ def get_object_by_name(self, object_name: str) -> Optional[Dict]:
return obj
return None

def update_object_by_name(self, transaction, object_name: str, updated_obj: Dict) -> None:
def update_object_by_name(
self, transaction, object_name: str, updated_obj: Dict
) -> None:
"""
Update an object by its name within a transaction.
Expand All @@ -204,13 +205,13 @@ def set_color(self, object_name: str, color: Optional[List]) -> None:
"""
if self.check_exist(object_name):
obj = self.get_object_by_name(object_name)

if obj:
with self.ydoc.transaction() as t:
if color is not None:
obj['color'] = color
obj["color"] = color
else:
obj.pop('color', None)
obj.pop("color", None)

self.update_object_by_name(t, object_name, obj)

Expand Down

0 comments on commit 1684e10

Please sign in to comment.