fix deepsource report

This commit is contained in:
fx_kirin
2020-01-08 13:09:11 +09:00
parent 6ecf666b29
commit c8b81b9e9a
2 changed files with 4 additions and 14 deletions
+3 -3
View File
@@ -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)
+1 -11
View File
@@ -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()