Skip to content

Commit

Permalink
fix: class exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabiana Clemente authored and fabclmnt committed May 7, 2024
1 parent b134aa2 commit 028451e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ydata_profiling/model/description.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def duration(self) -> Union[timedelta, List[timedelta]]:
for i in range(len(self.date_start))
]
else:
raise ValueError()
raise TypeError()


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion src/ydata_profiling/profile_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def __init__(
Args:
df: a pandas or spark.sql DataFrame
minimal: minimal mode is a default configuration with minimal computation
ts_mode: activates time-series analysis for all the numerical variables from the dataset. Only available for pd.DataFrame
ts_mode: activates time-series analysis for all the numerical variables from the dataset.
Only available for pd.DataFrame
sort_by: ignored if ts_mode=False. Order the dataset by a provided column.
sensitive: hides the values for categorical and text variables for report privacy
config_file: a config file (.yml), mutually exclusive with `minimal`
Expand Down
11 changes: 6 additions & 5 deletions src/ydata_profiling/utils/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Common util functions (e.g. missing in Python)."""
import contextlib

import collections.abc
import os
import platform
Expand Down Expand Up @@ -96,12 +98,12 @@ def convert_timestamp_to_datetime(timestamp: int) -> datetime:
else:
return datetime(1970, 1, 1) + timedelta(seconds=int(timestamp))


def analytics_features(dataframe, datatype: bool, report_type: bool):
def analytics_features(dataframe, datatype: str, report_type: str):
endpoint = "https://packages.ydata.ai/ydata-profiling?"

if os.getenv("YDATA_PROFILING_NO_ANALYTICS") != True:
package_version = __version__

try:
subprocess.check_output("nvidia-smi")
gpu_present = True
Expand All @@ -110,7 +112,7 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):

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

try:
with contextlib.suppress(Exception):
request_message = (
f"{endpoint}version={package_version}"
f"&python_version={python_version}"
Expand All @@ -122,5 +124,4 @@ def analytics_features(dataframe, datatype: bool, report_type: bool):
)

requests.get(request_message)
except Exception:
pass

7 changes: 0 additions & 7 deletions src/ydata_profiling/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@

from ydata_profiling.utils.common import analytics_features


class ProfilingLogger(logging.Logger):
def __init__(self, name, level=logging.INFO):
super().__init__(name, level)

def info(
self,
msg: object,
) -> None:
super().info(f"[PROFILING] - {msg}.")

def info_def_report(self, dataframe, timeseries: bool):
if dataframe == pd.DataFrame:
dataframe = "pandas"
Expand Down

0 comments on commit 028451e

Please sign in to comment.