tariochbctools.importers.general package

Submodules

tariochbctools.importers.general.deduplication module

class tariochbctools.importers.general.deduplication.ReferenceDuplicatesComparator(refs: Sequence[str] = ('ref',))[source]

Bases: object

tariochbctools.importers.general.mailAdapterImporter module

class tariochbctools.importers.general.mailAdapterImporter.MailAdapterImporter(importers: list[Importer])[source]

Bases: Importer

An importer adapter that fetches file from mails and then calls another importer.

account(filepath: str) → str[source]

Return the account associated with the given file.

The account is used to determine the archival folder for the document. While the interface allows returning different accounts for different documents, normally the returned account is a just a function of the importer instance.

Parameters:

filepath – Filesystem path to the document being imported.

Returns:

An account name.

extract(filepath: str, existing: list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom]) → list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom][source]

Extract transactions and other directives from a document.

The existing entries list is loaded from the existing ledger file, if the user specified one on the command line. It can be used to supplement the information provided by the document being processed to drive the extraction. For example to derive the prior state of the inventory.

Parameters:
  • filepath – Filesystem path to the document being imported.

  • existing – Entries loaded from the existing ledger.

Returns:

A list of imported directives extracted from the document.

identify(filepath: str) → bool[source]

Return True if this importer matches the given file.

Parameters:

filepath – Filesystem path to the document to be matched.

Returns:

True if this importer can handle this file.

tariochbctools.importers.general.mt940importer module

class tariochbctools.importers.general.mt940importer.Importer(filepattern: str, account: str)[source]

Bases: Importer

An importer for MT940 files.

account(filepath: str) → str[source]

Return the account associated with the given file.

The account is used to determine the archival folder for the document. While the interface allows returning different accounts for different documents, normally the returned account is a just a function of the importer instance.

Parameters:

filepath – Filesystem path to the document being imported.

Returns:

An account name.

cmp = <tariochbctools.importers.general.deduplication.ReferenceDuplicatesComparator object>
extract(filepath: str, existing: list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom]) → list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom][source]

Extract transactions and other directives from a document.

The existing entries list is loaded from the existing ledger file, if the user specified one on the command line. It can be used to supplement the information provided by the document being processed to drive the extraction. For example to derive the prior state of the inventory.

Parameters:
  • filepath – Filesystem path to the document being imported.

  • existing – Entries loaded from the existing ledger.

Returns:

A list of imported directives extracted from the document.

identify(filepath: str) → bool[source]

Return True if this importer matches the given file.

Parameters:

filepath – Filesystem path to the document to be matched.

Returns:

True if this importer can handle this file.

prepare_narration(trxdata: dict[str, Any]) → str[source]
prepare_payee(trxdata: dict[str, Any]) → str[source]
tariochbctools.importers.general.mt940importer.detect_encoding(filepath: str) → str[source]

Encoding to hand over to mt940.

Without one, mt940 decodes everything that is not utf-8 as cp852, which garbles e.g. the umlauts of the latin-1 files that the banks deliver.

tariochbctools.importers.general.network module

Timeouts for network access.

Without a timeout a stalled server blocks an import forever. The read timeout is the time to wait for the next bytes, not for the whole response.

tariochbctools.importers.general.priceLookup module

class tariochbctools.importers.general.priceLookup.PriceLookup(existing: list[Open | Close | Commodity | Pad | Balance | Transaction | Note | Event | Query | Price | Document | Custom], baseCcy: str)[source]

Bases: object

fetchPrice(instrument: str, date: date) → Amount | None[source]
fetchPriceAmount(instrument: str, date: date) → Decimal | None[source]

Module contents