Exemplo n.º 1
0
 def load(cls, path):
     if path is None:
         return cls.load_from_dict({})
     else:
         d = io.load(path)
         # Check class type
         class_name = d.get('name')
         if class_name is not None:
             return cls.getclass(class_name).load_from_dict(d)
         else:
             return cls.load_from_dict(d)
Exemplo n.º 2
0
 def load(cls, path):
     if path is None:
         return cls.load_from_dict({})
     else:
         d = io.load(path)
         # Check class type
         class_name = d.get('name')
         if class_name is not None:
             return cls.getclass(class_name).load_from_dict(d)
         else:
             return cls.load_from_dict(d)
Exemplo n.º 3
0
    def load(cls, path):
        """
        Loads an instance of the class from a file.

        Parameters
        ----------
        path : str
            Path to an HDF5 file. 

        Examples
        --------
        This is an abstract data type, but let us say that ``Foo`` inherits from ``Saveable``. To construct
        an object of this class from a file, we do:

        >>> foo = Foo.load('foo.h5') #doctest: +SKIP
        """
        if path is None:
            return cls.load_from_dict({})
        else:
            d = io.load(path)
            return cls.load_from_dict(d)
Exemplo n.º 4
0
    def load(cls, path):
        """
        Loads an instance of the class from a file.

        Parameters
        ----------
        path : str
            Path to an HDF5 file. 

        Examples
        --------
        This is an abstract data type, but let us say that ``Foo`` inherits from ``Saveable``. To construct
        an object of this class from a file, we do:

        >>> foo = Foo.load('foo.h5') #doctest: +SKIP
        """
        if path is None:
            return cls.load_from_dict({})
        else:
            d = io.load(path)
            return cls.load_from_dict(d)