tariochbctools 0.30.0__py2.py3-none-any.whl → 0.32.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ class Importer(importer.ImporterProtocol):
16
16
  """An importer for Bitstamp."""
17
17
 
18
18
  def identify(self, file):
19
- return "bitstamp.yaml" == path.basename(file.name)
19
+ return path.basename(file.name).endswith("bitstamp.yaml")
20
20
 
21
21
  def file_account(self, file):
22
22
  return ""
@@ -13,7 +13,7 @@ class Importer(importer.ImporterProtocol):
13
13
  """An importer for Blockchain data."""
14
14
 
15
15
  def identify(self, file):
16
- return "blockchain.yaml" == path.basename(file.name)
16
+ return path.basename(file.name).endswith("blockchain.yaml")
17
17
 
18
18
  def file_account(self, file):
19
19
  return ""
@@ -17,7 +17,7 @@ class Importer(importer.ImporterProtocol):
17
17
  """An importer for Interactive Broker using the flex query service."""
18
18
 
19
19
  def identify(self, file):
20
- return "ibkr.yaml" == path.basename(file.name)
20
+ return path.basename(file.name).endswith("ibkr.yaml")
21
21
 
22
22
  def file_account(self, file):
23
23
  return ""
@@ -16,7 +16,7 @@ class Importer(importer.ImporterProtocol):
16
16
  """An importer for Nordigen API (e.g. for Revolut)."""
17
17
 
18
18
  def identify(self, file):
19
- return "nordigen.yaml" == path.basename(file.name)
19
+ return path.basename(file.name).endswith("nordigen.yaml")
20
20
 
21
21
  def file_account(self, file):
22
22
  return ""
@@ -12,7 +12,7 @@ class Importer(importer.ImporterProtocol):
12
12
  """An importer for Scheduled/Recurring Transactions."""
13
13
 
14
14
  def identify(self, file):
15
- return "schedule.yaml" == path.basename(file.name)
15
+ return path.basename(file.name).endswith("schedule.yaml")
16
16
 
17
17
  def file_account(self, file):
18
18
  return ""
File without changes
@@ -0,0 +1,54 @@
1
+ import csv
2
+ from io import StringIO
3
+
4
+ from beancount.core import amount, data
5
+ from beancount.core.number import D
6
+ from beancount.ingest import importer
7
+ from beancount.ingest.importers.mixins import identifier
8
+ from dateutil.parser import parse
9
+
10
+
11
+ class SwisscardImporter(identifier.IdentifyMixin, importer.ImporterProtocol):
12
+ """An importer for Swisscard's cashback CSV files."""
13
+
14
+ def __init__(self, regexps, account):
15
+ identifier.IdentifyMixin.__init__(self, matchers=[("filename", regexps)])
16
+ self.account = account
17
+
18
+ def name(self):
19
+ return super().name() + self.account
20
+
21
+ def file_account(self, file):
22
+ return self.account
23
+
24
+ def extract(self, file, existing_entries):
25
+ entries = []
26
+ with StringIO(file.contents()) as csvfile:
27
+ reader = csv.DictReader(
28
+ csvfile,
29
+ delimiter=",",
30
+ skipinitialspace=True,
31
+ )
32
+ for row in reader:
33
+ book_date = parse(row["Transaction date"].strip(), dayfirst=True).date()
34
+ amt = amount.Amount(-D(row["Amount"]), row["Currency"])
35
+ metakv = {
36
+ "category": row["Category"],
37
+ }
38
+ meta = data.new_metadata(file.name, 0, metakv)
39
+ description = row["Description"].strip()
40
+ entry = data.Transaction(
41
+ meta,
42
+ book_date,
43
+ "*",
44
+ "",
45
+ description,
46
+ data.EMPTY_SET,
47
+ data.EMPTY_SET,
48
+ [
49
+ data.Posting(self.account, amt, None, None, None, None),
50
+ ],
51
+ )
52
+ entries.append(entry)
53
+
54
+ return entries
@@ -21,7 +21,7 @@ class Importer(importer.ImporterProtocol):
21
21
  """An importer for Transferwise using the API."""
22
22
 
23
23
  def identify(self, file):
24
- return "transferwise.yaml" == path.basename(file.name)
24
+ return path.basename(file.name).endswith("transferwise.yaml")
25
25
 
