Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
Remove Python 2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
blechta committed Dec 14, 2017
1 parent f2b2511 commit f90e46b
Show file tree
Hide file tree
Showing 62 changed files with 42 additions and 181 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- checkout
- run:
name: Install dependencies # Install with sudo as tests not run as superuser in circleci/python
command: sudo pip install flake8 pytest six numpy sympy --upgrade
command: sudo pip install flake8 pytest numpy sympy --upgrade
- run:
name: Install FIAT
command: pip install . --user
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/build/
/dist/
/FIAT.egg-info/
/fenics_fiat.egg-info/

/.cache/
/doc/sphinx/source/api-doc
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ notifications:
template: "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} | %{build_url}"
language: python
python:
- "2.7"
- "3.4"

before_install:
- pip install --upgrade pip
- pip install flake8
- pip install flake8-future-import
- pip install pytest
- pip install six

install:
- pip install .
Expand Down
2 changes: 0 additions & 2 deletions FIAT/P0.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# This work is partially supported by the US Department of Energy
# under award number DE-FG02-04ER25650

from __future__ import absolute_import, print_function, division

from FIAT import dual_set, functional, polynomial_set, finite_element
import numpy

Expand Down
2 changes: 0 additions & 2 deletions FIAT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
evaluating arbitrary order Lagrange and many other elements.
Simplices in one, two, and three dimensions are supported."""

from __future__ import absolute_import, print_function, division

import pkg_resources

# Import finite element classes
Expand Down
2 changes: 0 additions & 2 deletions FIAT/argyris.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional
from FIAT.reference_element import TRIANGLE

Expand Down
2 changes: 0 additions & 2 deletions FIAT/brezzi_douglas_fortin_marini.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, print_function, division

from FIAT import (finite_element, functional, dual_set,
polynomial_set, lagrange)

Expand Down
2 changes: 0 additions & 2 deletions FIAT/brezzi_douglas_marini.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import (finite_element, quadrature, functional, dual_set,
polynomial_set, nedelec)

Expand Down
2 changes: 0 additions & 2 deletions FIAT/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT.lagrange import Lagrange
from FIAT.restricted import RestrictedElement

Expand Down
2 changes: 0 additions & 2 deletions FIAT/crouzeix_raviart.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#
# Last changed: 2010-01-28

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional


Expand Down
2 changes: 0 additions & 2 deletions FIAT/discontinuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT.finite_element import CiarletElement
from FIAT.dual_set import DualSet

Expand Down
2 changes: 0 additions & 2 deletions FIAT/discontinuous_lagrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional, P0


Expand Down
2 changes: 0 additions & 2 deletions FIAT/discontinuous_raviart_thomas.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#
# Modified by Jan Blechta 2014

from __future__ import absolute_import, print_function, division

from FIAT import dual_set, finite_element, functional
from FIAT.raviart_thomas import RTSpace

Expand Down
2 changes: 0 additions & 2 deletions FIAT/discontinuous_taylor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional, P0, quadrature
from FIAT.polynomial_set import mis
import numpy
Expand Down
7 changes: 2 additions & 5 deletions FIAT/dual_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

import numpy
from six import iteritems


class DualSet(object):
Expand All @@ -29,10 +26,10 @@ def __init__(self, nodes, ref_el, entity_ids):

# Compute the nodes on the closure of each sub_entity.
self.entity_closure_ids = {}
for dim, entities in iteritems(ref_el.sub_entities):
for dim, entities in ref_el.sub_entities.items():
self.entity_closure_ids[dim] = {}

for e, sub_entities in iteritems(entities):
for e, sub_entities in entities.items():
ids = []

for d, se in sub_entities:
Expand Down
2 changes: 0 additions & 2 deletions FIAT/enriched.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from itertools import chain

import numpy
Expand Down
2 changes: 0 additions & 2 deletions FIAT/expansions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
and Sherwin. These are parametrized over a reference element so as
to allow users to get coordinates that they want."""

from __future__ import absolute_import, print_function, division

import numpy
import math
import sympy
Expand Down
3 changes: 0 additions & 3 deletions FIAT/finite_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
# Modified by David A. Ham (david.ham@imperial.ac.uk), 2014
# Modified by Thomas H. Gibson (t.gibson15@imperial.ac.uk), 2016

from __future__ import absolute_import, print_function, division

import numpy
from six.moves import map

from FIAT.polynomial_set import PolynomialSet
from FIAT.quadrature_schemes import create_quadrature
Expand Down
2 changes: 0 additions & 2 deletions FIAT/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# - a reference element domain
# - type information

from __future__ import absolute_import, print_function, division

from collections import OrderedDict
from itertools import chain
import numpy
Expand Down
1 change: 0 additions & 1 deletion FIAT/gauss_legendre.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#
# Written by David A. Ham (david.ham@imperial.ac.uk), 2015

from __future__ import absolute_import, print_function, division
from FIAT import finite_element, polynomial_set, dual_set, functional, quadrature
from FIAT.reference_element import LINE

Expand Down
2 changes: 0 additions & 2 deletions FIAT/gauss_lobatto_legendre.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#
# Written by David A. Ham (david.ham@imperial.ac.uk), 2015

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional, quadrature
from FIAT.reference_element import LINE

