Skip to content

Commit

Permalink
Merge pull request #449 from seperman/dev
Browse files Browse the repository at this point in the history
7.0.0
  • Loading branch information
seperman authored Apr 8, 2024
2 parents 89c5cc2 + c6ae868 commit 71cde51
Show file tree
Hide file tree
Showing 31 changed files with 1,546 additions and 347 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
architecture: ["x64"]
include:
- python-version: "3.10"
Expand All @@ -34,11 +34,12 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies py3.7
if: matrix.python-version == 3.7
run: pip install -r requirements-dev-3.7.txt
- name: Upgrade setuptools
if: matrix.python-version == 3.12
run: |
# workaround for 3.12, SEE: https://github.com/pypa/setuptools/issues/3661#issuecomment-1813845177
pip install --upgrade setuptools
- name: Install dependencies
if: matrix.python-version != 3.7
run: pip install -r requirements-dev.txt
- name: Install Numpy Dev
if: ${{ matrix.numpy-version }}
Expand All @@ -63,5 +64,6 @@ jobs:
if: matrix.python-version == 3.11
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
fail_ci_if_error: true
10 changes: 10 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Dehpour"
given-names: "Sep"
orcid: "https://orcid.org/0009-0009-5828-4345"
title: "DeepDiff"
version: 7.0.0
date-released: 2024
url: "https://github.com/seperman/deepdiff"
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DeepDiff v 6.7.1
# DeepDiff v 7.0.0

![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat)
![Python Versions](https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat)
Expand All @@ -15,9 +15,9 @@
- [Extract](https://zepworks.com/deepdiff/current/extract.html): Extract an item from a nested Python object using its path.
- [commandline](https://zepworks.com/deepdiff/current/commandline.html): Use DeepDiff from commandline.

Tested on Python 3.7+ and PyPy3.
Tested on Python 3.8+ and PyPy3.

- **[Documentation](https://zepworks.com/deepdiff/6.7.1/)**
- **[Documentation](https://zepworks.com/deepdiff/7.0.0/)**

## What is new?

Expand Down Expand Up @@ -101,16 +101,6 @@ Or to see a more user friendly version, please run: `pytest --cov=deepdiff --cov

Thank you!

# Citing

How to cite this library (APA style):

Dehpour, S. (2023). DeepDiff (Version 6.7.1) [Software]. Available from https://github.com/seperman/deepdiff.

How to cite this library (Chicago style):

Dehpour, Sep. 2023. DeepDiff (version 6.7.1).

# Authors

Please take a look at the [AUTHORS](AUTHORS.md) file.
2 changes: 1 addition & 1 deletion deepdiff/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This module offers the DeepDiff, DeepSearch, grep, Delta and DeepHash classes."""
# flake8: noqa
__version__ = '6.7.1'
__version__ = '7.0.0'
import logging

if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion deepdiff/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def get_ignore_types_in_groups(self, ignore_type_in_groups,
if ignore_numeric_type_changes and self.numbers not in ignore_type_in_groups:
ignore_type_in_groups.append(OrderedSet(self.numbers))

if ignore_type_subclasses:
if not ignore_type_subclasses:
# is_instance method needs tuples. When we look for subclasses, we need them to be tuples
ignore_type_in_groups = list(map(tuple, ignore_type_in_groups))

return ignore_type_in_groups
11 changes: 10 additions & 1 deletion deepdiff/deephash.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import inspect
import logging
import datetime
from collections.abc import Iterable, MutableMapping
from collections import defaultdict
from hashlib import sha1, sha256
Expand Down Expand Up @@ -186,7 +187,8 @@ def __init__(self,
# the only time it should be set to False is when
# testing the individual hash functions for different types of objects.
self.apply_hash = apply_hash
self.type_check_func = type_is_subclass_of_type_group if ignore_type_subclasses else type_in_type_group
self.type_check_func = type_in_type_group if ignore_type_subclasses else type_is_subclass_of_type_group
# self.type_check_func = type_is_subclass_of_type_group if ignore_type_subclasses else type_in_type_group
self.number_to_string = number_to_string_func or number_to_string
self.ignore_private_variables = ignore_private_variables
self.encodings = encodings
Expand Down Expand Up @@ -455,6 +457,10 @@ def _prep_datetime(self, obj):
obj = datetime_normalize(self.truncate_datetime, obj)
return KEY_TO_VAL_STR.format(type_, obj)

def _prep_date(self, obj):
type_ = 'datetime' # yes still datetime but it doesn't need normalization
return KEY_TO_VAL_STR.format(type_, obj)

def _prep_tuple(self, obj, parent, parents_ids):
# Checking to see if it has _fields. Which probably means it is a named
# tuple.
Expand Down Expand Up @@ -505,6 +511,9 @@ def _hash(self, obj, parent, parents_ids=EMPTY_FROZENSET):
elif isinstance(obj, times):
result = self._prep_datetime(obj)

elif isinstance(obj, datetime.date):
result = self._prep_date(obj)

elif isinstance(obj, numbers):
result = self._prep_number(obj)

Expand Down
Loading

0 comments on commit 71cde51

Please sign in to comment.