Skip to content

Commit

Permalink
[logging] warn is deprecated, use warning
Browse files Browse the repository at this point in the history
  • Loading branch information
renefritze committed Aug 9, 2017
1 parent 4b3e90d commit 2e0a2bd
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/pymor/algorithms/adaptivegreedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def estimate(mus):
break
extensions += 1
if 'hierarchic' not in extension_data:
logger.warn('Extension algorithm does not report if extension was hierarchic. Assuming it was\'nt ..')
logger.warning('Extension algorithm does not report if extension was hierarchic. Assuming it was\'nt ..')
hierarchic = False
else:
hierarchic = extension_data['hierarchic']
Expand Down
4 changes: 2 additions & 2 deletions src/pymor/algorithms/genericsolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ def _parse_options(options, default_options, default_solver, default_least_squar
if least_squares != ('least_squares' in options['type']):
logger = getLogger('foo')
if least_squares:
logger.warn('Non-least squares solver selected for least squares problem.')
logger.warning('Non-least squares solver selected for least squares problem.')
else:
logger.warn('Least squares solver selected for non-least squares probelm.')
logger.warning('Least squares solver selected for non-least squares probelm.')

return options

Expand Down
2 changes: 1 addition & 1 deletion src/pymor/algorithms/greedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def greedy(discretization, reductor, samples, initial_basis=None, use_estimator=
break
extensions += 1
if 'hierarchic' not in extension_data:
logger.warn('Extension algorithm does not report if extension was hierarchic. Assuming it was\'nt ..')
logger.warning('Extension algorithm does not report if extension was hierarchic. Assuming it was\'nt ..')
hierarchic = False
else:
hierarchic = extension_data['hierarchic']
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/algorithms/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def action_recurse(self, op, range_basis, source_basis, product=None):

@match_class(OperatorInterface)
def action_generic_projection(self, op, range_basis, source_basis, product=None):
op.logger.warn('Using inefficient generic projection operator')
op.logger.warning('Using inefficient generic projection operator')
return ProjectedOperator(op, range_basis, source_basis, product)


Expand Down
4 changes: 2 additions & 2 deletions src/pymor/core/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ def _import_all(package_name='pymor'):
def onerror(name):
from pymor.core.logger import getLogger
logger = getLogger('pymor.core.defaults._import_all')
logger.warn('Failed to import ' + name)
logger.warning('Failed to import ' + name)

for p in pkgutil.walk_packages(package.__path__, package_name + '.', onerror=onerror):
try:
importlib.import_module(p[1])
except ImportError:
from pymor.core.logger import getLogger
logger = getLogger('pymor.core.defaults._import_all')
logger.warn('Failed to import ' + p[1])
logger.warning('Failed to import ' + p[1])


def print_defaults(import_all=True, shorten_paths=2):
Expand Down
6 changes: 3 additions & 3 deletions src/pymor/domaindescriptions/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, domain=([0, 0], [1, 1]), left='dirichlet', right='dirichlet',
assert domain[0][1] <= domain[1][1]
for bt in (left, right, top, bottom):
if bt is not None and bt not in KNOWN_BOUNDARY_TYPES:
self.logger.warn('Unknown boundary type: {}'.format(bt))
self.logger.warning('Unknown boundary type: {}'.format(bt))
self.boundary_types = frozenset({left, right, top, bottom})
self.left = left
self.right = right
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(self, domain=([0, 0], [1, 1]), top='dirichlet', bottom='dirichlet')
assert domain[0][1] <= domain[1][1]
for bt in (top, bottom):
if bt is not None and bt not in KNOWN_BOUNDARY_TYPES:
self.logger.warn('Unknown boundary type: {}'.format(bt))
self.logger.warning('Unknown boundary type: {}'.format(bt))
self.boundary_types = frozenset({top, bottom})
self.top = top
self.bottom = bottom
Expand Down Expand Up @@ -226,7 +226,7 @@ def __init__(self, domain=(0, 1), left='dirichlet', right='dirichlet'):
assert domain[0] <= domain[1]
for bt in (left, right):
if bt is not None and bt not in KNOWN_BOUNDARY_TYPES:
self.logger.warn('Unknown boundary type: {}'.format(bt))
self.logger.warning('Unknown boundary type: {}'.format(bt))
self.boundary_types = frozenset({left, right})
self.left = left
self.right = right
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/domaindescriptions/polygonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, points, boundary_types, holes=None):

for bt in self.boundary_types.keys():
if bt is not None and bt not in KNOWN_BOUNDARY_TYPES:
self.logger.warn('Unknown boundary type: {}'.format(bt))
self.logger.warning('Unknown boundary type: {}'.format(bt))

def __repr__(self):
return 'PolygonalDomain({}, {}, {})'.format(repr(self.points), repr(self.boundary_types), repr(self.holes))
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/functions/bitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, filename, bounding_box=None, range=None):
raise ImportError("PIL is needed for loading images. Try 'pip install pillow'")
img = Image.open(filename)
if not img.mode == "L":
self.logger.warn("Image " + filename + " not in grayscale mode. Convertig to grayscale.")
self.logger.warning("Image " + filename + " not in grayscale mode. Convertig to grayscale.")
img = img.convert('L')
self.bitmap = np.array(img).T[:, ::-1]
self.bounding_box = bounding_box
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/grids/boundaryinfos.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SubGridBoundaryInfo(BoundaryInfoInterface):

