# Path: pywrap/ast.py
# class TemplateClazzSpecialization(Clazz):
#     def __init__(self, filename, namespace, name, cppname, specialization,
#                  comment=""):
#         super(TemplateClazzSpecialization, self).__init__(
#             filename, namespace, name, comment)
#         self.cppname = cppname
#         self.specialization = specialization
# 
#     def get_cppname(self):
#         return self.cppname
# 
#     def get_attached_typeinfo(self):
#         return self.specialization
# 
# class Function(FunctionBase):
#     def __init__(self, filename, namespace, name, result_type, comment=""):
#         super(Function, self).__init__(name, comment)
#         self.filename = filename
#         self.namespace = namespace
#         self.result_type = result_type
# 
#     def __str__(self):
#         result = super(Function, self).__str__()
#         if self.result_type != "void":
#             result += os.linesep + indent_block(
#                 "Returns (%s)" % self.result_type, 1)
#         return result
# 
# class Param(AstNode):
#     def __init__(self, name, tipe):
#         super(Param, self).__init__()
#         self.name = name
#         self.tipe = tipe
#         self.default_value = None
# 
#     def __str__(self):
#         result = "Parameter (%s) %s" % (self.tipe, self.name)
#         if self.default_value is not None:
#             result += " = " + str(self.default_value)
#         return result
# 
# class Method(FunctionBase):
#     def __init__(self, name, result_type, class_name, comment=""):
#         super(Method, self).__init__(name, comment)
#         self.result_type = result_type
#         self.class_name = class_name
# 
#     def __str__(self):
#         result = super(Method, self).__str__()
#         if self.result_type != "void":
#             result += os.linesep + indent_block(
#                 "Returns (%s)" % self.result_type, 1)
#         return result


import warnings
from abc import ABCMeta, abstractmethod
from .ast import TemplateClazzSpecialization, Function, Param, Method

            specialized = Function(general.filename, general.namespace, name,
                                   result_type, general.comment)

            for arg in general.nodes:
                tipe = self._replace_specification(arg.tipe, spec)
                specialized.nodes.append(Param(arg.name, tipe))

            specialized_functions.append(specialized)
        return specialized_functions


class MethodSpecializer(Specializer):
    """Convert a template method to a method."""
    def __init__(self, config):
        super(MethodSpecializer, self).__init__(config)

    def _key(self, general):
        return "%s::%s" % (general.class_name, general.name)

    def _specialize(self, general, specs):
        specialized_methods = []
        for name, spec in specs:
            result_type = self._replace_specification(general.result_type, spec)

            specialized = Method(name, result_type, general.class_name,
                                 general.comment)

            for arg in general.nodes:
                tipe = self._replace_specification(arg.tipe, spec)

# Path: pywrap/ast.py
# class TemplateClazzSpecialization(Clazz):
#     def __init__(self, filename, namespace, name, cppname, specialization,
#                  comment=""):
#         super(TemplateClazzSpecialization, self).__init__(
#             filename, namespace, name, comment)
#         self.cppname = cppname
#         self.specialization = specialization
# 
#     def get_cppname(self):
#         return self.cppname
# 
#     def get_attached_typeinfo(self):
#         return self.specialization
# 
# class Function(FunctionBase):
#     def __init__(self, filename, namespace, name, result_type, comment=""):
#         super(Function, self).__init__(name, comment)
#         self.filename = filename
#         self.namespace = namespace
#         self.result_type = result_type
# 
#     def __str__(self):
#         result = super(Function, self).__str__()
#         if self.result_type != "void":
#             result += os.linesep + indent_block(
#                 "Returns (%s)" % self.result_type, 1)
#         return result
# 
# class Param(AstNode):
#     def __init__(self, name, tipe):
#         super(Param, self).__init__()
#         self.name = name
#         self.tipe = tipe
#         self.default_value = None
# 
#     def __str__(self):
#         result = "Parameter (%s) %s" % (self.tipe, self.name)
#         if self.default_value is not None:
#             result += " = " + str(self.default_value)
#         return result
# 
# class Method(FunctionBase):
#     def __init__(self, name, result_type, class_name, comment=""):
#         super(Method, self).__init__(name, comment)
#         self.result_type = result_type
#         self.class_name = class_name
# 
#     def __str__(self):
#         result = super(Method, self).__str__()
#         if self.result_type != "void":
#             result += os.linesep + indent_block(
#                 "Returns (%s)" % self.result_type, 1)
#         return result


# Path: pywrap/template_specialization.py
import warnings
from abc import ABCMeta, abstractmethod
from .ast import TemplateClazzSpecialization, Function, Param, Method


            specialized = Function(general.filename, general.namespace, name,
                                   result_type, general.comment)

            for arg in general.nodes:
                tipe = self._replace_specification(arg.tipe, spec)
                specialized.nodes.append(Param(arg.name, tipe))

            specialized_functions.append(specialized)
        return specialized_functions


class MethodSpecializer(Specializer):
    """Convert a template method to a method."""
    def __init__(self, config):
        super(MethodSpecializer, self).__init__(config)

    def _key(self, general):
        return "%s::%s" % (general.class_name, general.name)

    def _specialize(self, general, specs):
        specialized_methods = []
        for name, spec in specs:
            result_type = self._replace_specification(general.result_type, spec)

            specialized = Method(name, result_type, general.class_name,
                                 general.comment)

            for arg in general.nodes:
                tipe = self._replace_specification(arg.tipe, spec)

                specialized.nodes.append(Param(arg.name, tipe))