From 070444f1e5dd5125453c3d990670e18f29d1b98f Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Mon, 11 Feb 2019 18:27:39 +0100 Subject: [PATCH] get rid of deprecation warnings --- kwant/builder.py | 2 +- kwant/linalg/mumps.py | 12 ++++++------ kwant/operator.pyx | 2 +- kwant/wraparound.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/kwant/builder.py b/kwant/builder.py index 413d8c01..0d3554df 100644 --- a/kwant/builder.py +++ b/kwant/builder.py @@ -1945,7 +1945,7 @@ def _transfer_symmetry(syst, builder): syst._cons_law = operator(vals), operator(vecs) - elif isinstance(cons_law, collections.Mapping): + elif isinstance(cons_law, collections.abc.Mapping): vals = {family: (value if family.norbs == 1 else ta.array(np.diag(np.linalg.eigvalsh(value)))) for family, value in cons_law.items()} diff --git a/kwant/linalg/mumps.py b/kwant/linalg/mumps.py index 465ef1aa..c3bec6fd 100644 --- a/kwant/linalg/mumps.py +++ b/kwant/linalg/mumps.py @@ -239,9 +239,9 @@ class MUMPSContext: self.mumps_instance.set_assembled_matrix(a.shape[0], row, col, data) self.mumps_instance.icntl[7] = orderings[ordering] self.mumps_instance.job = 1 - t1 = time.clock() + t1 = time.process_time() self.mumps_instance.call() - t2 = time.clock() + t2 = time.process_time() self.factored = False if self.mumps_instance.infog[1] < 0: @@ -325,9 +325,9 @@ class MUMPSContext: done = False while not done: - t1 = time.clock() + t1 = time.process_time() self.mumps_instance.call() - t2 = time.clock() + t2 = time.process_time() # error -8, -9 (not enough allocated memory) is treated # specially, by increasing the memory relaxation parameter @@ -492,9 +492,9 @@ def schur_complement(a, indices, ordering='auto', ooc=False, pivot_tol=0.01, mumps_instance.set_schur(schur_compl, indices) mumps_instance.job = 4 # job=4 -> 1 and 2 after each other - t1 = time.clock() + t1 = time.process_time() mumps_instance.call() - t2 = time.clock() + t2 = time.process_time() if not calc_stats: return schur_compl diff --git a/kwant/operator.pyx b/kwant/operator.pyx index 2787b281..345cfba4 100644 --- a/kwant/operator.pyx +++ b/kwant/operator.pyx @@ -268,7 +268,7 @@ def _normalize_onsite(syst, onsite, check_hermiticity): _onsite = _FunctionalOnsite(onsite, syst.sites) except AttributeError: _onsite = onsite - elif isinstance(onsite, collections.Mapping): + elif isinstance(onsite, collections.abc.Mapping): if not hasattr(syst, 'sites'): raise TypeError('Provide `onsite` as a value or a function for ' 'systems that are not finalized Builders.') diff --git a/kwant/wraparound.py b/kwant/wraparound.py index 9b0e4185..aea92af6 100644 --- a/kwant/wraparound.py +++ b/kwant/wraparound.py @@ -26,7 +26,7 @@ __all__ = ['wraparound', 'plot_2d_bands'] def _hashable(obj): - return isinstance(obj, collections.Hashable) + return isinstance(obj, collections.abc.Hashable) def _memoize(f): -- GitLab