Skip to content

Commit

Permalink
fix: Revert 2d1c64f ("Handle JSON numbers as Decimal not float")
Browse files Browse the repository at this point in the history
1e9999 causes ValueError: "Exceeds the limit (4300) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit"

cove-ocds, to my knowledge, doesn't perform arithmetic on floats, and in any case, it is a review tool, not a statistical tool.
  • Loading branch information
jpmckinney committed Feb 6, 2024
1 parent 3784061 commit 25dab60
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cove_oc4ids/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import logging
import re
from decimal import Decimal

from cove.views import cove_web_input_error, explore_data_context
from django.conf import settings
Expand Down Expand Up @@ -33,7 +32,7 @@ def explore_oc4ids(request, pk):
# open the data first so we can inspect for record package
with open(file_name, encoding="utf-8") as fp:
try:
json_data = json.load(fp, parse_float=Decimal)
json_data = json.load(fp)
except ValueError as err:
context = {
"sub_title": _("Sorry, we can't process that data"),
Expand Down Expand Up @@ -81,7 +80,7 @@ def explore_oc4ids(request, pk):
)

with open(context["converted_path"], encoding="utf-8") as fp:
json_data = json.load(fp, parse_float=Decimal)
json_data = json.load(fp)

context = common_checks_oc4ids(context, upload_dir, json_data, schema_oc4ids, lib_cove_oc4ids_config)

Expand Down

0 comments on commit 25dab60

Please sign in to comment.