Skip to content

Commit

Permalink
Fix licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Jun 24, 2023
1 parent 35a0c48 commit b83f2de
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 31 deletions.
1 change: 1 addition & 0 deletions gfort2py/fArrays.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0+
import ctypes
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions gfort2py/fDT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0+
import ctypes
import numpy as np

Expand Down
3 changes: 3 additions & 0 deletions gfort2py/fParameters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+


class fParam:
def __init__(self, obj):
self.obj = obj
Expand Down
2 changes: 2 additions & 0 deletions gfort2py/fProcPtr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import ctypes

from .fVar_t import fVar_t
Expand Down
2 changes: 2 additions & 0 deletions gfort2py/fScalars.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import ctypes

from .fVar_t import fVar_t
Expand Down
2 changes: 2 additions & 0 deletions gfort2py/fStrings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import ctypes
import numpy as np

Expand Down
63 changes: 32 additions & 31 deletions gfort2py/fUnary.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions gfort2py/fVar_t.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import ctypes
import collections

Expand Down
2 changes: 2 additions & 0 deletions gfort2py/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import ctypes
import itertools

Expand Down
2 changes: 2 additions & 0 deletions gfort2py/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

try:
from importlib import metadata
except ImportError: # for Python<3.8
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+

import subprocess
import pytest
import _pytest.skipping
Expand Down
18 changes: 18 additions & 0 deletions tests/dummy_arrays.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b83f2de

Please sign in to comment.