-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added conditional property to expose time scale predictions #327
Conversation
Fixed the Codacy issue. |
@Finesim97 Could you please rebase upon latest master, which fixes a couple of issues with CI. |
Happy new year to you! Rebased it. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #327 +/- ##
==========================================
+ Coverage 97.92% 97.95% +0.03%
==========================================
Files 37 37
Lines 3323 3379 +56
Branches 502 510 +8
==========================================
+ Hits 3254 3310 +56
Misses 33 33
Partials 36 36
☔ View full report in Codecov by Sentry. |
Imports wrongly sorted, will fix it |
@Finesim97 Do you plan to continue working on this? |
Hi, |
Sry, I ran the wrong command and screwed up my commits, fixing it at the moment |
Because it is implemented with a |
I will add some tests to fix codecov |
Hi, I added a test for the conditional property. |
Sorry that everything took so long, but I think now the PR should be ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort. Looks good, except for some small changes.
|
||
def _run_check(self, obj): | ||
attr_err = AttributeError( | ||
f"This {repr(obj)} has no attribute {repr(self._name)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of {repr(obj)}
, you can use {obj!r}
, and move the definition of attr_err
into the if block.
@@ -260,3 +260,83 @@ def safe_concat(objs, *args, **kwargs): | |||
concatenated[name] = pd.Categorical(concatenated[name], **params) | |||
|
|||
return concatenated | |||
|
|||
|
|||
class _ConditionalAvailableProperty: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you could inherit from the built-in property
, because it is a class. This could allow removing the setter/getter/deleter code.
@Finesim97 Thanks for your contributions. PR #374 is based on your work. This PR is now obsolete. |
Checklist
Added a decorator for properties, which are only available, if a check returns true. The decorator provided by scikit-learn only works for functions sadly.
@sebp
I am not sure what to test exactly, maybe a test which tests whether pipelines correctly patch the property and functions through? I also think this should not show up in the documentation, as it is internal?