Expand Down
10 changes: 3 additions & 7 deletions FIAT/hdiv_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division
from six import iteritems, itervalues
from six.moves import range

import numpy as np
from FIAT.discontinuous_lagrange import DiscontinuousLagrange
from FIAT.dual_set import DualSet
Expand Down Expand Up @@ -92,7 +88,7 @@ def __init__(self, ref_el, degree):
dg_elements = {}
entity_dofs = {}
topology = ref_el.get_topology()
for top_dim, entities in iteritems(topology):
for top_dim, entities in topology.items():
cell = ref_el.construct_subelement(top_dim)
entity_dofs[top_dim] = {}

Expand Down Expand Up @@ -216,7 +212,7 @@ def tabulate(self, order, points, entity=None):
# Retrieve values by tabulating the DG element
element = self.dg_elements[facet_sd]
nf = element.space_dimension()
nonzerovals, = itervalues(element.tabulate(order, new_points))
nonzerovals, = element.tabulate(order, new_points).values()
indices = slice(nf * unique_facet, nf * (unique_facet + 1))

else:
Expand Down Expand Up @@ -244,7 +240,7 @@ def tabulate(self, order, points, entity=None):
for i in range(num_facets):
# Found it! Grab insertion indices
if (facet_dim, i) == entity:
nonzerovals, = itervalues(element.tabulate(0, points))
nonzerovals, = element.tabulate(0, points).values()
indices = slice(offset, offset + nf)

offset += nf
Expand Down
2 changes: 0 additions & 2 deletions FIAT/hdivcurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

import numpy
import types
from FIAT.tensor_product import TensorProductElement
Expand Down
2 changes: 0 additions & 2 deletions FIAT/hellan_herrmann_johnson.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT.finite_element import CiarletElement
from FIAT.dual_set import DualSet
from FIAT.polynomial_set import ONSymTensorPolynomialSet
Expand Down
2 changes: 0 additions & 2 deletions FIAT/hermite.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional


Expand Down
2 changes: 0 additions & 2 deletions FIAT/jacobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
functions over the simplices and in defining quadrature
rules over each domain."""

from __future__ import absolute_import, print_function, division

import numpy


Expand Down
2 changes: 0 additions & 2 deletions FIAT/lagrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional


Expand Down
12 changes: 4 additions & 8 deletions FIAT/mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division
from six import iteritems
from six.moves import map

import numpy

from operator import add
Expand Down Expand Up @@ -90,7 +86,7 @@ def tabulate(self, order, points, entity=None):
for i, e in enumerate(self.elements()):
table = e.tabulate(order, points, entity)

for d, tab in iteritems(table):
for d, tab in table.items():
try:
arr = output[d]
except KeyError:
Expand All @@ -114,11 +110,11 @@ def concatenate_entity_dofs(ref_el, elements):
entity_dof containing the information for the concatenated DoFs of
all the elements."""
entity_dofs = {dim: {i: [] for i in entities}
for dim, entities in iteritems(ref_el.get_topology())}
for dim, entities in ref_el.get_topology().items()}
offsets = numpy.cumsum([0] + list(e.space_dimension()
for e in elements), dtype=int)
for i, d in enumerate(e.entity_dofs() for e in elements):
for dim, dofs in iteritems(d):
for ent, off in iteritems(dofs):
for dim, dofs in d.items():
for ent, off in dofs.items():
entity_dofs[dim][ent] += list(map(partial(add, offsets[i]), off))
return entity_dofs
2 changes: 0 additions & 2 deletions FIAT/morley.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import finite_element, polynomial_set, dual_set, functional
from FIAT.reference_element import TRIANGLE

Expand Down
2 changes: 0 additions & 2 deletions FIAT/nedelec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

from FIAT import (polynomial_set, expansions, quadrature, dual_set,
finite_element, functional)
from itertools import chain
Expand Down
2 changes: 0 additions & 2 deletions FIAT/nedelec_second_kind.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

import numpy

from FIAT.finite_element import CiarletElement
Expand Down
2 changes: 0 additions & 2 deletions FIAT/nodal_enriched.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with FIAT. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, division

import numpy as np

from FIAT.polynomial_set import PolynomialSet
Expand Down
8 changes: 3 additions & 5 deletions FIAT/orthopoly.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
Modified by David A. Ham (david.ham@imperial.ac.uk), 2016
"""

from __future__ import absolute_import, print_function, division

import numpy as np
from six.moves import xrange, reduce
from functools import reduce
from math import gamma


Expand Down Expand Up @@ -197,7 +195,7 @@ def polyval(alpha, beta, x):
P[:, 0] = 1
P[:, 1] = (x - alpha[0]) * P[:, 0]

for k in xrange(1, N):
for k in range(1, N):
P[:, k + 1] = (x - alpha[k]) * P[:, k] - beta[k] * P[:, k - 1]

return P
Expand Down Expand Up @@ -225,7 +223,7 @@ def jacobi(N, a, b, x, NOPT=1):
P[:, 1] = 0.5 * (a - b + (apb + 2) * x)

if N > 1:
for k in xrange(2, N + 1):
for k in range(2, N + 1):
k2 = 2 * k
g = k2 + apb
g1 = g - 1
Expand Down

0 comments on commit f90e46b

Please sign in to comment.