GeezerVison is showing github.com — addressing issues · FOSSAware/deepdiff@feddd98
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deepdiff/deephash.py +2-5Lines changed: 2 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #!/usr/bin/env python | 2 | 2 | # -*- coding: utf-8 -*- | 3 | | -import os | 4 | 3 | import logging | 5 | 4 | from collections import Iterable | 6 | 5 | from collections import MutableMapping | | 9 | 8 | from hashlib import sha1, sha256 | 10 | 9 |
| 11 | 10 | from deepdiff.helper import (strings, numbers, unprocessed, not_hashed, add_to_frozen_set, | 12 | | - convert_item_or_items_into_set_else_none, current_dir, | | 11 | + convert_item_or_items_into_set_else_none, get_doc, | 13 | 12 | convert_item_or_items_into_compiled_regexes_else_none, | 14 | 13 | get_id, type_is_subclass_of_type_group, type_in_type_group) | 15 | 14 | from deepdiff.base import Base | | 18 | 17 | try: | 19 | 18 | import mmh3 | 20 | 19 | except ImportError: | 21 | | - 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.') | 22 | 20 | mmh3 = False | 23 | 21 |
| 24 | 22 | UNPROCESSED = 'unprocessed' | @@ -48,8 +46,7 @@ def prepare_string_for_hashing(obj, ignore_string_type_changes=False, ignore_str | 48 | 46 | return obj | 49 | 47 |
| 50 | 48 |
| 51 | | -with open(os.path.join(current_dir, 'deephash_doc.rst'), 'r') as doc_file: | 52 | | - doc = doc_file.read() | | 49 | +doc = get_doc('deephash_doc.rst') | 53 | 50 |
| 54 | 51 |
| 55 | 52 | class DeepHash(dict, Base): | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/diff.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | from deepdiff.helper import (strings, bytes_type, numbers, ListItemRemovedOrAdded, notpresent, | 24 | 24 | IndexedHash, Verbose, unprocessed, json_convertor_default, add_to_frozen_set, | 25 | 25 | convert_item_or_items_into_set_else_none, get_type, | 26 | | - convert_item_or_items_into_compiled_regexes_else_none, current_dir, | 27 | | - type_is_subclass_of_type_group, type_in_type_group) | | 26 | + convert_item_or_items_into_compiled_regexes_else_none, | | 27 | + type_is_subclass_of_type_group, type_in_type_group, get_doc) | 28 | 28 | from deepdiff.model import RemapDict, ResultDict, TextResult, TreeResult, DiffLevel | 29 | 29 | from deepdiff.model import DictRelationship, AttributeRelationship | 30 | 30 | from deepdiff.model import SubscriptableIterableRelationship, NonSubscriptableIterableRelationship, SetRelationship | | 37 | 37 | TREE_VIEW = 'tree' | 38 | 38 | TEXT_VIEW = 'text' | 39 | 39 |
| 40 | | -with open(os.path.join(current_dir, 'diff_doc.rst'), 'r') as doc_file: | 41 | | - doc = doc_file.read() | | 40 | + | | 41 | +doc = get_doc('diff_doc.rst') | 42 | 42 |
| 43 | 43 |
| 44 | 44 | class DeepDiff(ResultDict, Base): | |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/helper.py +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -203,3 +203,12 @@ def type_in_type_group(item, type_group): | 203 | 203 |
| 204 | 204 | def type_is_subclass_of_type_group(item, type_group): | 205 | 205 | return isinstance(item, type_group) or issubclass(item, type_group) or type_in_type_group(item, type_group) | | 206 | + | | 207 | + | | 208 | +def get_doc(doc_filename): | | 209 | + try: | | 210 | + with open(os.path.join(current_dir, doc_filename), 'r') as doc_file: | | 211 | + doc = doc_file.read() | | 212 | + except Exception: | | 213 | + doc = 'Failed to load the docstrings. Please visit: https://github.com/seperman/deepdiff' | | 214 | + return doc |
Collapse file Copy file name to clipboardExpand all lines: deepdiff/search.py +2-6Lines changed: 2 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #!/usr/bin/env python | 2 | 2 | # -*- coding: utf-8 -*- | 3 | | -# In order to run the docstrings: | 4 | | -# python3 -m deepdiff.search | 5 | | -import os | 6 | 3 | import re | 7 | 4 | from collections.abc import MutableMapping, Iterable | 8 | 5 | import logging | 9 | 6 |
| 10 | | -from deepdiff.helper import strings, numbers, add_to_frozen_set, current_dir | | 7 | +from deepdiff.helper import strings, numbers, add_to_frozen_set, get_doc | 11 | 8 |
| 12 | 9 | logger = logging.getLogger(__name__) | 13 | 10 |
| 14 | 11 |
| 15 | | -with open(os.path.join(current_dir, 'search_doc.rst'), 'r') as doc_file: | 16 | | - doc = doc_file.read() | | 12 | +doc = get_doc('search_doc.rst') | 17 | 13 |
| 18 | 14 |
| 19 | 15 | class DeepSearch(dict): | |
|