Skip to content
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

Refactor if-statements #1219

Merged
merged 3 commits into from
Mar 1, 2023
Merged

Refactor if-statements #1219

merged 3 commits into from
Mar 1, 2023

Conversation

PGijsbers
Copy link
Collaborator

No description provided.

@PGijsbers PGijsbers requested a review from mfeurer February 24, 2023 10:23
return False
else:
return (
return (isinstance(flow.dependencies, str) and "sklearn" in flow.dependencies) or (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the change away from getattr, but I'm not sure if the overall outcome is more readable.

Copy link
Contributor

@LennartPurucker LennartPurucker Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also results in a crash for windows, as the Dummyflow does not have this attribute: https://github.com/openml/openml-python/actions/runs/4261463411/jobs/7415818507#step:9:792

Must every flow have this attribute, or why was getattr used in the first place?

Copy link
Collaborator Author

@PGijsbers PGijsbers Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. DummyFlow is not actually an OpenMLFlow object, which is why it crashes:

class DummyFlow:
    external_version = "DummyFlow==0.1"

But flow.dependencies is set on __init__ so any proper OpenMLFlow has the attribute. I added dependencies to DummyFlow now so it better mimics an OpenMLFlow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored the method by first explicitly assigning the individual expressions to a variable. Of course we lose short-cutting the or, but that shouldn't ever matter.

@mfeurer mfeurer merged commit 687a0f1 into develop Mar 1, 2023
@mfeurer mfeurer deleted the refactor-boolean-return branch March 1, 2023 07:41
mfeurer added a commit that referenced this pull request Mar 1, 2023
* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* Fix CI Python 3.6 (#1218)

* Try Ubunte 20.04 for Python 3.6

* use old ubuntu for python 3.6

* Bump docker/setup-buildx-action from 1 to 2 (#1221)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update run.py (#1194)

* Update run.py

* Update run.py

updated description to not contain duplicate information.

* Update run.py

* add type hint for new function

* update add description

* Refactor if-statements (#1219)

* Refactor if-statements

* Add explicit names to conditional expression

* Add 'dependencies' to better mimic OpenMLFlow

* Ci python 38 (#1220)

* Install custom numpy version for specific combination of Python3.8 and numpy

* Debug output

* Change syntax

* move to coverage action v3

* Remove test output

* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* added additional task agnostic local result to print of run

* add PR to progress.rst

* add type hint for new function

* update add description

* fix run doc string

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vishal Parmar <vishalm524112@gmail.com>
Co-authored-by: Pieter Gijsbers <p.gijsbers@tue.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants