Skip to content

Commit 9b68e0c

Browse files
Fabiana Clementefabclmnt
authored andcommitted
fix: class exception
1 parent b134aa2 commit 9b68e0c

4 files changed

Lines changed: 9 additions & 14 deletions

File tree

src/ydata_profiling/model/description.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def duration(self) -> Union[timedelta, List[timedelta]]:
3737
for i in range(len(self.date_start))
3838
]
3939
else:
40-
raise ValueError()
40+
raise TypeError()
4141

4242

4343
@dataclass

src/ydata_profiling/profile_report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def __init__(
9595
Args:
9696
df: a pandas or spark.sql DataFrame
9797
minimal: minimal mode is a default configuration with minimal computation
98-
ts_mode: activates time-series analysis for all the numerical variables from the dataset. Only available for pd.DataFrame
98+
ts_mode: activates time-series analysis for all the numerical variables from the dataset.
99+
Only available for pd.DataFrame
99100
sort_by: ignored if ts_mode=False. Order the dataset by a provided column.
100101
sensitive: hides the values for categorical and text variables for report privacy
101102
config_file: a config file (.yml), mutually exclusive with `minimal`

src/ydata_profiling/utils/common.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Common util functions (e.g. missing in Python)."""
2+
import contextlib
3+
24
import collections.abc
35
import os
46
import platform
@@ -96,12 +98,12 @@ def convert_timestamp_to_datetime(timestamp: int) -> datetime:
9698
else:
9799
return datetime(1970, 1, 1) + timedelta(seconds=int(timestamp))
98100

99-
100-
def analytics_features(dataframe, datatype: bool, report_type: bool):
101+
def analytics_features(dataframe, datatype: str, report_type: str):
101102
endpoint = "https://packages.ydata.ai/ydata-profiling?"
102103

103104
if os.getenv("YDATA_PROFILING_NO_ANALYTICS") != True:
104105
package_version = __version__
106+
105107
try:
106108
subprocess.check_output("nvidia-smi")
107109
gpu_present = True
@@ -110,7 +112,7 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):
110112

111113
python_version = ".".join(platform.python_version().split(".")[:2])
112114

113-
try:
115+
with contextlib.suppress(Exception):
114116
request_message = (
115117
f"{endpoint}version={package_version}"
116118
f"&python_version={python_version}"
@@ -122,5 +124,4 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):
122124
)
123125

124126
requests.get(request_message)
125-
except Exception:
126-
pass
127+

src/ydata_profiling/utils/logger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@
88

99
from ydata_profiling.utils.common import analytics_features
1010

11-
1211
class ProfilingLogger(logging.Logger):
1312
def __init__(self, name, level=logging.INFO):
1413
super().__init__(name, level)
1514

16-
def info(
17-
self,
18-
msg: object,
19-
) -> None:
20-
super().info(f"[PROFILING] - {msg}.")
21-
2215
def info_def_report(self, dataframe, timeseries: bool):
2316
if dataframe == pd.DataFrame:
2417
dataframe = "pandas"

0 commit comments

Comments
 (0)