@classmethod<EOL><INDENT>def from_file(cls, fid):<DEDENT>
<EOL>line = fid.readline().strip("<STR_LIT:\n>")<EOL>if not len(line) > <NUM_LIT>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % line)<EOL><DEDENT>title = line[:<NUM_LIT>]<EOL>key = line[<NUM_LIT>:]<EOL>line = fid.readline().strip("<STR_LIT:\n>")<EOL>if not len(line.rstrip()) >= <NUM_LIT>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % line)<EOL><DEDENT>total_nlines = _expect_int(line[:<NUM_LIT>])<EOL>pointer_nlines = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>indices_nlines = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>values_nlines = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>rhs_nlines = line[<NUM_LIT>:<NUM_LIT>].strip()<EOL>if rhs_nlines == '<STR_LIT>':<EOL><INDENT>rhs_nlines = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>rhs_nlines = _expect_int(rhs_nlines)<EOL><DEDENT>if not rhs_nlines == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>line = fid.readline().strip("<STR_LIT:\n>")<EOL>if not len(line) >= <NUM_LIT>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT:%s>" % line)<EOL><DEDENT>mxtype_s = line[:<NUM_LIT:3>].upper()<EOL>if not len(mxtype_s) == <NUM_LIT:3>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>mxtype = HBMatrixType.from_fortran(mxtype_s)<EOL>if mxtype.value_type not in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % mxtype)<EOL><DEDENT>if not mxtype.structure == "<STR_LIT>":<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % mxtype)<EOL><DEDENT>if not mxtype.storage == "<STR_LIT>":<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not line[<NUM_LIT:3>:<NUM_LIT>] == "<STR_LIT:U+0020>" * <NUM_LIT:11>:<EOL><INDENT>raise ValueError("<STR_LIT>" % line)<EOL><DEDENT>nrows = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>ncols = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>nnon_zeros = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>nelementals = _expect_int(line[<NUM_LIT>:<NUM_LIT>])<EOL>if not nelementals == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>% nelementals)<EOL><DEDENT>line = fid.readline().strip("<STR_LIT:\n>")<EOL>ct = line.split()<EOL>if not len(ct) == <NUM_LIT:3>:<EOL><INDENT>raise ValueError("<STR_LIT>" % ct)<EOL><DEDENT>return cls(title, key,<EOL>total_nlines, pointer_nlines, indices_nlines, values_nlines,<EOL>mxtype, nrows, ncols, nnon_zeros,<EOL>ct[<NUM_LIT:0>], ct[<NUM_LIT:1>], ct[<NUM_LIT:2>],<EOL>rhs_nlines, nelementals)<EOL>
Create a HBInfo instance from a file object containg a matrix in the
        HB format.

        Parameters
        ----------
        fid : file-like matrix
            File or file-like object containing a matrix in the HB format.

        Returns
        -------
        hb_info : HBInfo instance