From 96c37fea4f678fe9acdfbd16e6f2b79c10844e9d Mon Sep 17 00:00:00 2001 From: Oliver Holworthy Date: Tue, 2 May 2023 19:02:42 +0100 Subject: [PATCH 1/2] Remove use of deprecated numpy aliases of builtin types --- merlin/dtypes/mappings/numpy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/merlin/dtypes/mappings/numpy.py b/merlin/dtypes/mappings/numpy.py index f46e33839..02a463cd3 100644 --- a/merlin/dtypes/mappings/numpy.py +++ b/merlin/dtypes/mappings/numpy.py @@ -45,8 +45,8 @@ mn.datetime64us: [np.dtype("datetime64[us]")], mn.datetime64ns: [np.dtype("datetime64[ns]")], # Miscellaneous - mn.string: [np.dtype("str"), np.str], - mn.object_: [np.dtype("O"), np.object], - mn.boolean: [np.dtype("bool"), np.bool], + mn.string: [np.dtype("str"), str], + mn.object_: [np.dtype("O"), object], + mn.boolean: [np.dtype("bool"), bool], } _dtype_registry.register("numpy", numpy_dtypes) From 2da6b6852842a91ecb99429c88a6386b65aef2f3 Mon Sep 17 00:00:00 2001 From: Oliver Holworthy Date: Tue, 2 May 2023 19:20:24 +0100 Subject: [PATCH 2/2] Update use of numpy.float and numpy.int in test_schema_io.py --- tests/unit/schema/test_schema_io.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/schema/test_schema_io.py b/tests/unit/schema/test_schema_io.py index 84a2d76c9..3770f4b37 100644 --- a/tests/unit/schema/test_schema_io.py +++ b/tests/unit/schema/test_schema_io.py @@ -114,14 +114,14 @@ def test_column_schema_protobuf_domain_check(tmpdir): "col1", tags=[], properties={"domain": {"min": 0, "max": 10}}, - dtype=numpy.int, + dtype=int, is_list=False, ) schema2 = ColumnSchema( "col2", tags=[], properties={"domain": {"min": 0.0, "max": 10.0}}, - dtype=numpy.float, + dtype=float, is_list=False, ) saved_schema = Schema([schema1, schema2]) @@ -167,7 +167,7 @@ def test_column_schema_set_protobuf(tmpdir, props1, props2, tags1, tags2, d_type @pytest.mark.parametrize("properties", [{}, {"domain": {"min": 0, "max": 10}}]) @pytest.mark.parametrize("tags", [[], ["a", "b", "c"]]) -@pytest.mark.parametrize("dtype", [numpy.float, numpy.int]) +@pytest.mark.parametrize("dtype", [float, int]) @pytest.mark.parametrize("list_type", [True, False]) def test_schema_to_tensorflow_metadata(tmpdir, properties, tags, dtype, list_type): # make sure we can round trip a schema to TensorflowMetadata without going to disk @@ -187,7 +187,7 @@ def test_schema_to_tensorflow_metadata(tmpdir, properties, tags, dtype, list_typ ], ) @pytest.mark.parametrize("tags", [[], ["a", "b", "c"]]) -@pytest.mark.parametrize("dtype", [numpy.float, numpy.int]) +@pytest.mark.parametrize("dtype", [float, int]) @pytest.mark.parametrize("list_type", [True, False]) def test_schema_to_tensorflow_metadata_json(tmpdir, properties, tags, dtype, list_type): schema = Schema( @@ -262,7 +262,7 @@ def test_tensorflow_metadata_from_json(): def test_shapes_survive_round_trip(dim1, dim2, dim3): dims = (dim1, dim2, dim3) - col_schema1 = ColumnSchema("col1", dtype=numpy.int, dims=dims) + col_schema1 = ColumnSchema("col1", dtype=int, dims=dims) schema = Schema([col_schema1]) loaded_schema = TensorflowMetadata.from_merlin_schema(schema).to_merlin_schema()