From b83f2de782e739c4a6ce0f792aaa6a211f21b3b7 Mon Sep 17 00:00:00 2001 From: Robert Farmer Date: Sat, 24 Jun 2023 21:39:22 +0200 Subject: [PATCH] Fix licenses --- gfort2py/fArrays.py | 1 + gfort2py/fDT.py | 1 + gfort2py/fParameters.py | 3 ++ gfort2py/fProcPtr.py | 2 ++ gfort2py/fScalars.py | 2 ++ gfort2py/fStrings.py | 2 ++ gfort2py/fUnary.py | 63 +++++++++++++++++++++-------------------- gfort2py/fVar_t.py | 2 ++ gfort2py/utils.py | 2 ++ gfort2py/version.py | 2 ++ tests/conftest.py | 2 ++ tests/dummy_arrays.f90 | 18 ++++++++++++ 12 files changed, 69 insertions(+), 31 deletions(-) diff --git a/gfort2py/fArrays.py b/gfort2py/fArrays.py index ef51615..dd0d083 100644 --- a/gfort2py/fArrays.py +++ b/gfort2py/fArrays.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ import ctypes import numpy as np diff --git a/gfort2py/fDT.py b/gfort2py/fDT.py index 6d611d3..de9ed9e 100644 --- a/gfort2py/fDT.py +++ b/gfort2py/fDT.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ import ctypes import numpy as np diff --git a/gfort2py/fParameters.py b/gfort2py/fParameters.py index 66b4b18..538a87c 100644 --- a/gfort2py/fParameters.py +++ b/gfort2py/fParameters.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ + + class fParam: def __init__(self, obj): self.obj = obj diff --git a/gfort2py/fProcPtr.py b/gfort2py/fProcPtr.py index 12fcbd5..dda899e 100644 --- a/gfort2py/fProcPtr.py +++ b/gfort2py/fProcPtr.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import ctypes from .fVar_t import fVar_t diff --git a/gfort2py/fScalars.py b/gfort2py/fScalars.py index 0abc982..436dac1 100644 --- a/gfort2py/fScalars.py +++ b/gfort2py/fScalars.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import ctypes from .fVar_t import fVar_t diff --git a/gfort2py/fStrings.py b/gfort2py/fStrings.py index f82319e..ce2d31b 100644 --- a/gfort2py/fStrings.py +++ b/gfort2py/fStrings.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import ctypes import numpy as np diff --git a/gfort2py/fUnary.py b/gfort2py/fUnary.py index 372ceec..c8acfbf 100644 --- a/gfort2py/fUnary.py +++ b/gfort2py/fUnary.py @@ -1,42 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0+ + import operator default_ops = { - 'UPLUS': operator.__add__, - 'UMINUS': operator.__sub__, - 'PLUS': operator.__add__, - 'MINUS': operator.__sub__, - 'TIMES': operator.__mul__, - 'DIVIDE': operator.__truediv__, - 'POWER': operator.__pow__, - 'CONCAT': operator.__add__, # Only for strings - 'AND': operator.__and__, - 'OR': operator.__or__, - 'EQV': operator.__eq__, - 'NEQV': operator.__ne__, - 'EQ_SIGN': operator.__eq__, - 'EQ': operator.__eq__, - 'NE_SIGN': operator.__ne__, - 'NE': operator.__ne__, - 'GT_SIGN': operator.__gt__, - 'GT' : operator.__gt__, - 'GE_SIGN': operator.__ge__, - 'GE': operator.__ge__, - 'LT_SIGN': operator.__le__, - 'LT': operator.__le__, - 'LE_SIGN': operator.__le__, - 'LE': operator.__le__, - 'NOT': operator.__not__, - 'PARENTHESES': None, - 'USER': None, - 'NULL': None, + "UPLUS": operator.__add__, + "UMINUS": operator.__sub__, + "PLUS": operator.__add__, + "MINUS": operator.__sub__, + "TIMES": operator.__mul__, + "DIVIDE": operator.__truediv__, + "POWER": operator.__pow__, + "CONCAT": operator.__add__, # Only for strings + "AND": operator.__and__, + "OR": operator.__or__, + "EQV": operator.__eq__, + "NEQV": operator.__ne__, + "EQ_SIGN": operator.__eq__, + "EQ": operator.__eq__, + "NE_SIGN": operator.__ne__, + "NE": operator.__ne__, + "GT_SIGN": operator.__gt__, + "GT": operator.__gt__, + "GE_SIGN": operator.__ge__, + "GE": operator.__ge__, + "LT_SIGN": operator.__le__, + "LT": operator.__le__, + "LE_SIGN": operator.__le__, + "LE": operator.__le__, + "NOT": operator.__not__, + "PARENTHESES": None, + "USER": None, + "NULL": None, } -def run_unary(unary, x, y, *, ops=default_ops) : +def run_unary(unary, x, y, *, ops=default_ops): op = ops[unary] if op is None: raise NotImplementedError(f"Unary op {unary} not implemented") - return op(x,y) - + return op(x, y) diff --git a/gfort2py/fVar_t.py b/gfort2py/fVar_t.py index 0d774ba..38ca697 100644 --- a/gfort2py/fVar_t.py +++ b/gfort2py/fVar_t.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import ctypes import collections diff --git a/gfort2py/utils.py b/gfort2py/utils.py index 6593dd4..043b86e 100644 --- a/gfort2py/utils.py +++ b/gfort2py/utils.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import ctypes import itertools diff --git a/gfort2py/version.py b/gfort2py/version.py index 857a843..b8ba46a 100644 --- a/gfort2py/version.py +++ b/gfort2py/version.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + try: from importlib import metadata except ImportError: # for Python<3.8 diff --git a/tests/conftest.py b/tests/conftest.py index 96051c8..7b870ac 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + import subprocess import pytest import _pytest.skipping diff --git a/tests/dummy_arrays.f90 b/tests/dummy_arrays.f90 index 4582c00..06dc720 100644 --- a/tests/dummy_arrays.f90 +++ b/tests/dummy_arrays.f90 @@ -312,4 +312,22 @@ subroutine sub_check_alloc_int_3d(x) end subroutine sub_check_alloc_int_3d + function func_return_alloc_int_1d() result(v) + + integer,allocatable,dimension(:) :: v + + allocate(v(5)) + + v = 1 + + end function func_return_alloc_int_1d + + + subroutine func2 + integer,allocatable,dimension(:) :: v + + v = func_return_alloc_int_1d() + + end subroutine func2 + end module dummy_arrays