Skip to content

Commit

Permalink
Remove function build_pyccel_types_decorator from psydac.api.ast.util…
Browse files Browse the repository at this point in the history
…ities
  • Loading branch information
yguclu committed Oct 27, 2023
1 parent 7b4d1d1 commit ec031b4
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions psydac/api/ast/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

__all__ = (
'build_pyccel_type_annotations',
'build_pyccel_types_decorator',
'build_pythran_types_header',
'compute_atoms_expr',
'compute_atoms_expr_field',
Expand Down Expand Up @@ -880,47 +879,6 @@ def build_pyccel_type_annotations(args, order=None):

return new_args

#==============================================================================
def build_pyccel_types_decorator(args, order=None):
"""
builds a types decorator from a list of arguments (of FunctionDef)
"""
types = []
for a in args:
if isinstance(a, Variable):
rank = a.rank
dtype = a.dtype.name.lower()

elif isinstance(a, IndexedVariable):
rank = a.rank
dtype = a.dtype.name.lower()

elif isinstance(a, Constant):
rank = 0
if a.is_integer:
dtype = 'int'
elif a.is_real:
dtype = 'float'
elif a.is_complex:
dtype = 'complex'
else:
raise TypeError(f"The Constant {a} don't have any information about the type of the variable.\n"
f"Please create the Constant like this Constant('{a}', real=True), Constant('{a}', complex=True) or Constant('{a}', integer=True).")

else:
raise TypeError('unexpected type for {}'.format(a))

if rank > 0:
shape = ','.join(':' * rank)
dtype = '{dtype}[{shape}]'.format(dtype=dtype, shape=shape)
if order and rank > 1:
dtype = "{dtype}(order={ordering})".format(dtype=dtype, ordering=order)

dtype = String(dtype)
types.append(dtype)

return types

#==============================================================================
def build_pythran_types_header(name, args, order=None):
"""
Expand Down

0 comments on commit ec031b4

Please sign in to comment.