binhistory.BinLog

class binhistory.BinLog(entries: Iterable[BinLogEntry] | None = None)

Bases: UserList

An .avb access log

__init__(entries: Iterable[BinLogEntry] | None = None)

Methods

__init__([entries])

append(item)

S.append(value) -- append value to the end of the sequence

clear()

computers()

Get a list of unique computers in the log

copy()

count(value)

earliest_entry()

Get the first/earliest entry from a bin log

extend(other)

S.extend(iterable) -- extend sequence by appending elements from the iterable

from_bin(bin_path[, missing_bin_ok, max_year])

Load an existing .log file for a given bin

from_path(log_path[, max_year])

Load from an existing .log file

from_stream(file_handle[, max_year])

Parse a log from an open file handle

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(i, item)

S.insert(index, value) -- insert value before index

latest_entry()

Get the last/latest/most recent entry from a bin log

log_path_from_bin_path(bin_path[, ...])

Determine the expected log path for a given bin path

pop([index])

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

sort(*args, **kwds)

timestamps()

Get a list of unique timestamps in the log

to_bin(bin_path[, missing_bin_ok])

Write to a log for a given bin

to_path(file_path)

Write log to filepath

to_stream(file_handle)

Write log to given stream

to_string()

Format as string

touch(log_path[, entry])

Add an entry to a log file

touch_bin(bin_path[, entry, missing_bin_ok])

Add an entry to a log file for a given bin

users()

Get a list of unique users in the log

insert(i, item)

S.insert(index, value) – insert value before index

append(item)

S.append(value) – append value to the end of the sequence

extend(other)

S.extend(iterable) – extend sequence by appending elements from the iterable

to_string() str

Format as string

classmethod from_bin(bin_path: str, missing_bin_ok: bool = True, max_year: int | None = None) BinLog

Load an existing .log file for a given bin

classmethod from_path(log_path: str, max_year: int | None = None) BinLog

Load from an existing .log file

classmethod from_stream(file_handle: TextIO, max_year: int | None = None) BinLog

Parse a log from an open file handle

to_bin(bin_path: str, missing_bin_ok: bool = True)

Write to a log for a given bin

to_path(file_path: str)

Write log to filepath

to_stream(file_handle: TextIO)

Write log to given stream

earliest_entry() BinLogEntry | None

Get the first/earliest entry from a bin log

latest_entry() BinLogEntry | None

Get the last/latest/most recent entry from a bin log

users() List[str]

Get a list of unique users in the log

computers() List[str]

Get a list of unique computers in the log

timestamps() List[datetime]

Get a list of unique timestamps in the log

classmethod touch(log_path: str, entry: BinLogEntry | None = None)

Add an entry to a log file

classmethod touch_bin(bin_path: str, entry: BinLogEntry | None = None, missing_bin_ok: bool = True)

Add an entry to a log file for a given bin

static log_path_from_bin_path(bin_path: str, missing_bin_ok: bool = True) str

Determine the expected log path for a given bin path