Skip to content

Commit

Permalink
simplify conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeolson committed Oct 31, 2023
1 parent e8dce19 commit 933ae02
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
16 changes: 8 additions & 8 deletions pyamg/krylov/_fgmres.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ def fgmres(A, b, x0=None, tol=1e-5,
http://www-users.cs.umn.edu/~saad/books.html
"""
if restrt is None:
restrt = restart
elif restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=2)
if restrt is not None:
if restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
restart = restrt
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=1)

# Convert inputs to linear system, with error checking
A, M, x, b, postprocess = make_system(A, M, x0, b)
Expand Down
16 changes: 8 additions & 8 deletions pyamg/krylov/_gmres.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def gmres(A, b, x0=None, tol=1e-5, restart=None, maxiter=None,
http://www-users.cs.umn.edu/~saad/books.html
"""
if restrt is None:
restrt = restart
elif restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=2)
if restrt is not None:
if restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
restart = restrt
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=1)

# pass along **kwargs
if orthog == 'householder':
Expand Down
16 changes: 8 additions & 8 deletions pyamg/krylov/_gmres_householder.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ def gmres_householder(A, b, x0=None, tol=1e-5,
http://www-users.cs.umn.edu/~saad/books.html
"""
if restrt is None:
restrt = restart
elif restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=2)
if restrt is not None:
if restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
restart = restrt
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=1)

# Convert inputs to linear system, with error checking
A, M, x, b, postprocess = make_system(A, M, x0, b)
Expand Down
16 changes: 8 additions & 8 deletions pyamg/krylov/_gmres_mgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ def gmres_mgs(A, b, x0=None, tol=1e-5,
.. [2] C. T. Kelley, http://www4.ncsu.edu/~ctk/matlab_roots.html
"""
if restrt is None:
restrt = restart
elif restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=2)
if restrt is not None:
if restart is not None:
raise ValueError('Only use restart, not restrt (deprecated).')
else:
restart = restrt
msg = ('The keyword argument "restrt" is deprecated and will '
'be removed in 2024. Use "restart" instead.')
warnings.warn(msg, DeprecationWarning, stacklevel=1)

# Convert inputs to linear system, with error checking
A, M, x, b, postprocess = make_system(A, M, x0, b)
Expand Down

0 comments on commit 933ae02

Please sign in to comment.