aldict 1.1.0__py3-none-any.whl → 1.1.1__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.
- aldict/__init__.py +1 -1
- {aldict-1.1.0.dist-info → aldict-1.1.1.dist-info}/METADATA +29 -29
- aldict-1.1.1.dist-info/RECORD +8 -0
- aldict-1.1.0.dist-info/RECORD +0 -8
- {aldict-1.1.0.dist-info → aldict-1.1.1.dist-info}/WHEEL +0 -0
- {aldict-1.1.0.dist-info → aldict-1.1.1.dist-info}/entry_points.txt +0 -0
- {aldict-1.1.0.dist-info → aldict-1.1.1.dist-info}/licenses/LICENSE +0 -0
aldict/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aldict
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Multi-key dictionary, supports adding and manipulating key-aliases pointing to shared values
|
|
5
5
|
Keywords: multi-key dictionary,multidict,alias-dict
|
|
6
6
|
Author-Email: kaliv0 <kaloyan.ivanov88@gmail.com>
|
|
@@ -104,11 +104,6 @@ ad.items()
|
|
|
104
104
|
ad.pop("y")
|
|
105
105
|
assert list(ad.items()) == [('x', 10), ('Xx', 10)]
|
|
106
106
|
```
|
|
107
|
-
- origin_keys
|
|
108
|
-
<br>(get original <i>keys</i> only)
|
|
109
|
-
```python
|
|
110
|
-
assert list(ad.origin_keys()) == ['x', 'y']
|
|
111
|
-
```
|
|
112
107
|
- origin_len
|
|
113
108
|
<br>(get original dict <i>length</i> without aliases)
|
|
114
109
|
```python
|
|
@@ -118,30 +113,10 @@ assert list(ad.keys()) == ["a", "b", "aa"]
|
|
|
118
113
|
assert len(ad) == 3
|
|
119
114
|
assert ad.origin_len() == 2
|
|
120
115
|
```
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
ad = AliasDict({"a": 1, "b": 2})
|
|
124
|
-
ad.add_alias("a", "aa")
|
|
125
|
-
ad_copy = ad.copy()
|
|
126
|
-
assert ad_copy == ad
|
|
127
|
-
assert ad_copy is not ad
|
|
128
|
-
```
|
|
129
|
-
- merge with | and |= operators
|
|
130
|
-
```python
|
|
131
|
-
ad1 = AliasDict({"a": 1}, aliases={"a": ["aa"]})
|
|
132
|
-
ad2 = AliasDict({"b": 2}, aliases={"b": ["bb"]})
|
|
133
|
-
|
|
134
|
-
merged = ad1 | ad2
|
|
135
|
-
assert merged["aa"] == 1
|
|
136
|
-
assert merged["bb"] == 2
|
|
137
|
-
|
|
138
|
-
ad1 |= {"c": 3}
|
|
139
|
-
assert ad1["c"] == 3
|
|
140
|
-
```
|
|
141
|
-
- fromkeys
|
|
116
|
+
- origin_keys
|
|
117
|
+
<br>(get original <i>keys</i> only)
|
|
142
118
|
```python
|
|
143
|
-
ad
|
|
144
|
-
assert ad["a"] == ad["aa"] == 0
|
|
119
|
+
assert list(ad.origin_keys()) == ['x', 'y']
|
|
145
120
|
```
|
|
146
121
|
- origin_key
|
|
147
122
|
<br>(get original <i>key</i> for an <i>alias</i>)
|
|
@@ -167,3 +142,28 @@ ad.add_alias("a", "aa")
|
|
|
167
142
|
assert ad.has_aliases("a") is True
|
|
168
143
|
assert ad.has_aliases("b") is False
|
|
169
144
|
```
|
|
145
|
+
- copy
|
|
146
|
+
```python
|
|
147
|
+
ad = AliasDict({"a": 1, "b": 2})
|
|
148
|
+
ad.add_alias("a", "aa")
|
|
149
|
+
ad_copy = ad.copy()
|
|
150
|
+
assert ad_copy == ad
|
|
151
|
+
assert ad_copy is not ad
|
|
152
|
+
```
|
|
153
|
+
- merge with | and |= operators
|
|
154
|
+
```python
|
|
155
|
+
ad1 = AliasDict({"a": 1}, aliases={"a": ["aa"]})
|
|
156
|
+
ad2 = AliasDict({"b": 2}, aliases={"b": ["bb"]})
|
|
157
|
+
|
|
158
|
+
merged = ad1 | ad2
|
|
159
|
+
assert merged["aa"] == 1
|
|
160
|
+
assert merged["bb"] == 2
|
|
161
|
+
|
|
162
|
+
ad1 |= {"c": 3}
|
|
163
|
+
assert ad1["c"] == 3
|
|
164
|
+
```
|
|
165
|
+
- fromkeys
|
|
166
|
+
```python
|
|
167
|
+
ad = AliasDict.fromkeys(["a", "b", "c"], 0, aliases={"a": ["aa"]})
|
|
168
|
+
assert ad["a"] == ad["aa"] == 0
|
|
169
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
aldict-1.1.1.dist-info/METADATA,sha256=nRJAZ0Ra2gbzejZufFJxyp8HAftTQ5I63zJYrdP7UIk,4882
|
|
2
|
+
aldict-1.1.1.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
|
|
3
|
+
aldict-1.1.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
aldict-1.1.1.dist-info/licenses/LICENSE,sha256=frOVyHZrx5o-fh5xC-kggT3MaLdp6yxV_YGpVXFHFSQ,1071
|
|
5
|
+
aldict/__init__.py,sha256=6dHZU-HPKpqt6z5bX4-zWA0Vy7Wm2emhnmO4aEnaRXk,233
|
|
6
|
+
aldict/alias_dict.py,sha256=O4EGRp-VtW1Mb-Fr1-_VDkPof6G9UBYYhx5l2I8FKck,5934
|
|
7
|
+
aldict/exception.py,sha256=rFNmv9HuUOn2toPVYpVPQq6SOsl8nvwtJpGhPkK1puQ,83
|
|
8
|
+
aldict-1.1.1.dist-info/RECORD,,
|
aldict-1.1.0.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
aldict-1.1.0.dist-info/METADATA,sha256=AzRxupLUAta9ULmLVV1adUjoMswf7f7obMq7m_IRZlI,4882
|
|
2
|
-
aldict-1.1.0.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
|
|
3
|
-
aldict-1.1.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
-
aldict-1.1.0.dist-info/licenses/LICENSE,sha256=frOVyHZrx5o-fh5xC-kggT3MaLdp6yxV_YGpVXFHFSQ,1071
|
|
5
|
-
aldict/__init__.py,sha256=16jYDIi10e4UnbxjdFsssrt4dgUpsgb3h8cDD7U4EzQ,233
|
|
6
|
-
aldict/alias_dict.py,sha256=O4EGRp-VtW1Mb-Fr1-_VDkPof6G9UBYYhx5l2I8FKck,5934
|
|
7
|
-
aldict/exception.py,sha256=rFNmv9HuUOn2toPVYpVPQq6SOsl8nvwtJpGhPkK1puQ,83
|
|
8
|
-
aldict-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|