26
26
  def file_account(self, file):
27
27
  return ""
@@ -52,7 +52,7 @@ class Importer(importer.ImporterProtocol):
52
52
  raise KeyError("At least one of `account` or `accounts` must be specified")
53
53
 
54
54
  def identify(self, file):
55
- return "truelayer.yaml" == path.basename(file.name)
55
+ return path.basename(file.name).endswith("truelayer.yaml")
56
56
 
57
57
  def file_account(self, file):
58
58
  return ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tariochbctools
3
- Version: 0.30.0
3
+ Version: 0.32.0
4
4
  Summary: Importers, plugins and price fetchers for Beancount
5
5
  Home-page: https://github.com/tarioch/beancounttools/
6
6
  Author: Patrick Ruckstuhl
@@ -3,9 +3,9 @@ tariochbctools/importers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
3
3
  tariochbctools/importers/bcge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  tariochbctools/importers/bcge/importer.py,sha256=0_OVd-xM4lM5SPvzKwe4bRzkBxx666fVw_hUK9rvcOc,1095
5
5
  tariochbctools/importers/bitst/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- tariochbctools/importers/bitst/importer.py,sha256=ejpu30UaMd4MQA8ozPMmcFp9SZP0eAg668_FiLaln4c,5098
6
+ tariochbctools/importers/bitst/importer.py,sha256=qPGN5wy5-G4WDStG32f_OCxynhtyNyLjvXLybhhiRaQ,5105
7
7
  tariochbctools/importers/blockchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- tariochbctools/importers/blockchain/importer.py,sha256=Lg-pg4hzehkoV93lAptjuYFCzMxX3KufUf2MW72be0U,2183
8
+ tariochbctools/importers/blockchain/importer.py,sha256=1K6J6J3DEOKs1Zw2wDxbUzVluFhZlxxIXwyE48IqRM0,2190
9
9
  tariochbctools/importers/cembrastatement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  tariochbctools/importers/cembrastatement/importer.py,sha256=fqfJxcU1SDiyyV3iDvfvkHXX3FefMmUNMNI5iCDOFis,3403
11
11
  tariochbctools/importers/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,11 +13,11 @@ tariochbctools/importers/general/mailAdapterImporter.py,sha256=B6r9ycPY1ZiWFPNnl
13
13
  tariochbctools/importers/general/mt940importer.py,sha256=gLE77YhMaQdHE3nDg344eLh-hSofGKHTW5O_h6kmUdM,2102
14
14
  tariochbctools/importers/general/priceLookup.py,sha256=k0HikFeQcP83CvCwTT3Clpi640VAAGKohU1PQ-3Vi9w,621
15
15
  tariochbctools/importers/ibkr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- tariochbctools/importers/ibkr/importer.py,sha256=V3rQnilmtZLHkknJIDBsJYfEt1_mdDOY5edpY0GMDH8,8463
16
+ tariochbctools/importers/ibkr/importer.py,sha256=Hs8Q9DOtp36jT34JjVbe_iQOc07ijV8uB-p10uLLz4Q,8470
17
17
  tariochbctools/importers/neon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  tariochbctools/importers/neon/importer.py,sha256=SNG6podG1PI3gABy6eYfv1-mRnPwRjK-j5_GoNz2-Wc,2547
19
19
  tariochbctools/importers/nordigen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- tariochbctools/importers/nordigen/importer.py,sha256=IY47QG3NvfP_Hh1fbmyR2wUl0Vot8DABtJOS30g3K4w,3626
20
+ tariochbctools/importers/nordigen/importer.py,sha256=pHRs1WyvNmb_zIUsq1O6tcUq2xMDt7AFpIbok4R1B9A,3633
21
21
  tariochbctools/importers/nordigen/nordigen_config.py,sha256=7_4NbSmyC-ryf9QGsBZp7aeK3RWnq9GSMCJUVJWmgzA,4738
22
22
  tariochbctools/importers/postfinance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  tariochbctools/importers/postfinance/importer.py,sha256=1oY_9PzUlkJw_gABqHXZ2CaB06xegzNGkc_U3Eoci1M,2452
@@ -26,11 +26,13 @@ tariochbctools/importers/quickfile/importer.py,sha256=0HRVl-OXkCq8T5Uz04gGCGlkRX
26
26
  tariochbctools/importers/revolut/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  tariochbctools/importers/revolut/importer.py,sha256=TUjTnvvnYgc0j4z86KIohoMmw13UdNYjapNGPC63ILI,2886
