diff --git a/cachier/pickle_core.py b/cachier/pickle_core.py index 046f810..f32390e 100644 --- a/cachier/pickle_core.py +++ b/cachier/pickle_core.py @@ -159,17 +159,17 @@ class _PickleCore(_BaseCore): try: import pandas if isinstance(value, pandas.DataFrame): - return(pandas.util.hash_pandas_object(value).sum()) + return pandas.util.hash_pandas_object(value).sum() except ImportError: pass if hasattr(value, "tobytes"): # For numpy return hash(value.tobytes()) - elif hasattr(value, "__iter__"): # For iterators + if hasattr(value, "__iter__"): # For iterators hash_array = [] for elem in value: hash_array.append(value) return tuple(hash_array) - elif hasattr(value, "items"): # For dict + if hasattr(value, "items"): # For dict hash_array = [] for key, elem in value.items: hash_array.append(key) diff --git a/tests/test_numpy_pandas.py b/tests/test_numpy_pandas.py index 434821f..a06954d 100644 --- a/tests/test_numpy_pandas.py +++ b/tests/test_numpy_pandas.py @@ -11,24 +11,14 @@ # realpath, # dirname # ) -import os from time import time, sleep -from datetime import timedelta -from random import random -import threading - -try: - import queue -except ImportError: # python 2 - import Queue as queue from cachier import cachier -from cachier.pickle_core import DEF_CACHIER_DIR import numpy as np import pandas as pd -# Pickle core tests +# Numpy and pandas tests @cachier()