Read about our upcoming Code of Conduct on this issue

Commit 1d5c6238 authored by Pierre Augier's avatar Pierre Augier
Browse files

Start to modify to code for methods

--HG--
branch : dev
parent 893c12dba739
......@@ -114,6 +114,21 @@ def pythran_def(func):
return fp.pythran_def(func)
def pythran_class(cls):
"""Decorator to declare that a class contains pythran_def
Parameters
----------
cls: a class
"""
fp = _get_fluidpythran_calling_module()
return fp.pythran_class(cls)
def make_signature(func, **kwargs):
"""Create signature for a function with values for the template types
......@@ -342,6 +357,8 @@ class FluidPythran:
"""
# FIXME methods?
if is_transpiling:
self.functions[func.__name__] = func
return func
......@@ -360,6 +377,27 @@ class FluidPythran:
return func_tmp
def pythran_class(self, cls: type):
"""Decorator used for classes
Parameters
----------
cls: a class
"""
if is_transpiling:
self.classes[cls.__name__] = cls
return cls
if not self.is_transpiled:
return cls
# FIXME
return cls
def make_signature(self, func, _signature=None, **kwargs):
"""Create signature for a function with values for the template types
......
......@@ -11,15 +11,17 @@ from fluidpythran.log import logger, set_log_level
from fluidpythran.util import get_source_without_decorator
from fluidpythran.annotation import compute_pythran_types_from_valued_types
from fluidpythran import Array, Type, NDim
def pythran_def_method(func):
return func
# set_log_level("debug")
A = Array[Type(float, int), NDim(1, 2)]
from fluidpythran import Array, Type, NDim
def pythran_def_method(func):
return func
A = Array[Type(float, int), NDim(1, 2)]
class Transmitter:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment