Skip to content

Commit ebbb442

Browse files
Replaces math.isnan with simple None comparisons.
1 parent b8ccdd0 commit ebbb442

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

django_pandas/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
from math import isnan
43
from django.core.cache import cache
54
from django.utils.encoding import force_text
65

@@ -32,7 +31,7 @@ def replace_pk(model):
3231
base_cache_key = get_base_cache_key(model)
3332

3433
def inner(pk_list):
35-
cache_keys = [None if isnan(pk) else base_cache_key % pk
34+
cache_keys = [None if pk is None else base_cache_key % pk
3635
for pk in pk_list]
3736
out_dict = cache.get_many(frozenset(cache_keys))
3837
try:
@@ -42,7 +41,7 @@ def inner(pk_list):
4241
out_dict = {
4342
base_cache_key % obj.pk: force_text(obj)
4443
for obj in model.objects.filter(pk__in={pk for pk in pk_list
45-
if not isnan(pk)})}
44+
if pk is not None})}
4645
cache.set_many(out_dict)
4746
out_list = map(out_dict.get, cache_keys)
4847
return out_list

0 commit comments

Comments
 (0)