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

Sourcery refactored master branch #175

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Sourcery refactored master branch #175

merged 1 commit into from
Oct 11, 2023

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 7, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from fneum October 7, 2023 14:11
# Create variables
x = {}
for i in range(n):
x[i] = solver.BoolVar("x_%d" % i)

x = {i: solver.BoolVar("x_%d" % i) for i in range(n)}
Copy link
Author

Choose a reason for hiding this comment

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

Function knapsack_model refactored with the following changes:

This removes the following comments ( why? ):

# Create variables

@@ -6,6 +6,7 @@
@author: fabian
"""

Copy link
Author

Choose a reason for hiding this comment

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

Lines 27-27 refactored with the following changes:

if "dev" in version:
# remove the dev description and reduce by minor one release
release = "master"
else:
release = version


release = "master" if "dev" in version else version
Copy link
Author

Choose a reason for hiding this comment

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

Lines 26-32 refactored with the following changes:

This removes the following comments ( why? ):

# remove the dev description and reduce by minor one release

@@ -4,6 +4,7 @@
Linopy module for solving lp files with different solvers.
"""

Copy link
Author

Choose a reason for hiding this comment

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

Lines 33-67 refactored with the following changes:

Comment on lines -83 to -87
try:
with contextlib.suppress(Exception):
logger.warning("Solution status unknown. Trying to parse solution.")
return func()
except Exception:
pass
Copy link
Author

Choose a reason for hiding this comment

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

Function safe_get_solution refactored with the following changes:

coord = tuple([var.indexes[c][0] for c in var.dims])
coord = tuple(var.indexes[c][0] for c in var.dims)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_scalar_linear_expression_repr refactored with the following changes:

coord = tuple([var.indexes[c][0] for c in var.dims])
coord = tuple(var.indexes[c][0] for c in var.dims)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_single_linear_repr refactored with the following changes:

repr(1 * u[0, 0] >= 0)
repr(u[0, 0] >= 0)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_scalar_constraint_repr refactored with the following changes:

Comment on lines -128 to +129
coord = tuple([var.indexes[c][0] for c in var.dims])
repr(1 * var.loc[coord] == 0)
coord = tuple(var.indexes[c][0] for c in var.dims)
repr(var.loc[coord] == 0)
Copy link
Author

Choose a reason for hiding this comment

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

Function test_single_constraint_repr refactored with the following changes:

x[0:5]
x[:5]
Copy link
Author

Choose a reason for hiding this comment

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

Function test_variable_getter refactored with the following changes:

@codecov
Copy link

codecov bot commented Oct 7, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (af5e622) 87.28% compared to head (b1209c8) 87.29%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
+ Coverage   87.28%   87.29%   +0.01%     
==========================================
  Files          14       14              
  Lines        3122     3110      -12     
  Branches      708      714       +6     
==========================================
- Hits         2725     2715      -10     
+ Misses        289      287       -2     
  Partials      108      108              
Files Coverage Δ
linopy/solvers.py 90.18% <100.00%> (+0.25%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FabianHofmann FabianHofmann merged commit 9d9991a into master Oct 11, 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.

1 participant