From 0f4e2bc5dfbd06f39961123750b3f2f65a5337da Mon Sep 17 00:00:00 2001 From: Martin Chacon Piza Date: Thu, 2 Apr 2020 12:39:21 +0200 Subject: [PATCH] Replacing ujson with simplejson - http://lists.openstack.org/pipermail/openstack-discuss/2020-January/012285.html Change-Id: Ic18f8cf4addfedd9055999ec685e81140ffda32d --- lower-constraints.txt | 2 +- monasca_common/rest/utils.py | 2 +- monasca_common/tests/validation/test_metric_validation.py | 2 +- monasca_common/validation/metrics.py | 4 ++-- requirements.txt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 05a8d414..a280a450 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -48,6 +48,7 @@ requests==2.14.2 requests-mock==1.2.0 requestsexceptions==1.2.0 rfc3986==0.3.1 +simplejson==3.13.2 six==1.10.0 smmap==0.9.0 stestr==1.0.0 @@ -57,6 +58,5 @@ testrepository==0.0.18 testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 -ujson==1.35 unittest2==1.1.0 wrapt==1.7.0 diff --git a/monasca_common/rest/utils.py b/monasca_common/rest/utils.py index 13386efc..eebaa4f7 100644 --- a/monasca_common/rest/utils.py +++ b/monasca_common/rest/utils.py @@ -13,7 +13,7 @@ # under the License. import six -import ujson as json +import simplejson as json from monasca_common.rest import exceptions diff --git a/monasca_common/tests/validation/test_metric_validation.py b/monasca_common/tests/validation/test_metric_validation.py index e5bfbd61..b0ef7808 100644 --- a/monasca_common/tests/validation/test_metric_validation.py +++ b/monasca_common/tests/validation/test_metric_validation.py @@ -410,7 +410,7 @@ class TestMetricValidation(base.BaseTestCase): metric_validator.InvalidValueMeta, "value combinations must be", metric_validator.validate, metric) - # TODO: what would make ujson.dumps fail? + # TODO: what would make json.dumps fail (simplejson)? def test_invalid_timestamp(self): metric = {'name': 'test_metric_name', diff --git a/monasca_common/validation/metrics.py b/monasca_common/validation/metrics.py index e75bc9b4..cc7b1be3 100644 --- a/monasca_common/validation/metrics.py +++ b/monasca_common/validation/metrics.py @@ -18,7 +18,7 @@ import re import six import sys -import ujson +import simplejson as json # This is used to ensure that metrics with a timestamp older than # RECENT_POINT_THRESHOLD_DEFAULT seconds (or the value passed in to @@ -108,7 +108,7 @@ def validate_value_meta(value_meta): raise InvalidValueMeta(msg) try: - value_meta_json = ujson.dumps(value_meta) + value_meta_json = json.dumps(value_meta) except Exception: raise InvalidValueMeta("Unable to serialize valueMeta into JSON") if len(value_meta_json) > VALUE_META_VALUE_MAX_LENGTH: diff --git a/requirements.txt b/requirements.txt index 6808390e..f36b75f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,5 +8,5 @@ oslo.config>=5.2.0 # Apache-2.0 oslo.policy>=1.30.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0 pyparsing>=2.1.0 # MIT -ujson>=1.35 # BSD +simplejson>=3.13.2 # MIT confluent-kafka>=0.11.4 # Apache-2.0