def __init__(self, subgrid, grid, grid_boundary_info, new_boundary_type=None):
if new_boundary_type is not None and new_boundary_type not in KNOWN_BOUNDARY_TYPES:
self.logger.warn('Unknown boundary type: {}'.format(new_boundary_type))
self.logger.warning('Unknown boundary type: {}'.format(new_boundary_type))

boundary_types = grid_boundary_info.boundary_types
has_new_boundaries = False
Expand Down
4 changes: 2 additions & 2 deletions src/pymor/gui/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ def visualize_patch(grid, U, bounding_box=([0, 0], [1, 1]), codim=2, title=None,
if backend == 'gl':
if not config.HAVE_GL:
logger = getLogger('pymor.gui.qt.visualize_patch')
logger.warn('import of PyOpenGL failed, falling back to matplotlib; rendering will be slow')
logger.warning('import of PyOpenGL failed, falling back to matplotlib; rendering will be slow')
backend = 'matplotlib'
elif not config.HAVE_QTOPENGL:
logger = getLogger('pymor.gui.qt.visualize_patch')
logger.warn('import of Qt.QtOpenGL failed, falling back to matplotlib; rendering will be slow')
logger.warning('import of Qt.QtOpenGL failed, falling back to matplotlib; rendering will be slow')
backend = 'matplotlib'
if backend == 'matplotlib' and not config.HAVE_MATPLOTLIB:
raise ImportError('cannot visualize: import of matplotlib failed')
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/operators/ei.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, operator, interpolation_dofs, collateral_basis, triangular,
try:
self.restricted_operator, self.source_dofs = operator.restricted(interpolation_dofs)
except NotImplementedError:
self.logger.warn('Operator has no "restricted" method. The full operator will be evaluated.')
self.logger.warning('Operator has no "restricted" method. The full operator will be evaluated.')
self.operator = operator
interpolation_matrix = collateral_basis.components(interpolation_dofs).T
self.interpolation_matrix = interpolation_matrix
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/operators/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def apply_inverse(self, V, mu=None, least_squares=False, check_finite=True,
from pymor.bindings.pyamg import apply_inverse as apply_inverse_impl
elif backend == 'generic':
logger = getLogger('pymor.bindings.scipy.scipy_apply_inverse')
logger.warn('You have selected a (potentially slow) generic solver for a NumPy matrix operator!')
logger.warning('You have selected a (potentially slow) generic solver for a NumPy matrix operator!')
from pymor.algorithms.genericsolvers import apply_inverse as apply_inverse_impl
else:
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/parallel/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def new_parallel_pool(ipython_num_engines=None, ipython_profile=None, allow_mpi=
global _pool
if _pool:
logger = getLogger('pymor.parallel.default.new_parallel_pool')
logger.warn('new_parallel_pool already called; returning old pool (this might not be what you want).')
logger.warning('new_parallel_pool already called; returning old pool (this might not be what you want).')
return _pool[1]
if ipython_num_engines or ipython_profile:
from pymor.parallel.ipython import new_ipcluster_pool
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/reductors/coercive.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def restricted_to_subbasis(self, dim, discretization):
residual = self.residual.projected_to_subbasis(residual_range_dims[-1], dim)
return ReduceCoerciveEstimator(residual, residual_range_dims, self.coercivity_estimator)
else:
self.logger.warn('Cannot efficiently reduce to subbasis')
self.logger.warning('Cannot efficiently reduce to subbasis')
return ReduceCoerciveEstimator(self.residual.projected_to_subbasis(None, dim), None,
self.coercivity_estimator)

Expand Down
2 changes: 1 addition & 1 deletion src/pymor/reductors/parabolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def restricted_to_subbasis(self, dim, discretization):
initial_residual, initial_residual_range_dims,
self.coercivity_estimator)
else:
self.logger.warn('Cannot efficiently reduce to subbasis')
self.logger.warning('Cannot efficiently reduce to subbasis')
return ReduceParabolicEstimator(self.residual.projected_to_subbasis(None, dim), None,
self.initial_residual.projected_to_subbasis(None, dim), None,
self.coercivity_estimator)
4 changes: 2 additions & 2 deletions src/pymor/reductors/residual.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def reduce_residual(operator, rhs=None, RB=None, product=None, extends=None):
orthonormalize=True, product=product,
riesz_representatives=rhs_is_functional)
except ImageCollectionError as e:
logger.warn('Cannot compute range of {}. Evaluation will be slow.'.format(e.op))
logger.warning('Cannot compute range of {}. Evaluation will be slow.'.format(e.op))
operator = project(operator, None, RB)
return (NonProjectedResidualOperator(operator, rhs, rhs_is_functional, product),
NonProjectedReconstructor(product),
Expand Down Expand Up @@ -286,7 +286,7 @@ def reduce_implicit_euler_residual(operator, mass, dt, functional=None, RB=None,
estimate_image_hierarchical([operator, mass], [functional.T], RB, (residual_range, residual_range_dims),
orthonormalize=True, product=product, riesz_representatives=True)
except ImageCollectionError as e:
logger.warn('Cannot compute range of {}. Evaluation will be slow.'.format(e.op))
logger.warning('Cannot compute range of {}. Evaluation will be slow.'.format(e.op))
operator = project(operator, None, RB)
mass = project(mass, None, RB)
return (NonProjectedImplicitEulerResidualOperator(operator, mass, functional, dt, product),
Expand Down
2 changes: 1 addition & 1 deletion src/pymor/tools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def load_matrix(path, key=None):
logger.info(file_type + ' file detected.')
return loader(path, key)

logger.warn('Could not detect file format. Trying all loaders ...')
logger.warning('Could not detect file format. Trying all loaders ...')

loaders = [_loadmat, _mmread, _loadtxt, _load]
for loader in loaders:
Expand Down
2 changes: 1 addition & 1 deletion src/pymortests/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def exercise_logger(logger):
for lvl in [getattr(logging, lvl) for lvl in ['WARN', 'ERROR', 'DEBUG', 'INFO']]:
logger.setLevel(lvl)
assert logger.isEnabledFor(lvl)
for verb in ['warn', 'error', 'debug', 'info']:
for verb in ['warning', 'error', 'debug', 'info']:
getattr(logger, verb)('{} -- logger {}'.format(verb, str(logger)))


Expand Down

0 comments on commit 2e0a2bd

Please sign in to comment.