Skip to content

Commit 14339fb

Browse files
committed
ComplexObject no longer inherits MutableMapping as it clearly is not a dictionary-like class, it only features some dictionary-like access for custom fragments.
1 parent 7fff167 commit 14339fb

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
## Work in progress
55

6+
* Reverted changes in ComplexObject - a ComplexObject is not a dictionary-like class, it only
7+
supports some dictionary-like access functions. But, for instance, updating a ComplexObject
8+
is very different from updating a dictionary. Hence, it no longer inherits MutableMapping.
69

710
## Version 1.3.2
811

c8y_api/model/_base.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _delete(self):
297297
self.c8y.delete(self._build_object_path())
298298

299299

300-
class ComplexObject(SimpleObject, MutableMapping):
300+
class ComplexObject(SimpleObject):
301301
"""Abstract base class for all complex cumulocity objects
302302
(that can have custom fragments)."""
303303

@@ -432,15 +432,6 @@ def _apply_to(self, other_id: str) -> Any[ComplexObject]:
432432
result.c8y = self.c8y
433433
return result
434434

435-
def __delitem__(self, _):
436-
raise NotImplementedError
437-
438-
def __iter__(self):
439-
return iter(self.fragments)
440-
441-
def __len__(self):
442-
return len(self.fragments)
443-
444435

445436
class CumulocityResource:
446437
"""Abstract base class for all Cumulocity API resources."""

0 commit comments

Comments
 (0)