diff --git a/.travis.yml b/.travis.yml index 25b730ce..30233302 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,11 @@ notifications: language: python python: - - "2.7" - "3.5" before_install: - pip install -r requirements.txt - pip install flake8 - - pip install flake8-future-import - pip install --upgrade pytest install: diff --git a/gem/__init__.py b/gem/__init__.py index af1b768c..f1e77203 100644 --- a/gem/__init__.py +++ b/gem/__init__.py @@ -1,4 +1,2 @@ -from __future__ import absolute_import, print_function, division - from gem.gem import * # noqa from gem.optimise import select_expression # noqa diff --git a/gem/coffee.py b/gem/coffee.py index c1afb774..be8a041e 100644 --- a/gem/coffee.py +++ b/gem/coffee.py @@ -4,9 +4,6 @@ This file is NOT for code generation as a COFFEE AST. """ -from __future__ import absolute_import, print_function, division -from six.moves import map, range - from collections import OrderedDict import itertools import logging diff --git a/gem/gem.py b/gem/gem.py index 978f17ce..d5870ac9 100644 --- a/gem/gem.py +++ b/gem/gem.py @@ -14,10 +14,6 @@ indices. """ -from __future__ import absolute_import, print_function, division -from six import with_metaclass -from six.moves import range, zip - from abc import ABCMeta from itertools import chain from operator import attrgetter @@ -57,7 +53,7 @@ def __call__(self, *args, **kwargs): return obj -class Node(with_metaclass(NodeMeta, NodeBase)): +class Node(NodeBase, metaclass=NodeMeta): """Abstract GEM node class.""" __slots__ = ('free_indices',) @@ -380,7 +376,7 @@ def __new__(cls, condition, then, else_): return self -class IndexBase(with_metaclass(ABCMeta)): +class IndexBase(metaclass=ABCMeta): """Abstract base class for indices.""" pass diff --git a/gem/impero.py b/gem/impero.py index 3eee267e..c909e1bf 100644 --- a/gem/impero.py +++ b/gem/impero.py @@ -10,9 +10,6 @@ (Command?) after clicking on them. """ -from __future__ import absolute_import, print_function, division -from six import with_metaclass - from abc import ABCMeta, abstractmethod from gem.node import Node as NodeBase @@ -24,7 +21,7 @@ class Node(NodeBase): __slots__ = () -class Terminal(with_metaclass(ABCMeta, Node)): +class Terminal(Node, metaclass=ABCMeta): """Abstract class for terminal Impero nodes""" __slots__ = () diff --git a/gem/impero_utils.py b/gem/impero_utils.py index 43e739be..e5635975 100644 --- a/gem/impero_utils.py +++ b/gem/impero_utils.py @@ -6,14 +6,10 @@ C code or a COFFEE AST. """ -from __future__ import absolute_import, print_function, division -from six.moves import filter - import collections +from functools import singledispatch from itertools import chain, groupby -from singledispatch import singledispatch - from gem.node import traversal, collect_refcount from gem import gem, impero as imp, optimise, scheduling diff --git a/gem/interpreter.py b/gem/interpreter.py index a34ff577..a7e2e724 100644 --- a/gem/interpreter.py +++ b/gem/interpreter.py @@ -1,14 +1,11 @@ """ An interpreter for GEM trees. """ -from __future__ import absolute_import, print_function, division -from six.moves import map - import numpy import operator import math from collections import OrderedDict -from singledispatch import singledispatch +from functools import singledispatch import itertools from gem import gem, node diff --git a/gem/node.py b/gem/node.py index 6738381b..8345a0d6 100644 --- a/gem/node.py +++ b/gem/node.py @@ -1,9 +1,6 @@ """Generic abstract node class and utility functions for creating expression DAG languages.""" -from __future__ import absolute_import, print_function, division -from six.moves import map, zip - import collections diff --git a/gem/optimise.py b/gem/optimise.py index d19006de..ebfffeee 100644 --- a/gem/optimise.py +++ b/gem/optimise.py @@ -1,15 +1,11 @@ """A set of routines implementing various transformations on GEM expressions.""" -from __future__ import absolute_import, print_function, division -from six.moves import filter, map, zip, zip_longest - from collections import OrderedDict, defaultdict -from functools import partial, reduce -from itertools import combinations, permutations +from functools import singledispatch, partial, reduce +from itertools import combinations, permutations, zip_longest import numpy -from singledispatch import singledispatch from gem.utils import groupby from gem.node import (Memoizer, MemoizerArg, reuse_if_untouched, diff --git a/gem/refactorise.py b/gem/refactorise.py index d3e2d4a7..1c65d11d 100644 --- a/gem/refactorise.py +++ b/gem/refactorise.py @@ -1,12 +1,9 @@ """Data structures and algorithms for generic expansion and refactorisation.""" -from __future__ import absolute_import, print_function, division -from six import iteritems -from six.moves import intern, map - from collections import Counter, OrderedDict, defaultdict, namedtuple from itertools import product +from sys import intern from gem.node import Memoizer, traversal from gem.gem import Node, Zero, Product, Sum, Indexed, ListTensor, one @@ -73,7 +70,7 @@ def add(self, sum_indices, atomics, rest): assert len(sum_indices) == len(sum_indices_set) atomics = tuple(atomics) - atomics_set = frozenset(iteritems(Counter(atomics))) + atomics_set = frozenset(Counter(atomics).items()) assert isinstance(rest, Node) @@ -83,7 +80,7 @@ def add(self, sum_indices, atomics, rest): def __iter__(self): """Iteration yields :py:class:`Monomial` objects""" - for key, (sum_indices, atomics) in iteritems(self.ordering): + for key, (sum_indices, atomics) in self.ordering.items(): rest = self.monomials[key] yield Monomial(sum_indices, atomics, rest) @@ -95,9 +92,9 @@ def sum(*args): assert isinstance(arg, MonomialSum) # Optimised implementation: no need to decompose and # reconstruct key. - for key, rest in iteritems(arg.monomials): + for key, rest in arg.monomials.items(): result.monomials[key] = Sum(result.monomials[key], rest) - for key, value in iteritems(arg.ordering): + for key, value in arg.ordering.items(): result.ordering.setdefault(key, value) return result diff --git a/gem/scheduling.py b/gem/scheduling.py index 767abce4..1fbb563c 100644 --- a/gem/scheduling.py +++ b/gem/scheduling.py @@ -1,8 +1,6 @@ """Schedules operations to evaluate a multi-root expression DAG, forming an ordered list of Impero terminals.""" -from __future__ import absolute_import, print_function, division - import collections import functools diff --git a/gem/unconcatenate.py b/gem/unconcatenate.py index 975b74c6..ce6e30b3 100644 --- a/gem/unconcatenate.py +++ b/gem/unconcatenate.py @@ -50,13 +50,10 @@ unconcatenation, and then add up the results. """ -from __future__ import absolute_import, print_function, division -from six.moves import map, range, zip - +from functools import singledispatch from itertools import chain import numpy -from singledispatch import singledispatch from gem.node import Memoizer, reuse_if_untouched from gem.gem import (ComponentTensor, Concatenate, FlexiblyIndexed, diff --git a/gem/utils.py b/gem/utils.py index 1d7b62cc..12e0e0f6 100644 --- a/gem/utils.py +++ b/gem/utils.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six import viewitems - import collections @@ -36,7 +33,7 @@ def groupby(iterable, key=None): groups = collections.OrderedDict() for elem in iterable: groups.setdefault(key(elem), []).append(elem) - return viewitems(groups) + return groups.items() def make_proxy_class(name, cls): diff --git a/requirements-ext.txt b/requirements-ext.txt index ce6ba245..24ce15ab 100644 --- a/requirements-ext.txt +++ b/requirements-ext.txt @@ -1,3 +1 @@ numpy -singledispatch -six diff --git a/setup.cfg b/setup.cfg index 3179d526..12de4520 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,3 @@ [flake8] -ignore = - E501,E226,E731,E741, - FI14,FI54, - FI50,FI51,FI53 +ignore = E501,E226,E731,E741 exclude = .git,__pycache__,build,dist -min-version = 2.7 diff --git a/setup.py b/setup.py index 8a05e32c..e300a605 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -from __future__ import print_function, division, absolute_import - from distutils.core import setup version = "0.0.1" diff --git a/tests/test_codegen.py b/tests/test_codegen.py index b0694281..8d0bc796 100644 --- a/tests/test_codegen.py +++ b/tests/test_codegen.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import pytest from gem import impero_utils diff --git a/tests/test_coffee_optimise.py b/tests/test_coffee_optimise.py index bef6d825..065bb22e 100644 --- a/tests/test_coffee_optimise.py +++ b/tests/test_coffee_optimise.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import pytest from gem.gem import Index, Indexed, Product, Variable, Division, Literal, Sum diff --git a/tests/test_create_fiat_element.py b/tests/test_create_fiat_element.py index 259a0c8b..1fa2f437 100644 --- a/tests/test_create_fiat_element.py +++ b/tests/test_create_fiat_element.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import FIAT diff --git a/tests/test_create_finat_element.py b/tests/test_create_finat_element.py index 83c2b643..e135576d 100644 --- a/tests/test_create_finat_element.py +++ b/tests/test_create_finat_element.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import ufl diff --git a/tests/test_delta_elimination.py b/tests/test_delta_elimination.py index df76629f..3ac3f8dc 100644 --- a/tests/test_delta_elimination.py +++ b/tests/test_delta_elimination.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import pytest from gem.gem import Delta, Identity, Index, Indexed, one diff --git a/tests/test_estimated_degree.py b/tests/test_estimated_degree.py index d07cfeca..c3c80f02 100644 --- a/tests/test_estimated_degree.py +++ b/tests/test_estimated_degree.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import logging import pytest diff --git a/tests/test_firedrake_972.py b/tests/test_firedrake_972.py index b318233d..b8cc9922 100644 --- a/tests/test_firedrake_972.py +++ b/tests/test_firedrake_972.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy import pytest diff --git a/tests/test_flexibly_indexed.py b/tests/test_flexibly_indexed.py index cd40b701..8390bceb 100644 --- a/tests/test_flexibly_indexed.py +++ b/tests/test_flexibly_indexed.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six.moves import range - from itertools import product import numpy diff --git a/tests/test_gem_failure.py b/tests/test_gem_failure.py index 03fb3521..8bf31338 100644 --- a/tests/test_gem_failure.py +++ b/tests/test_gem_failure.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from ufl import (triangle, tetrahedron, FiniteElement, TrialFunction, TestFunction, inner, grad, dx, dS) from tsfc import compile_form diff --git a/tests/test_geometry.py b/tests/test_geometry.py index 6c36ce13..458f1b56 100644 --- a/tests/test_geometry.py +++ b/tests/test_geometry.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import pytest import numpy as np diff --git a/tests/test_idempotency.py b/tests/test_idempotency.py index e5ce04dd..7656592e 100644 --- a/tests/test_idempotency.py +++ b/tests/test_idempotency.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl from tsfc import compile_form import pytest diff --git a/tests/test_pickle_gem.py b/tests/test_pickle_gem.py index 4d484a98..73e39cac 100644 --- a/tests/test_pickle_gem.py +++ b/tests/test_pickle_gem.py @@ -1,5 +1,4 @@ -from __future__ import absolute_import, print_function, division -from six.moves import cPickle as pickle, range +import pickle import gem import numpy import pytest diff --git a/tests/test_refactorise.py b/tests/test_refactorise.py index c12747ea..8c8251df 100644 --- a/tests/test_refactorise.py +++ b/tests/test_refactorise.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - from functools import partial import pytest diff --git a/tests/test_simplification.py b/tests/test_simplification.py index 6df0be43..e5fe3d66 100644 --- a/tests/test_simplification.py +++ b/tests/test_simplification.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import pytest from gem.gem import Variable, Zero, Conditional, \ diff --git a/tests/test_sum_factorisation.py b/tests/test_sum_factorisation.py index 0b36d4df..9e31b125 100644 --- a/tests/test_sum_factorisation.py +++ b/tests/test_sum_factorisation.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six.moves import range - import numpy import pytest diff --git a/tests/test_tensor.py b/tests/test_tensor.py index c3e8950e..f13ea79b 100644 --- a/tests/test_tensor.py +++ b/tests/test_tensor.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import numpy import pytest diff --git a/tests/test_underintegration.py b/tests/test_underintegration.py index 9bd2cc1c..6d7846fb 100644 --- a/tests/test_underintegration.py +++ b/tests/test_underintegration.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six.moves import range - from functools import reduce import numpy diff --git a/tsfc/__init__.py b/tsfc/__init__.py index da4cbbfa..e69abac5 100644 --- a/tsfc/__init__.py +++ b/tsfc/__init__.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - from tsfc.driver import compile_form, compile_expression_at_points # noqa: F401 from tsfc.parameters import default_parameters # noqa: F401 diff --git a/tsfc/coffee.py b/tsfc/coffee.py index 0bae0591..915e60e5 100644 --- a/tsfc/coffee.py +++ b/tsfc/coffee.py @@ -2,15 +2,12 @@ This is the final stage of code generation in TSFC.""" -from __future__ import absolute_import, print_function, division - from collections import defaultdict -from functools import reduce +from functools import singledispatch, reduce from math import isnan import itertools import numpy -from singledispatch import singledispatch import coffee.base as coffee diff --git a/tsfc/coffee_mode.py b/tsfc/coffee_mode.py index 2dc62174..025a9b34 100644 --- a/tsfc/coffee_mode.py +++ b/tsfc/coffee_mode.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six.moves import zip - from functools import partial, reduce from gem.node import traversal diff --git a/tsfc/driver.py b/tsfc/driver.py index 8e74f4ff..e09aef10 100644 --- a/tsfc/driver.py +++ b/tsfc/driver.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six import iterkeys, iteritems, viewitems -from six.moves import range, zip - import collections import operator import string @@ -186,8 +182,8 @@ def compile_integral(integral_data, form_data, prefix, parameters, # Finalise mode representations into a set of assignments assignments = [] - for mode, var_reps in iteritems(mode_irs): - assignments.extend(mode.flatten(viewitems(var_reps), index_cache)) + for mode, var_reps in mode_irs.items(): + assignments.extend(mode.flatten(var_reps.items(), index_cache)) if assignments: return_variables, expressions = zip(*assignments) @@ -197,8 +193,8 @@ def compile_integral(integral_data, form_data, prefix, parameters, # Need optimised roots for COFFEE options = dict(reduce(operator.and_, - [viewitems(mode.finalise_options) - for mode in iterkeys(mode_irs)])) + [mode.finalise_options.items() + for mode in mode_irs.keys()])) expressions = impero_utils.preprocess_gem(expressions, **options) assignments = list(zip(return_variables, expressions)) diff --git a/tsfc/fem.py b/tsfc/fem.py index d21ed1ea..6e7a9ece 100644 --- a/tsfc/fem.py +++ b/tsfc/fem.py @@ -1,15 +1,11 @@ """Functions to translate UFL finite element objects and reference geometric quantities into GEM expressions.""" -from __future__ import absolute_import, print_function, division -from six import iterkeys, iteritems, itervalues -from six.moves import map, range, zip - import collections import itertools +from functools import singledispatch import numpy -from singledispatch import singledispatch import ufl from ufl.corealg.map_dag import map_expr_dag, map_expr_dags @@ -397,17 +393,17 @@ def translate_cell_edge_vectors(terminal, mt, ctx): gem.Sum(gem.Indexed(cell_vertices, (u, c)), gem.Product(gem.Literal(-1), gem.Indexed(cell_vertices, (v, c)))) - for _, (u, v) in sorted(iteritems(ctx.fiat_cell.get_topology()[1])) + for _, (u, v) in sorted(ctx.fiat_cell.get_topology()[1].items()) ]) return gem.ComponentTensor(gem.Indexed(expr, (e,)), (e, c)) def fiat_to_ufl(fiat_dict, order): # All derivative multiindices must be of the same dimension. - dimension, = list(set(len(alpha) for alpha in iterkeys(fiat_dict))) + dimension, = set(len(alpha) for alpha in fiat_dict.keys()) # All derivative tables must have the same shape. - shape, = list(set(table.shape for table in itervalues(fiat_dict))) + shape, = set(table.shape for table in fiat_dict.values()) sigma = tuple(gem.Index(extent=extent) for extent in shape) # Convert from FIAT to UFL format @@ -434,7 +430,7 @@ def callback(entity_id): finat_dict = ctx.basis_evaluation(element, mt.local_derivatives, entity_id) # Filter out irrelevant derivatives filtered_dict = {alpha: table - for alpha, table in iteritems(finat_dict) + for alpha, table in finat_dict.items() if sum(alpha) == mt.local_derivatives} # Change from FIAT to UFL arrangement @@ -461,7 +457,7 @@ def translate_coefficient(terminal, mt, ctx): per_derivative = collections.defaultdict(list) for entity_id in ctx.entity_ids: finat_dict = ctx.basis_evaluation(element, mt.local_derivatives, entity_id) - for alpha, table in iteritems(finat_dict): + for alpha, table in finat_dict.items(): # Filter out irrelevant derivatives if sum(alpha) == mt.local_derivatives: # A numerical hack that FFC used to apply on FIAT @@ -476,11 +472,11 @@ def take_singleton(xs): x, = xs # asserts singleton return x per_derivative = {alpha: take_singleton(tables) - for alpha, tables in iteritems(per_derivative)} + for alpha, tables in per_derivative.items()} else: f = ctx.entity_number(mt.restriction) per_derivative = {alpha: gem.select_expression(tables, f) - for alpha, tables in iteritems(per_derivative)} + for alpha, tables in per_derivative.items()} # Coefficient evaluation ctx.index_cache.setdefault(terminal.ufl_element(), element.get_indices()) @@ -488,7 +484,7 @@ def take_singleton(xs): zeta = element.get_value_indices() vec_beta, = gem.optimise.remove_componenttensors([gem.Indexed(vec, beta)]) value_dict = {} - for alpha, table in iteritems(per_derivative): + for alpha, table in per_derivative.items(): table_qi = gem.Indexed(table, beta + zeta) summands = [] for var, expr in unconcatenate([(vec_beta, table_qi)], ctx.index_cache): diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 6cf579c1..c106cbcc 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -21,10 +21,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with FFC. If not, see . -from __future__ import absolute_import, print_function, division - -from singledispatch import singledispatch -from functools import partial +from functools import singledispatch, partial import weakref import FIAT diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index 0a794b38..6529ce3b 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -21,10 +21,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with FFC. If not, see . -from __future__ import absolute_import, print_function, division -from six import iteritems - -from singledispatch import singledispatch +from functools import singledispatch import weakref import finat @@ -227,7 +224,7 @@ def _create_element(ufl_element, **kwargs): _cache[ufl_element] = {} cache = _cache[ufl_element] - for key, finat_element in iteritems(cache): + for key, finat_element in cache.items(): # Cache hit if all relevant parameter values match. if all(kwargs[param] == value for param, value in key): return finat_element, set(param for param, value in key) diff --git a/tsfc/kernel_interface/__init__.py b/tsfc/kernel_interface/__init__.py index 0eb52be7..0ff4b6e9 100644 --- a/tsfc/kernel_interface/__init__.py +++ b/tsfc/kernel_interface/__init__.py @@ -1,12 +1,9 @@ -from __future__ import absolute_import, print_function, division -from six import with_metaclass - from abc import ABCMeta, abstractmethod from gem.utils import make_proxy_class -class KernelInterface(with_metaclass(ABCMeta)): +class KernelInterface(metaclass=ABCMeta): """Abstract interface for accessing the GEM expressions corresponding to kernel arguments.""" diff --git a/tsfc/kernel_interface/common.py b/tsfc/kernel_interface/common.py index b3fee316..bf9fd4c1 100644 --- a/tsfc/kernel_interface/common.py +++ b/tsfc/kernel_interface/common.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import numpy import coffee.base as coffee diff --git a/tsfc/kernel_interface/firedrake.py b/tsfc/kernel_interface/firedrake.py index 36fd2293..597f16fc 100644 --- a/tsfc/kernel_interface/firedrake.py +++ b/tsfc/kernel_interface/firedrake.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import numpy from collections import namedtuple from itertools import chain, product diff --git a/tsfc/kernel_interface/ufc.py b/tsfc/kernel_interface/ufc.py index 9c9b1435..c0f2ca79 100644 --- a/tsfc/kernel_interface/ufc.py +++ b/tsfc/kernel_interface/ufc.py @@ -1,6 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six.moves import range, zip - import numpy import functools from itertools import chain, product diff --git a/tsfc/logging.py b/tsfc/logging.py index e0648389..6bced525 100644 --- a/tsfc/logging.py +++ b/tsfc/logging.py @@ -1,7 +1,5 @@ """Logging for TSFC.""" -from __future__ import absolute_import, print_function, division - import logging logger = logging.getLogger('tsfc') diff --git a/tsfc/modified_terminals.py b/tsfc/modified_terminals.py index 006124f2..1cbf41f4 100644 --- a/tsfc/modified_terminals.py +++ b/tsfc/modified_terminals.py @@ -20,8 +20,6 @@ """Definitions of 'modified terminals', a core concept in uflacs.""" -from __future__ import absolute_import, print_function, division - from ufl.classes import (ReferenceValue, ReferenceGrad, NegativeRestricted, PositiveRestricted, Restricted, FacetAvg, CellAvg, ConstantValue, diff --git a/tsfc/parameters.py b/tsfc/parameters.py index 51893807..70dc647d 100644 --- a/tsfc/parameters.py +++ b/tsfc/parameters.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import numpy diff --git a/tsfc/spectral.py b/tsfc/spectral.py index 96f59948..3db58c46 100644 --- a/tsfc/spectral.py +++ b/tsfc/spectral.py @@ -1,9 +1,6 @@ -from __future__ import absolute_import, print_function, division -from six.moves import zip, zip_longest - from collections import OrderedDict, defaultdict, namedtuple from functools import partial, reduce -from itertools import chain +from itertools import chain, zip_longest from gem.gem import Delta, Indexed, Sum, index_sum, one from gem.optimise import delta_elimination as _delta_elimination diff --git a/tsfc/tensor.py b/tsfc/tensor.py index a9f1ad17..d4f80fa0 100644 --- a/tsfc/tensor.py +++ b/tsfc/tensor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import, print_function, division -from six import iteritems -from six.moves import zip - from collections import defaultdict from functools import partial, reduce from itertools import count @@ -39,7 +35,7 @@ def einsum(factors, sum_indices): subscript_parts.append(''.join(letters)) result_pairs = sorted((letter, index) - for index, letter in iteritems(index2letter) + for index, letter in index2letter.items() if index not in sum_indices) subscripts = ','.join(subscript_parts) + '->' + ''.join(l for l, i in result_pairs) diff --git a/tsfc/ufl2gem.py b/tsfc/ufl2gem.py index f739e0dc..33b50723 100644 --- a/tsfc/ufl2gem.py +++ b/tsfc/ufl2gem.py @@ -1,7 +1,5 @@ """Translation of UFL tensor-algebra into GEM tensor-algebra.""" -from __future__ import absolute_import, print_function, division - import collections import ufl diff --git a/tsfc/ufl_utils.py b/tsfc/ufl_utils.py index bc53419e..e8575347 100644 --- a/tsfc/ufl_utils.py +++ b/tsfc/ufl_utils.py @@ -1,9 +1,8 @@ """Utilities for preprocessing UFL objects.""" -from __future__ import absolute_import, print_function, division +from functools import singledispatch import numpy -from singledispatch import singledispatch import ufl from ufl import as_tensor, indices, replace diff --git a/tsfc/vanilla.py b/tsfc/vanilla.py index c995e162..ecf24cd5 100644 --- a/tsfc/vanilla.py +++ b/tsfc/vanilla.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - from functools import reduce from gem import index_sum, Sum