You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -408,12 +409,16 @@ On MacOS Mojave some user experience difficulty when installing Murmur3.
408
409
409
410
The problem can be solved by running:
410
411
411
-
`xcode-select --install`
412
+
`xcode-select --install`
412
413
413
-
And then running `pip install mmh3`
414
+
And then running
415
+
416
+
`pip install mmh3`
414
417
415
418
# ChangeLog
416
419
420
+
- v4-0-4: Adding ignore_string_case and ignore_type_subclasses
421
+
- v4-0-3: Adding versionbump tool for release
417
422
- v4-0-2: Fixing installation issue where rst files are missing.
418
423
- v4-0-1: Fixing installation Tarball missing requirements.txt . DeepDiff v4+ should not show up as pip installable for Py2. Making Murmur3 installation optional.
419
424
- v4-0-0: Ending Python 2 support, Adding more functionalities and documentation for DeepHash. Switching to Pytest for testing. Switching to Murmur3 128bit for hashing. Fixing classes which inherit from classes with slots didn't have all of their slots compared. Renaming ContentHash to DeepHash. Adding exclude by path and regex path to DeepHash. Adding ignore_type_in_groups. Adding match_string to DeepSearch. Adding Timedelta object diffing.
@@ -448,6 +453,16 @@ And then running `pip install mmh3`
logger.warning('Can not find Murmur3 hashing installed. Switching to SHA256 as the default hash. Refer to https://github.com/seperman/deepdiff#murmur3 for more info.')
Copy file name to clipboardExpand all lines: deepdiff/deephash_doc.rst
+67-14Lines changed: 67 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ At the core of it, DeepHash is a deterministic serialization of your object into
10
10
can be passed to a hash function. By default it uses Murmur 3 128 bit hash function which is a
11
11
fast, non-cryptographic hashing function. You have the option to pass any another hashing function to be used instead.
12
12
13
-
If it can't find Murmur3 package (mmh3) installed, it uses Python's built-in SHA256 for hashing which is considerably slower than Murmur3. So it is advised that you install Murmur3 by running `pip install mmh3`
13
+
If it can't find Murmur3 package (mmh3) installed, it uses Python's built-in SHA256 for hashing which is considerably slower than Murmur3. So it is advised that you install Murmur3 by running `pip install 'deepdiff[murmur]`
14
14
15
15
**Import**
16
16
>>> from deepdiff import DeepHash
@@ -138,6 +138,15 @@ ignore_type_in_groups example with custom objects:
138
138
>>> d1[burrito] == d2[taco]
139
139
True
140
140
141
+
142
+
ignore_type_subclasses
143
+
Use ignore_type_subclasses=True so when ignoring type (class), the subclasses of that class are ignored too.
144
+
145
+
146
+
ignore_string_case
147
+
Whether to be case-sensitive or not when comparing strings. By settings ignore_string_case=False, strings will be compared case-insensitively.
148
+
149
+
141
150
**Returns**
142
151
A dictionary of {item: item hash}.
143
152
If your object is nested, it will build hashes of all the objects it contains too.
DeepHash is calculating the hash of the obj and any other object that obj contains.
166
-
The output of DeepHash is a dictionary of object IDs to their hashes.
167
-
In order to get the hash of obj itself, you need to use the object (or the id of object) to get its hash:
173
+
So what is exactly the hash of obj in this case?
174
+
DeepHash is calculating the hash of the obj and any other object that obj contains.
175
+
The output of DeepHash is a dictionary of object IDs to their hashes.
176
+
In order to get the hash of obj itself, you need to use the object (or the id of object) to get its hash:
168
177
>>> hashes = DeepHash(obj)
169
178
>>> hashes[obj]
170
179
34150898645750099477987229399128149852
171
180
172
-
Which you can write as:
181
+
Which you can write as:
173
182
>>> hashes = DeepHash(obj)[obj]
174
183
175
-
At first it might seem weird why DeepHash(obj)[obj] but remember that DeepHash(obj) is a dictionary of hashes of all other objects that obj contains too.
184
+
At first it might seem weird why DeepHash(obj)[obj] but remember that DeepHash(obj) is a dictionary of hashes of all other objects that obj contains too.
176
185
177
-
The result hash is 34150898645750099477987229399128149852 which is generated by
178
-
Murmur 3 128bit hashing algorithm. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter. Read more about Murmur3 here: https://en.wikipedia.org/wiki/MurmurHash
186
+
The result hash is 34150898645750099477987229399128149852 which is generated by
187
+
Murmur 3 128bit hashing algorithm. If you prefer to use another hashing algorithm, you can pass it using the hasher parameter. Read more about Murmur3 here: https://en.wikipedia.org/wiki/MurmurHash
179
188
180
-
If you do a deep copy of obj, it should still give you the same hash:
189
+
If you do a deep copy of obj, it should still give you the same hash:
181
190
>>> from copy import deepcopy
182
191
>>> obj2 = deepcopy(obj)
183
192
>>> DeepHash(obj2)[obj2]
184
193
34150898645750099477987229399128149852
185
194
186
-
Note that by default DeepHash will include string type differences. So if your strings were bytes:
195
+
Note that by default DeepHash will include string type differences. So if your strings were bytes:
187
196
>>> obj3 = {1: 2, b'a': b'b'}
188
197
>>> DeepHash(obj3)[obj3]
189
198
64067525765846024488103933101621212760
190
199
191
-
But if you want the same hash if string types are different, set ignore_string_type_changes to True:
200
+
But if you want the same hash if string types are different, set ignore_string_type_changes to True:
0 commit comments