Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Reads in a matrix file (comma separated) and returns the number
of rows and columns.
:arg filename, the full path to the file to read.

        def get_matrix_dimensions(filename):
    """ Reads in a matrix file (comma separated) and returns the number
    of rows and columns.
    :arg filename, the full path to the file to read.
    """
    stream = None
    try:
        stream = open(filename, 'r')
        length = len(stream.readlines())
        stream.seek(0)
        width = len(stream.readline().split(','))
        return (length, width)
    except IOError as err:  # pragma: no cover
        LOG.info("Something wrong happend while reading the file %s "
                 % filename)
        LOG.debug("ERROR: %s" % err)
    finally:
        if stream:
            stream.close()
        


src/m/q/MQ2-1.1.0/test/test.py   MQ2(Download)
    def test_mq2_get_matrix_dimensions(self):
        """ Test MQ² get_matrix_dimensions function """
        (length, width) = MQ2.get_matrix_dimensions(
            os.path.join(TEST_FOLDER,'mapqtl', 'qtls.exp'))
        self.assertEqual(length, 5)