Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dataprofiler/profilers/base_column_profilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,23 +252,23 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
def load_from_dict(
cls: type[BaseColumnProfilerT],
data: dict[str, Any],
options: dict | None = None,
config: dict | None = None,
) -> BaseColumnProfilerT:
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: BaseColumnProfiler
"""
if options is None:
options = {}
if config is None:
config = {}

class_options = options.get(cls.__name__)
class_options = config.get(cls.__name__)
profile: BaseColumnProfilerT = cls(data["name"], class_options)

time_vals = data.pop("times")
Expand Down
4 changes: 3 additions & 1 deletion dataprofiler/profilers/categorical_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,14 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
return self.profile

@classmethod
def load_from_dict(cls, data: dict, options: dict | None = None):
def load_from_dict(cls, data: dict, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: CategoricalColumn
Expand Down
8 changes: 4 additions & 4 deletions dataprofiler/profilers/column_profile_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ def update_profile(
return self

@classmethod
def load_from_dict(cls, data, options: dict | None = None) -> BaseCompiler:
def load_from_dict(cls, data, config: dict | None = None) -> BaseCompiler:
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Compiler with attributes populated.
:rtype: BaseCompiler
Expand All @@ -239,7 +239,7 @@ def load_from_dict(cls, data, options: dict | None = None) -> BaseCompiler:
for attr, value in data.items():
if "_profiles" in attr:
for col_type, profile_as_dict in value.items():
value[col_type] = load_column_profile(profile_as_dict, options)
value[col_type] = load_column_profile(profile_as_dict, config)
# since needs to be in the same order, use _profilers to enforce
value = OrderedDict(
{
Expand Down
2 changes: 1 addition & 1 deletion dataprofiler/profilers/data_labeler_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def load_from_dict(cls, data, config: dict | None = None) -> DataLabelerColumn:

# This is an ambiguous call to super classes.
# If load_from_dict is part of both super classes there may be issues
profile = super().load_from_dict(data, options={cls.__name__: opt})
profile = super().load_from_dict(data, config={cls.__name__: opt})

if profile._reverse_label_mapping is not None:
profile._reverse_label_mapping = {
Expand Down
6 changes: 3 additions & 3 deletions dataprofiler/profilers/datetime_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
return self.profile

@classmethod
def load_from_dict(cls, data, options: dict | None = None):
def load_from_dict(cls, data, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: DateTimeColumn
Expand Down
6 changes: 3 additions & 3 deletions dataprofiler/profilers/float_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
return profile

@classmethod
def load_from_dict(cls, data, options: dict | None = None):
def load_from_dict(cls, data, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: FloatColumn
Expand Down
6 changes: 3 additions & 3 deletions dataprofiler/profilers/int_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
return self.profile

@classmethod
def load_from_dict(cls, data, options: dict | None = None):
def load_from_dict(cls, data, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: IntColumn
Expand Down
2 changes: 1 addition & 1 deletion dataprofiler/profilers/json_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def load_column_profile(
}

:param serialized_json: JSON representation of column profiler that was
# serialized using the custom encoder in profilers.json_encoder
serialized using the custom encoder in profilers.json_encoder
:type serialized_json: a dict that was created by calling json.loads on
a JSON representation using the custom encoder
:param config: config for overriding data params when loading from dict
Expand Down
6 changes: 3 additions & 3 deletions dataprofiler/profilers/order_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,14 @@ def report(self, remove_disabled_flag: bool = False) -> dict:
return self.profile

@classmethod
def load_from_dict(cls, data, options: dict | None = None):
def load_from_dict(cls, data, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: options for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: CategoricalColumn
Expand Down
28 changes: 15 additions & 13 deletions dataprofiler/profilers/profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,14 @@ def report(self, remove_disabled_flag: bool = False) -> OrderedDict:
return report

@classmethod
def load_from_dict(cls, data, options: dict | None = None) -> StructuredColProfiler:
def load_from_dict(cls, data, config: dict | None = None) -> StructuredColProfiler:
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading structured column profiler
:type options: Dict | None
:param config: config for loading structured column profiler
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: StructuredColProfiler
Expand All @@ -407,9 +407,9 @@ def load_from_dict(cls, data, options: dict | None = None) -> StructuredColProfi
for attr, value in data.items():
if attr == "profiles":
for profile_key, profile_value in value.items():
value[profile_key] = load_compiler(profile_value, options)
value[profile_key] = load_compiler(profile_value, config)
if attr == "options" and value is not None:
value = load_option(value, options)
value = load_option(value, config)
if attr == "_null_values":
value = {
k: (re.RegexFlag(v) if v != 0 else 0) for k, v in value.items()
Expand Down Expand Up @@ -887,7 +887,9 @@ def report(self, report_options: dict = None) -> dict:
raise NotImplementedError()

@classmethod
def load_from_dict(cls: type[BaseProfilerT], data, config) -> BaseProfilerT:
def load_from_dict(
cls: type[BaseProfilerT], data, config: dict | None = None
) -> BaseProfilerT:
"""
Parse attribute from json dictionary into self.

