Example #1
0
    def plearn_repr(self, indent_level=0, inner_repr=plearn_repr):
        """PLearn representation of this python object.

        Are considered as elements any non-None attributes.
        """
        elem_format = lambda elem: inner_repr( elem, indent_level+1 )
        return '[%s]' % format_list_elements([optval for optval in iter(self)],
                                             elem_format, indent_level+1)
Example #2
0
    def plearn_repr(self, indent_level=0, inner_repr=plearn_repr):
        """PLearn representation of this python object.

        Are considered as elements any non-None attributes.
        """
        elem_format = lambda elem: inner_repr(elem, indent_level + 1)
        return '[%s]' % format_list_elements([optval for optval in iter(self)],
                                             elem_format, indent_level + 1)
Example #3
0
    def plearn_repr(self, indent_level=0, inner_repr=plearn_repr):
        """PLearn representation of this python object.

        Are considered as options any 'public' instance attributes.
        """
        options = format_list_elements(
            [(optname, optval) for (optname, optval) in self.iteritems()],
            lambda opt_pair: self._optionFormat(opt_pair, indent_level,
                                                inner_repr), indent_level + 1)
        return "%s(%s)" % (self.classname(), options)
Example #4
0
    def plearn_repr(self, indent_level=0, inner_repr=plearn_repr):
        """PLearn representation of this python object.

        Are considered as options any 'public' instance attributes.
        """
        options = format_list_elements(
            [ (optname,optval) for (optname,optval) in self.iteritems() ],
            lambda opt_pair: self._optionFormat(opt_pair, indent_level, inner_repr),
            indent_level+1
            )
        return "%s(%s)" % (self.classname(), options)
Example #5
0
     def plearn_repr( self, indent_level=0, inner_repr=plearn_repr ):
         # asking for plearn_repr could be to send specification over
         # to another prg so that will open the .pmat
         # So we make sure data is flushed to disk.
         self.flush()
 
         def elem_format( elem ):
             k, v = elem
             return '%s = %s' % ( k, inner_repr(v, indent_level+1) )
 
         options = [ ( 'filename',   self.fname      ),
                     ( 'inputsize',  self.inputsize  ), 
                     ( 'targetsize', self.targetsize ),
                     ( 'weightsize', self.weightsize ) ]
         return 'FileVMatrix(%s)' % format_list_elements( options, elem_format, indent_level+1 )