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

[MRG] get_backend compatibility with None entries #525

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

eloitanguy
Copy link
Collaborator

@eloitanguy eloitanguy commented Sep 20, 2023

Types of changes

Tweaked the code for get_backend so as to ignore None entries

Motivation and context / Related issue

This is a convenience addition for optional arguments:

def f(a, b=None):
     nx = get_backend(a, b)

will be nicer that

def f(a,b=None):
     if b is None:
          nx = get_backend(a)
     else:
          nx = get_backend(a, b)

especially in the case where there are a lot of optional arrays, where the amount of required if statements is combinatorial.

How has this been tested (if it applies)

Added a test in test/test_backend.py. Ran and passed the test workflow.

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • [] All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

RELEASES.md Outdated Show resolved Hide resolved
@rflamary rflamary changed the title [WIP] get_backend compatibility with None entries [MRG] get_backend compatibility with None entries Sep 20, 2023
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Merging #525 (10f69ed) into master (064898d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #525   +/-   ##
=======================================
  Coverage   96.06%   96.06%           
=======================================
  Files          65       65           
  Lines       13725    13732    +7     
=======================================
+ Hits        13185    13192    +7     
  Misses        540      540           

@rflamary rflamary merged commit 9e74f2e into PythonOT:master Sep 20, 2023
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.

2 participants