Expand Down Expand Up @@ -1428,15 +1430,15 @@ def report(self, report_options: dict = None) -> dict:
def load_from_dict(
cls,
data,
options: dict | None = None,
config: dict | None = None,
):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading profiler params from dictionary
:type config: Dict | None

:raises: NotImplementedError
"""
Expand Down Expand Up @@ -2104,15 +2106,15 @@ def report(self, report_options: dict = None) -> dict:
def load_from_dict(
cls,
data,
options: dict | None = None,
config: dict | None = None,
) -> StructuredProfiler:
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: StructuredProfiler
Expand All @@ -2132,7 +2134,7 @@ def load_from_dict(
int(k): v for k, v in data["hashed_row_object"].items()
}

structured_profiler = super().load_from_dict(data, options)
structured_profiler = super().load_from_dict(data, config)

return structured_profiler

Expand Down
6 changes: 3 additions & 3 deletions dataprofiler/profilers/text_column_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ def update(self, df_series: pd.Series) -> TextColumn:
return self

@classmethod
def load_from_dict(cls, data, options: dict | None = None):
def load_from_dict(cls, data, config: dict | None = None):
"""
Parse attribute from json dictionary into self.

:param data: dictionary with attributes and values.
:type data: dict[string, Any]
:param options: options for loading column profiler params from dictionary
:type options: Dict | None
:param config: config for loading column profiler params from dictionary
:type config: Dict | None

:return: Profiler with attributes populated.
:rtype: TextColumn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,5 +417,5 @@ def test_json_encode(self):
"column_null_values": {"2": {"other_str": 5}},
},
}
self.maxDiff = None

self.assertDictEqual(expected, json.loads(serialized))
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ def test_diff(self, mock_instance):
"avg_predictions": {"a": "unchanged", "b": -0.70, "c": 0.70},
"label_representation": {"a": -0.84, "b": "unchanged", "c": 0.84},
}
self.maxDiff = None
self.assertDictEqual(expected_diff, diff)

def test_empty_data(self, *mocks):
Expand Down
1 change: 0 additions & 1 deletion dataprofiler/tests/profilers/test_graph_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ def test_graph_data_object(self):
self.assertDictEqual(self.expected_profile, profile.profile)

def test_diff(self):
self.maxDiff = None
profile_1 = dp.GraphProfiler(self.graph_1)
profile_2 = dp.GraphProfiler(self.graph_2)
profile_3 = dp.GraphProfiler(self.graph_3)
Expand Down
3 changes: 1 addition & 2 deletions dataprofiler/tests/profilers/test_profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3600,7 +3600,7 @@ def setUp(cls):
@classmethod
def setUpClass(cls):
test_utils.set_seed(0)
cls.maxDiff = None

cls.input_data = [
"edited 9 hours ago",
"6. Do not duplicate code.",
Expand Down Expand Up @@ -3638,7 +3638,6 @@ def setUpClass(cls):
cls.report = cls.profiler.report()

def test_sample(self):
self.maxDiff = None
self.assertCountEqual(
[
"Report",
Expand Down