(cls, fname=None)
return result
Reads a graph from Python pickled format

        @param fname: the name of the file, a stream to read from, or
          a string containing the pickled data.
        @return: the created graph object.
Reads a graph from Python pickled format
Reads a graph from Python pickled format
def Read_Pickle(cls, fname=None):
        """Reads a graph from Python pickled format

        @param fname: the name of the file, a stream to read from, or
          a string containing the pickled data.
        @return: the created graph object.
        """
        import pickle as pickle

        if hasattr(fname, "read"):
            # Probably a file or a file-like object
            result = pickle.load(fname)
        else:
            try:
                fp = open(fname, "rb")
            except UnicodeDecodeError:
                try:
                    # We are on Python 3.6 or above and we are passing a pickled
                    # stream that cannot be decoded as Unicode. Try unpickling
                    # directly.
                    result = pickle.loads(fname)
                except TypeError:
                    raise IOError(
                        "Cannot load file. If fname is a file name, that "
                        "filename may be incorrect."
                    )
            except IOError:
                try:
                    # No file with the given name, try unpickling directly.
                    result = pickle.loads(fname)
                except TypeError:
                    raise IOError(
                        "Cannot load file. If fname is a file name, that "
                        "filename may be incorrect."
                    )
            else:
                result = pickle.load(fp)
                fp.close()

        if not isinstance(result, cls):
            raise TypeError("unpickled object is not a %s" % cls.__name__)

        return result
def Read_Pickle ( cls , fname = None ) : import pickle as pickle if hasattr ( fname , "read" ) : # Probably a file or a file-like object result = pickle . load ( fname ) else : try : fp = open ( fname , "rb" ) except UnicodeDecodeError : try : # We are on Python 3.6 or above and we are passing a pickled # stream that cannot be decoded as Unicode. Try unpickling # directly. result = pickle . loads ( fname ) except TypeError : raise IOError ( "Cannot load file. If fname is a file name, that " "filename may be incorrect." ) except IOError : try : # No file with the given name, try unpickling directly. result = pickle . loads ( fname ) except TypeError : raise IOError ( "Cannot load file. If fname is a file name, that " "filename may be incorrect." ) else : result = pickle . load ( fp ) fp . close ( ) if not isinstance ( result , cls ) : raise TypeError ( "unpickled object is not a %s" % cls . __name__ ) return result