28
28
  tariochbctools/importers/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- tariochbctools/importers/schedule/importer.py,sha256=V31H6o0LfooonxiKtNPCICQCAR96mSW8cSfx53eH-Sg,1519
29
+ tariochbctools/importers/schedule/importer.py,sha256=g1q7NwGzwkj25LknOguf3b7iJ0v4JXET01a8N3cWu2U,1526
30
+ tariochbctools/importers/swisscard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ tariochbctools/importers/swisscard/importer.py,sha256=hEmRv3ADr9A8akGMAdZTEriFKLPJTql8LQNkFE0ZyfA,1795
30
32
  tariochbctools/importers/transferwise/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- tariochbctools/importers/transferwise/importer.py,sha256=rdLo0cBGpBxCPHemDinWNhJvWTi6mSCpGV_bb0FU_t4,5914
33
+ tariochbctools/importers/transferwise/importer.py,sha256=hYfJ0_6yyqutrIiiR_UEo6nqjQfsNGvbl1t6MYe1eKU,5921
32
34
  tariochbctools/importers/truelayer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- tariochbctools/importers/truelayer/importer.py,sha256=Zjelx3ut2tTfSS-ht6IVNPzvM4gl7vrKj3yEKYHnuuY,6931
35
+ tariochbctools/importers/truelayer/importer.py,sha256=3bNtN2wKg473whmRVH2JSOIim_0vUFA6omTC3P5EV2A,6938
34
36
  tariochbctools/importers/viseca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
37
  tariochbctools/importers/viseca/importer.py,sha256=hccqRX6sEuRjPcYBV8hQ2zLG1pjeqzAyKd0rDEqM6oc,3123
36
38
  tariochbctools/importers/zak/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -42,9 +44,9 @@ tariochbctools/plugins/check_portfolio_sum.py,sha256=bIAZRq7u0Up61siQVvfrBj8-ug7
42
44
  tariochbctools/plugins/generate_base_ccy_prices.py,sha256=CpT7A3UPZMHU6z-__uEueAMvzJcDO3LKyVEiYdyl1oI,1235
43
45
  tariochbctools/plugins/prices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
46
  tariochbctools/plugins/prices/ibkr.py,sha256=9OwaZvI55bCj7H80K2iLZVsGLpuCyaoCnyuTS9e1_-c,1294
45
- tariochbctools-0.30.0.dist-info/LICENSE.txt,sha256=VR2hkz3p9Sw4hSXc7S5iZTOXGeV4h-i8AO_q0zEmtkE,1074
46
- tariochbctools-0.30.0.dist-info/METADATA,sha256=576rQdVA4e87wGhOgnbMZuBWhzsSlKMWFFqflan5lN4,2105
47
- tariochbctools-0.30.0.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
48
- tariochbctools-0.30.0.dist-info/entry_points.txt,sha256=9xrCCY1wx2zCIsQUOWZelLHDmHw9Oc-ZBAKUIY9lKTA,88
49
- tariochbctools-0.30.0.dist-info/top_level.txt,sha256=CiA_NepCI6zDNsaORA55zmpuJFSnTvLESraIL13xiOQ,15
50
- tariochbctools-0.30.0.dist-info/RECORD,,
47
+ tariochbctools-0.32.0.dist-info/LICENSE.txt,sha256=VR2hkz3p9Sw4hSXc7S5iZTOXGeV4h-i8AO_q0zEmtkE,1074
48
+ tariochbctools-0.32.0.dist-info/METADATA,sha256=7xczAyaSH2nZfrkDsCj5Dh43QCh-sQZ9wRs_JMsqKtM,2105
49
+ tariochbctools-0.32.0.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
50
+ tariochbctools-0.32.0.dist-info/entry_points.txt,sha256=9xrCCY1wx2zCIsQUOWZelLHDmHw9Oc-ZBAKUIY9lKTA,88
51
+ tariochbctools-0.32.0.dist-info/top_level.txt,sha256=CiA_NepCI6zDNsaORA55zmpuJFSnTvLESraIL13xiOQ,15
52
+ tariochbctools-0.32.0.dist-info/RECORD,,