Skip to content

Commit

Permalink
Fix initial value of processor_type (#863)
Browse files Browse the repository at this point in the history
* Fix initial value of processor_type

BaseDataProcessor.processor_type has type str, but is initialized in
BaseDataProcessor as None, likely because it is meant to be overridden
by subclasses. We initialize it as a string to remove the type error.

* Change base processor_type name

Co-authored-by: Taylor Turner <[email protected]>

* Make processor_type undefined in base class

Also modified a test so that it can create the processor_type
attribute, since it is currently not defined.

Co-authored-by: JGSweets <[email protected]>

---------

Co-authored-by: Taylor Turner <[email protected]>
Co-authored-by: JGSweets <[email protected]>
  • Loading branch information
3 people committed Jun 16, 2023
1 parent 88f7111 commit 2f94db1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dataprofiler/labelers/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __new__(
class BaseDataProcessor(metaclass=abc.ABCMeta):
"""Abstract Data processing class."""

processor_type: str = None # type: ignore[assignment]
processor_type: str # override this
__subclasses: dict[str, type[BaseDataProcessor]] = {}

def __init__(self, **parameters: Any) -> None:
Expand Down
1 change: 1 addition & 0 deletions dataprofiler/tests/labelers/test_data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def test_load_processor(self, mock_open, *property_mocks):
with mock.patch(
"dataprofiler.labelers.data_processing." "BaseDataProcessor.processor_type",
new_callable=mock.PropertyMock(return_value="test"),
create=True,
):
mocked_processor = BaseDataProcessor.load_from_disk("test/path")

Expand Down

0 comments on commit 2f94db1

Please sign in to comment.