Skip to content

Commit

Permalink
Add magic method __eq__
Browse files Browse the repository at this point in the history
  • Loading branch information
petrovicboban committed May 24, 2023
1 parent d76b4c1 commit a849644
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies = [
"numpy >= 1.23.5, < 2",
"pandas >= 1.4, < 2",
"statsmodels >= 0.13.5, < 1",
"pydantic >= 1.10.6, < 2",
"deepdiff >= 6.3.0, < 7",
"scikit-learn == 1.2.2",

# Conditional dependencies
Expand Down
7 changes: 7 additions & 0 deletions Python/random_forestry/forestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import numpy as np
import pandas as pd
from deepdiff import DeepDiff
from sklearn.base import BaseEstimator
from sklearn.utils.validation import check_is_fitted

Expand Down Expand Up @@ -1275,6 +1276,12 @@ def __del__(self):
if hasattr(self, "forest_") and hasattr(self, "dataframe_"):
extension.delete_forestry(self.forest_, self.dataframe_)

def __eq__(self, other):
if isinstance(other, self.__class__):
return not bool(DeepDiff(self.__dict__, other.__dict__))
else:
return False

def _more_tags(self):
return {
"_xfail_checks": {
Expand Down

0 comments on commit a849644

Please sign in to comment.