Skip to content

Commit 3624b8b

Browse files
authored
Replace numpy with math (#2074)
* replace numpy with math * dummy commit to run pre-commit
1 parent 272a40c commit 3624b8b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

elementary/utils/json_utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import json
2+
import math
23
from typing import Any, List, Optional, Union
34

4-
import numpy as np
5-
65

76
def try_load_json(value: Optional[Union[str, dict, list]]):
87
if value is None:
@@ -83,9 +82,9 @@ def append_prefix_if_missing(string: str, prefix: str) -> str:
8382
def inf_and_nan_to_str(obj) -> Any:
8483
"""Replaces occurrences of float("nan") for float("infinity") in the given dict object."""
8584
if isinstance(obj, float):
86-
if np.isinf(obj):
85+
if math.isinf(obj):
8786
return "Infinity" if obj > 0 else "-Infinity"
88-
elif np.isnan(obj):
87+
elif math.isnan(obj):
8988
return "NaN"
9089
else:
9190
return obj

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ documentation = "https://docs.elementary-data.com"
1313
packages = [{include = "elementary"}]
1414

1515
[tool.poetry.dependencies]
16-
# matches the versions supported by dbt as of v1.9, which are probably due to the limits of numpy 1.26.x
16+
# matches the versions supported by dbt as of v1.9, which are probably due to the limits of numpy 1.26.x(which was removed)
1717
python = ">=3.9,<3.13"
1818
click = ">=7.0,<9.0"
1919
dbt-core = ">=0.20,<2.0.0"
@@ -32,7 +32,6 @@ networkx = ">=2.3,<3"
3232
packaging = ">=20.9"
3333
azure-storage-blob = ">=12.11.0"
3434
pymsteams = ">=0.2.2,<1.0.0"
35-
numpy = "<2.0.0"
3635
tabulate = ">= 0.9.0"
3736
pytz = ">= 2025.1"
3837

0 commit comments

Comments
 (0)