

@classmethod
def from_fixed(cls, path, schema_path, column_names=utils.default, column_types=None, row_names=None, encoding='utf-8', schema_encoding='utf-8'):
    '\n    Create a new table from a fixed-width file and a CSV schema.\n\n    Schemas must be in the "ffs" format. There is a repository of such schemas\n    maintained at `wireservice/ffs <https://github.com/wireservice/ffs>`_.\n\n    :param path:\n        File path or file-like object from which to read fixed-width data.\n    :param schema_path:\n        File path or file-like object from which to read schema (CSV) data.\n    :param column_names:\n        By default, these will be parsed from the schema. For alternatives, see\n        :meth:`.Table.__init__`.\n    :param column_types:\n        See :meth:`.Table.__init__`.\n    :param row_names:\n        See :meth:`.Table.__init__`.\n    :param encoding:\n        Character encoding of the fixed-width file. Note: if passing in a file\n        handle it is assumed you have already opened it with the correct\n        encoding specified.\n    :param schema_encoding:\n        Character encoding of the schema file. Note: if passing in a file\n        handle it is assumed you have already opened it with the correct\n        encoding specified.\n    '
    from agate.table import Table
    close_f = False
    if (not hasattr(path, 'read')):
        f = io.open(path, encoding=encoding)
        close_f = True
    else:
        f = path
    close_schema_f = False
    if (not hasattr(schema_path, 'read')):
        schema_f = io.open(schema_path, encoding=schema_encoding)
        close_schema_f = True
    else:
        schema_f = path
    reader = fixed.reader(f, schema_f)
    rows = list(reader)
    if close_f:
        f.close()
    if close_schema_f:
        schema_f.close()
    if (column_names == utils.default):
        column_names = reader.fieldnames
    return Table(rows, column_names, column_types, row_names=row_names)

dataset/ETHPy150Open wireservice/agate/agate/table/from_fixed.py from_fixed/original