Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop python<=3.7 support #2193

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Pythran documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 19 20:57:04 2014.
Expand Down Expand Up @@ -141,8 +140,8 @@ def dump_entry(entry_name, entry_value, depth):
master_doc = 'index'

# General information about the project.
project = u'Pythran'
copyright = u'2014, Serge Guelton, Pierrick Brunet et al.'
project = 'Pythran'
copyright = '2014, Serge Guelton, Pierrick Brunet et al.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
4 changes: 2 additions & 2 deletions docs/papers/iop2014/xp/numba/nqueens.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def n_queens(queen_count):
cols = range(queen_count)
#for vec in permutations(cols):
for vec in permutations(cols,None):
if (queen_count == len(set(vec[i]+i for i in cols))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't touch the input of paper examples.

== len(set(vec[i]-i for i in cols))):
if (queen_count == len({vec[i]+i for i in cols})
== len({vec[i]-i for i in cols})):
#yield vec
out.append(vec)
return out
1 change: 0 additions & 1 deletion docs/papers/iop2014/xp/parsetab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
Expand Down
4 changes: 2 additions & 2 deletions docs/papers/iop2014/xp/pypy/nqueens.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def n_queens(queen_count):
cols = range(queen_count)
#for vec in permutations(cols):
for vec in permutations(cols,None):
if (queen_count == len(set(vec[i]+i for i in cols))
== len(set(vec[i]-i for i in cols))):
if (queen_count == len({vec[i]+i for i in cols})
== len({vec[i]-i for i in cols})):
#yield vec
out.append(vec)
return out
4 changes: 2 additions & 2 deletions docs/papers/iop2014/xp/python/nqueens.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def n_queens(queen_count):
cols = range(queen_count)
#for vec in permutations(cols):
for vec in permutations(cols,None):
if (queen_count == len(set(vec[i]+i for i in cols))
== len(set(vec[i]-i for i in cols))):
if (queen_count == len({vec[i]+i for i in cols})
== len({vec[i]-i for i in cols})):
#yield vec
out.append(vec)
return out
4 changes: 2 additions & 2 deletions docs/papers/iop2014/xp/pythran/nqueens.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def n_queens(queen_count):
cols = range(queen_count)
#for vec in permutations(cols):
for vec in permutations(cols,None):
if (queen_count == len(set(vec[i]+i for i in cols))
== len(set(vec[i]-i for i in cols))):
if (queen_count == len({vec[i]+i for i in cols})
== len({vec[i]-i for i in cols})):
#yield vec
out.append(vec)
return out
1 change: 0 additions & 1 deletion docs/papers/sc2013/bench/pythran/parsetab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
Expand Down
8 changes: 4 additions & 4 deletions docs/papers/sc2013/bench/pythran/wave_.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def calculate_u(dt, dx, dy, u, um, k):
for j in xrange(1, u.shape[1]-1):
up[i,j] = 2*u[i,j] - um[i,j] + \
(dt/dx)**2*(
(0.5*(k[i+1,j] + k[i,j])*(u[i+1,j] - u[i,j]) -
0.5*(k[i,j] + k[i-1,j])*(u[i,j] - u[i-1,j]))) + \
0.5*(k[i+1,j] + k[i,j])*(u[i+1,j] - u[i,j]) -
0.5*(k[i,j] + k[i-1,j])*(u[i,j] - u[i-1,j])) + \
(dt/dy)**2*(
(0.5*(k[i,j+1] + k[i,j])*(u[i,j+1] - u[i,j]) -
0.5*(k[i,j] + k[i,j-1])*(u[i,j] - u[i,j-1])))
0.5*(k[i,j+1] + k[i,j])*(u[i,j+1] - u[i,j]) -
0.5*(k[i,j] + k[i,j-1])*(u[i,j] - u[i,j-1]))
return up

