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
11 changes: 8 additions & 3 deletions dataprofiler/profilers/profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,12 +1162,14 @@ def save(self, filepath: str = None, save_method: str = "pickle") -> None:
raise NotImplementedError()

@classmethod
def load(cls, filepath: str, load_method: str | None = "pickle") -> BaseProfiler:
def load(cls, filepath: str, load_method: str | None = None) -> BaseProfiler:
"""
Load profiler from disk.

:param filepath: Path of file to load from
:type filepath: String
:param load_method: The desired loading method, default = None
:type load_method: Optional[String]
:return: Profiler being loaded, StructuredProfiler or
UnstructuredProfiler
:rtype: BaseProfiler
Expand Down Expand Up @@ -2991,14 +2993,17 @@ def __new__( # type: ignore
)

@classmethod
def load(cls, filepath: str) -> BaseProfiler:
def load(cls, filepath: str, load_method: str | None = None) -> BaseProfiler:
"""
Load profiler from disk.

:param filepath: Path of file to load from
:type filepath: String
:param load_method: The desired loading method, default = "None"
:type load_method: Optional[String]

:return: Profiler being loaded, StructuredProfiler or
UnstructuredProfiler
:rtype: BaseProfiler
"""
return BaseProfiler.load(filepath)
return BaseProfiler.load(filepath, load_method)
2 changes: 1 addition & 1 deletion dataprofiler/tests/profilers/test_profile_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4450,7 +4450,7 @@ def test_save_and_load_structured(self):
"dataprofiler.profilers.profile_builder." "DataLabeler",
return_value=data_labeler,
):
load_profile = dp.Profiler.load("mock.pkl")
load_profile = dp.Profiler.load("mock.pkl", load_method="PICKLE")

# validate loaded profile has same data labeler class
self.assertIsInstance(
Expand Down