Skip to content

Commit

Permalink
Change way docs is written because of http://bugs.python.org/issue12773
Browse files Browse the repository at this point in the history
… which became clear when Brick's ABCMeta metaclass was removed
  • Loading branch information
bartvm committed Jan 17, 2015
1 parent 2e15141 commit fc5f472
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blocks/bricks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from itertools import chain

import numpy
from six import add_metaclass
from theano import tensor

from blocks.utils import (pack, repr_attrs, reraise_as, shared_floatx_zeros,
Expand Down Expand Up @@ -1024,6 +1025,12 @@ def apply(self, input_):

def _activation_factory(name, activation):
"""Class factory for Bricks which perform simple Theano calls."""
class ActivationDocumentation(type):
def __new__(cls, name, bases, classdict):
classdict['__doc__'] = classdict['__doc__'].format(name.lower())
return type.__new__(cls, name, bases, classdict)

@add_metaclass(ActivationDocumentation)
class Activation(Brick):
"""Element-wise application of {0} function."""
@application(inputs=['input_'], outputs=['output'])
Expand All @@ -1044,7 +1051,6 @@ def apply(self, input_):
output = activation(input_)
return output
Activation.__name__ = name
Activation.__doc__ = Activation.__doc__.format(name.lower())
Activation.apply.__doc__ = \
Activation.apply.__doc__.format(name.lower())
return Activation
Expand Down

0 comments on commit fc5f472

Please sign in to comment.