Source code for app.portfolio.models.ledger.ledger_journal

# SPDX-License-Identifier: GPLv3-or-later
# Copyright © 2025 pygaindalf Rui Pinheiro

from collections.abc import MutableSet
from typing import TYPE_CHECKING, override

from ...collections import OrderedViewMutableSet
from ...journal.journal import Journal
from ..transaction import Transaction, TransactionRecord
from .ledger_impl import LedgerImpl


if TYPE_CHECKING:
    from ...util.uid import Uid


[docs] class LedgerJournal( LedgerImpl[OrderedViewMutableSet[Transaction]], Journal, MutableSet[Transaction], init=False, ): # MARK: MutableSet ABC
[docs] @override def add(self, value: Transaction | TransactionRecord | Uid) -> None: self.transactions.add(Transaction.narrow_to_instance(value))
[docs] @override def discard(self, value: Transaction | TransactionRecord | Uid) -> None: self.transactions.discard(Transaction.narrow_to_instance(value))