/usr/lib/python3/dist-packages/agatedbf/table.py is in python3-agatedbf 0.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env python
"""
This module contains the DBF extension to :class:`Table <agate.table.Table>`.
"""
import agate
from dbfread import DBF
def recfactory(items):
return tuple(kv[1] for kv in items)
def from_dbf(cls, path, encoding=None):
"""
Parse a DBF file.
:param path:
Path to an DBF file to load. Note that due to limitations of the
dependency you can not pass a file handle. It must be a path.
"""
dbf = DBF(path, load=True, lowernames=True, encoding=encoding, recfactory=recfactory)
table = agate.Table(dbf.records, column_names=dbf.field_names)
return table
agate.Table.from_dbf = classmethod(from_dbf)
|