BarecatEntryInfo#

class barecat.BarecatEntryInfo(path=None, mode=None, uid=None, gid=None, mtime_ns=None)[source]#

Base class for file and directory information classes.

The two subclasses are barecat.BarecatFileInfo and barecat.BarecatDirInfo.

Parameters:
  • path (Optional[str]) – path to the file or directory

  • mode (Optional[int]) – file mode, i.e. permissions

  • uid (Optional[int]) – user ID

  • gid (Optional[int]) – group ID

  • mtime_ns (Optional[Union[int, datetime]]) – last modification time in nanoseconds since the Unix epoch

Attributes#

mode

File mode, i.e., permissions.

uid

User ID.

gid

Group ID.

mtime_ns

Last modification time in nanoseconds since the Unix epoch.

Properties#

path

Path to the file or directory. The path is normalized on assignment.

mtime_dt

Last modification time as a datetime object.

Instance Methods#

isfile()

True if this is a file entry.

isdir()

True if this is a directory entry.

update_mtime()

Update the last modification time to the current time.

fill_from_statresult(s)

Fills the metadata information from a stat result, obtained from the file system.

Class Methods#

row_factory(cursor, row)

Factory method for creating instances from SQLite query results.