pyccel.utilities.metaclasses module

pyccel.utilities.metaclasses module#

Module containing metaclasses which are useful for the rest of pyccel

class pyccel.utilities.metaclasses.ArgumentSingleton(name, bases, dct)[source]#

Bases: type

Metaclass indicating that there is only one instance of the parametrised class.

Metaclass indicating that there is only one instance of the class for any given set of arguments.

Parameters:
  • name (str) – The name of the class.

  • bases (tuple[class,...]) – A tuple of the superclasses of the class.

  • dct (dict) – A dictionary of the class attributes.

class pyccel.utilities.metaclasses.Singleton(name, bases, dct)[source]#

Bases: type

Metaclass indicating that there is only one instance of the class.

A metaclass which ensures that only one instance of the class is ever created. Trying to create a second instance will result in accessing the first.

Parameters:
  • name (str) – The name of the class.

  • bases (tuple[class,...]) – A tuple of the superclasses of the class.

  • dct (dict) – A dictionary of the class attributes.