Skip to content

Commit 786930c

Browse files
committed
clean up in remove()
1 parent 8e749fe commit 786930c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pyicloud/services/drive.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ def type(self):
279279
node_type = self.data.get("type")
280280
return node_type and node_type.lower()
281281

282-
def get_children(self):
282+
def get_children(self, force=False):
283283
"""Gets the node children."""
284-
if not self._children:
285-
if "items" not in self.data:
284+
if not self._children or force:
285+
if "items" not in self.data or force:
286286
self.data.update(self.connection.get_node_data(self.data["docwsid"]))
287287
if "items" not in self.data:
288288
raise KeyError("No items in folder, status: %s" % self.data["status"])
@@ -303,6 +303,14 @@ def reget_children(self):
303303
]
304304
return self._children
305305

306+
def remove(self, child):
307+
for item_data in self.data['items']:
308+
if item_data['docwsid'] == child.data['docwsid']:
309+
self.data['items'].remove(item_data)
310+
break
311+
self._children.remove(child)
312+
return
313+
306314
@property
307315
def size(self):
308316
"""Gets the node size."""

0 commit comments

Comments
 (0)