16 changes: 8 additions & 8 deletions docs/papers/sc2013/bench/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
os.path.basename(candidate))
# pythran
runas_commands = runas[0].replace('#runas', '').split(";")
runas_context = ";".join(["import {0}".format(
runas_context = ";".join(["import {}".format(
module_name)] + runas_commands[:-1])
runas_command = "{0}.{1}".format(module_name,
runas_command = "{}.{}".format(module_name,
runas_commands[-1])

ti = timeit.Timer(runas_command, runas_context)
timing = median(ti.repeat(nb_iter, number=1))
print module_name, timing,

# pythran + omp
runas_context = ";".join(["import {0}_omp".format(
runas_context = ";".join(["import {}_omp".format(
module_name)] + runas_commands[:-1])
runas_command = "{0}_omp.{1}".format(module_name,
runas_command = "{}_omp.{}".format(module_name,
runas_commands[-1])

ti = timeit.Timer(runas_command, runas_context)
Expand All @@ -46,19 +46,19 @@

#cython
runas_commands = runas[0].replace('#runas', '').split(";")
runas_context = ";".join(["import c{0}".format(
runas_context = ";".join(["import c{}".format(
module_name)] + runas_commands[:-1])
runas_command = "c{0}.{1}".format(module_name,
runas_command = "c{}.{}".format(module_name,
runas_commands[-1])

ti = timeit.Timer(runas_command, runas_context)
timing = median(ti.repeat(nb_iter, number=1))
print timing,

# cython + omp
runas_context = ";".join(["import c{0}_omp".format(
runas_context = ";".join(["import c{}_omp".format(
module_name)] + runas_commands[:-1])
runas_command = "c{0}_omp.{1}".format(module_name,
runas_command = "c{}_omp.{}".format(module_name,
runas_commands[-1])

ti = timeit.Timer(runas_command, runas_context)
Expand Down
4 changes: 2 additions & 2 deletions docs/papers/sc2013/bench/run_hyantes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
os.path.basename(candidate))
# pythran + omp
runas_commands = runas[0].replace('#runas', '').split(";")
runas_context = ";".join(["import {0}_omp".format(
runas_context = ";".join(["import {}_omp".format(
module_name)] + runas_commands[:-1])
runas_command = "{0}_omp.{1}".format(module_name,
runas_command = "{}_omp.{}".format(module_name,
runas_commands[-1])

ti = timeit.Timer(runas_command, runas_context)
Expand Down
4 changes: 2 additions & 2 deletions docs/papers/sc2013/hyantes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ def run():
with file('Rhone-alpesXYLongLat_pop.txt') as data_in:
towns = []
for line in data_in:
lat, lon, val = [x for x in line.split('\t') if x]
lat, lon, val = (x for x in line.split('\t') if x)
towns.append((float(lat)*pi/180, float(lon)*pi/180, float(val)))
towns = array(towns)
grid = hyantes_core.run(1.1*pi/180., 32*pi/180, 4*pi/180, 35*pi/180, 0.01*pi/180, 40, 290, 299, towns)
with file('out', 'w') as data_out:
for i in xrange(290):
for j in xrange(299):
data_out.write("{0} {1} {2}\n".format( grid[i,j,0], grid[i,j,1], grid[i,j,2]) )
data_out.write(f"{grid[i,j,0]} {grid[i,j,1]} {grid[i,j,2]}\n" )
data_out.write('\n')
#gnuplot -persist -e "set pm3d map; set size ratio 1; splot 'out'
if __name__ == '__main__':
Expand Down
1 change: 0 additions & 1 deletion docs/papers/sc2013/parsetab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
Expand Down
2 changes: 1 addition & 1 deletion docs/papers/sc2013/pythranmagic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class PythranMagics(Magics):

def __init__(self, shell):
super(PythranMagics,self).__init__(shell)
super().__init__(shell)
self._reloads = {}

def _import_all(self, module):
Expand Down
2 changes: 1 addition & 1 deletion omp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def msvc_runtime_major():
return major


class OpenMP(object):
class OpenMP:

"""
Internal representation of the OpenMP module.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pythran"
authors = [{name="Serge Guelton", email="[email protected]"}]
license = {file = "LICENSE"}
description = "Ahead of Time compiler for numeric kernels"
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
Expand Down
10 changes: 5 additions & 5 deletions pythran/analyses/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UnboundIdentifierError(RuntimeError):
pass


class DictLayer(object):
class DictLayer:
def __init__(self, base, layer=None):
self.base = base
self.layer = dict() if layer is None else layer
Expand All @@ -40,7 +40,7 @@ def get(self, key, default=None):
return self.layer.get(key, self.base.get(key, default))


class ContainerOf(object):
class ContainerOf:
'''
Represents a container of something

Expand Down Expand Up @@ -84,15 +84,15 @@ class Aliases(ModuleAnalysis):
def __init__(self):
self.result = dict()
self.aliases = None
super(Aliases, self).__init__(GlobalDeclarations)
super().__init__(GlobalDeclarations)

@staticmethod
def dump(result, filter=None):
def pp(n):
output = io.StringIO()
if isinstance(n, ContainerOf):
if n.index == n.index: # always valid except for UnknownIndex
output.write('[{}]='.format(n.index))
output.write(f'[{n.index}]=')
containees = sorted(map(pp, n.containees))
output.write(', '.join(map("|{}|".format, containees)))
else:
Expand All @@ -102,7 +102,7 @@ def pp(n):
if isinstance(result, dict):
for k, v in result.items():
if (filter is None) or isinstance(k, filter):
print('{} => {}'.format(pp(k), sorted(map(pp, v))))
print(f'{pp(k)} => {sorted(map(pp, v))}')
elif isinstance(result, (frozenset, set)):
print(sorted(map(pp, result)))

Expand Down
4 changes: 2 additions & 2 deletions pythran/analyses/ancestors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class Ancestors(ModuleAnalysis):
def __init__(self):
self.result = dict()
self.current = tuple()
super(Ancestors, self).__init__()
super().__init__()

def generic_visit(self, node):
self.result[node] = current = self.current
self.current += node,
super(Ancestors, self).generic_visit(node)
super().generic_visit(node)
self.current = current

visit = generic_visit
Expand Down
8 changes: 4 additions & 4 deletions pythran/analyses/argument_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from functools import reduce


class FunctionEffects(object):
class FunctionEffects:
def __init__(self, node):
self.func = node
if isinstance(node, ast.FunctionDef):
Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(self):
# modified by src
self.result = DiGraph()
self.node_to_functioneffect = {}
super(ArgumentEffects, self).__init__(Aliases, GlobalDeclarations,
super().__init__(Aliases, GlobalDeclarations,
Intrinsics)

def prepare(self, node):
Expand All @@ -67,7 +67,7 @@ def prepare(self, node):
Initialisation done for Pythonic functions and default value set for
user defined functions.
"""
super(ArgumentEffects, self).prepare(node)
super().prepare(node)
for i in self.intrinsics:
fe = IntrinsicArgumentEffects[i]
self.node_to_functioneffect[i] = fe
Expand All @@ -79,7 +79,7 @@ def prepare(self, node):
self.result.add_node(fe)

def run(self, node):
result = super(ArgumentEffects, self).run(node)
result = super().run(node)
candidates = set(result)
while candidates:
function = candidates.pop()
Expand Down
12 changes: 6 additions & 6 deletions pythran/analyses/argument_read_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ArgumentReadOnce(ModuleAnalysis):
FunctionDef ast node to function effect binding.
"""

class FunctionEffects(object):
class FunctionEffects:
def __init__(self, node):
self.func = node
self.dependencies = lambda ctx: 0
Expand All @@ -38,13 +38,13 @@ def __init__(self, node):
else:
raise NotImplementedError

class ConstructorEffects(object):
class ConstructorEffects:
def __init__(self, node):
self.func = node
self.dependencies = lambda ctx: 0
self.read_effects = [0]

class Context(object):
class Context:
def __init__(self, function, index, path, global_dependencies):
self.function = function
self.index = index
Expand All @@ -55,7 +55,7 @@ def __init__(self):
""" Basic initialiser for class attributes. """
self.result = set()
self.node_to_functioneffect = dict()
super(ArgumentReadOnce, self).__init__(Aliases, GlobalDeclarations)
super().__init__(Aliases, GlobalDeclarations)

def prepare(self, node):
"""
Expand All @@ -64,7 +64,7 @@ def prepare(self, node):
Initialisation done for Pythonic functions and default values set for
user defined functions.
"""
super(ArgumentReadOnce, self).prepare(node)
super().prepare(node)
# global functions init
for n in self.global_declarations.values():
fe = ArgumentReadOnce.FunctionEffects(n)
Expand All @@ -88,7 +88,7 @@ def save_effect(module):
save_effect(module)

def run(self, node):
result = super(ArgumentReadOnce, self).run(node)
result = super().run(node)
for fun in result:
for i in range(len(fun.read_effects)):
self.recursive_weight(fun, i, set())
Expand Down
6 changes: 3 additions & 3 deletions pythran/analyses/ast_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, identifier, type=None, constraint=None):
self.id = identifier
self.type = type
self.constraint = constraint
super(Placeholder, self).__init__()
super().__init__()


class AST_any(AST):
Expand All @@ -43,7 +43,7 @@ class AST_or(AST):
def __init__(self, *args):
""" Initialiser to keep track of arguments. """
self.args = args
super(AST_or, self).__init__()
super().__init__()


class Check(NodeVisitor):
Expand Down Expand Up @@ -207,7 +207,7 @@ def __init__(self, pattern):
""" Basic initialiser saving pattern and initialising result set. """
self.pattern = pattern
self.result = set()
super(ASTMatcher, self).__init__()
super().__init__()

def visit(self, node):
"""
Expand Down
2 changes: 1 addition & 1 deletion pythran/analyses/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CFG(FunctionAnalysis):

def __init__(self):
self.result = DiGraph()
super(CFG, self).__init__()
super().__init__()

def visit_FunctionDef(self, node):
"""OUT = node, RAISES = ()"""
Expand Down
2 changes: 1 addition & 1 deletion pythran/analyses/constant_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConstantExpressions(NodeAnalysis):

def __init__(self):
self.result = set()
super(ConstantExpressions, self).__init__(Globals, Locals, Aliases,
super().__init__(Globals, Locals, Aliases,
PureFunctions)

def add(self, node):
Expand Down
2 changes: 1 addition & 1 deletion pythran/analyses/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Dependencies(ModuleAnalysis):

def __init__(self):
self.result = set()
super(Dependencies, self).__init__()
super().__init__()

def visit_List(self, node):
self.result.add(('builtins', 'list'))
Expand Down
Loading
Loading