cdxcore 0.1.6__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cdxcore might be problematic. Click here for more details.

cdxcore/prettyobject.py DELETED
@@ -1,64 +0,0 @@
1
- """
2
- Prettydict
3
- Objects like dictionaries
4
- Hans Buehler 2025
5
- """
6
-
7
- from collections.abc import Mapping
8
-
9
- class PrettyObject(Mapping):
10
- """
11
- Object base class to minimc an unordered dictionary.
12
- Explicit object version of the implied PrettyDict.
13
-
14
- Usage pattern:
15
-
16
- class M( PrettyObject ):
17
- pass
18
-
19
- m = M()
20
- m.x = 1 # standard object handling
21
- m['y'] = 1 # mimic dictionary
22
- print( m['x'] ) # mimic dictionary
23
- print( m.y ) # standard object handling
24
-
25
- Mimics a dictionary:
26
-
27
- u = dict( m )
28
- print(u) --> {'x': 1, 'y': 2}
29
-
30
- u = { k: 2*v for k,v in m.items() }
31
- print(u) --> {'x': 2, 'y': 4}
32
-
33
- l = list( m )
34
- print(l) --> ['x', 'y']
35
- """
36
- def __init__(self, **kwargs):
37
- for k, v in kwargs.items():
38
- setattr(self, k, v)
39
-
40
- def __getitem__(self, key):
41
- return getattr( self, key )
42
- def __setitem__(self,key,value):
43
- setattr(self, key, value)
44
- return self[key]
45
- def __delitem__(self,key):
46
- delattr(self, key)
47
- def __iter__(self):
48
- return self.__dict__.__iter__()
49
- def __contains__(self, key):
50
- return self.__dict__.__contains__(key)
51
- def __len__(self):
52
- return self.__dict__.__len__()
53
-
54
- def keys(self):
55
- return self.__dict__.keys()
56
- def items(self):
57
- return self.__dict__.items()
58
- def values(self):
59
- return self.__dict__.values()
60
-
61
- def __repr__(self):
62
- return f"PrettyObject({self.__dict__.__repr__()})"
63
- def __str__(self):
64
- return self.__dict__.__str__()