from collections import namedtuple

Bank = namedtuple('Bank', ['name', 'header', 'delimiter'])
banks = dict()

def toKey(name : str) -> str:
    key = [c for c in name if c.isalpha()]
    key = ''.join(key)
    return key.lower()

NordeaHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
Nordea = Bank('Nordea', NordeaHeader, delimiter=',')
banks[toKey(Nordea.name)] = Nordea

IcaHeader = ['Date', 'Payee', 'Transaction', 'Memo', 'Amount', 'Balance']
Ica = Bank('ICA Banken', IcaHeader, delimiter=';')
banks[toKey(Ica.name)] = Ica
from collections import namedtuple

Bank = namedtuple('Bank', ['name', 'header', 'delimiter'])
banks = dict()

def toKey(name : str) -> str:
    key = [c for c in name if c.isalpha()]
    key = ''.join(key)
    return key.lower()

NordeaOldHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
NordeaOld = Bank('Nordea (gamla)', NordeaOldHeader, delimiter=',')
banks[toKey(NordeaOld.name)] = NordeaOld

# All information regarding the payee is in a different field called "Rubrik"
# while "Betalningsmottagare" (i.e, "payee" in English) is empty.
# This makes no sense, but that's the format they currently use.
NordeaHeader = ['Date', 'Amount', "Sender" ,"TruePayee", "Name", "Payee", "Balance", "Currency"]
Nordea = Bank('Nordea', NordeaHeader, delimiter=';')
banks[toKey(Nordea.name)] = Nordea

IcaHeader = ['Date', 'Payee', 'Transaction', 'Memo', 'Amount', 'Balance']
Ica = Bank('ICA Banken', IcaHeader, delimiter=';')
banks[toKey(Ica.name)] = Ica
Prepare for new Nordea header
Prepare for new Nordea header

In June, Nordea will switch to a new web-interface.
This new interface also has a new csv-export format.
This commit adapts Nordea to the new format, while the previous
header is called "Nordea (gamal)".
I might remove  the previous  header come late June, after Nordea has
made the switch.

  from collections import namedtuple
  
  Bank = namedtuple('Bank', ['name', 'header', 'delimiter'])
  banks = dict()
  
  def toKey(name : str) -> str:
      key = [c for c in name if c.isalpha()]
      key = ''.join(key)
      return key.lower()
  
- NordeaHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
+ NordeaOldHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
+ NordeaOld = Bank('Nordea (gamla)', NordeaOldHeader, delimiter=',')
+ banks[toKey(NordeaOld.name)] = NordeaOld
+ 
+ # All information regarding the payee is in a different field called "Rubrik"
+ # while "Betalningsmottagare" (i.e, "payee" in English) is empty.
+ # This makes no sense, but that's the format they currently use.
+ NordeaHeader = ['Date', 'Amount', "Sender" ,"TruePayee", "Name", "Payee", "Balance", "Currency"]
- Nordea = Bank('Nordea', NordeaHeader, delimiter=',')
+ Nordea = Bank('Nordea', NordeaHeader, delimiter=';')
  banks[toKey(Nordea.name)] = Nordea
  
  IcaHeader = ['Date', 'Payee', 'Transaction', 'Memo', 'Amount', 'Balance']
  Ica = Bank('ICA Banken', IcaHeader, delimiter=';')
  banks[toKey(Ica.name)] = Ica
Prepare for new Nordea header
## Code Before:
from collections import namedtuple

Bank = namedtuple('Bank', ['name', 'header', 'delimiter'])
banks = dict()

def toKey(name : str) -> str:
    key = [c for c in name if c.isalpha()]
    key = ''.join(key)
    return key.lower()

NordeaHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
Nordea = Bank('Nordea', NordeaHeader, delimiter=',')
banks[toKey(Nordea.name)] = Nordea

IcaHeader = ['Date', 'Payee', 'Transaction', 'Memo', 'Amount', 'Balance']
Ica = Bank('ICA Banken', IcaHeader, delimiter=';')
banks[toKey(Ica.name)] = Ica
## Instruction:
Prepare for new Nordea header
## Code After:
from collections import namedtuple

Bank = namedtuple('Bank', ['name', 'header', 'delimiter'])
banks = dict()

def toKey(name : str) -> str:
    key = [c for c in name if c.isalpha()]
    key = ''.join(key)
    return key.lower()

NordeaOldHeader = ['Date', 'Transaction', 'Memo', 'Amount', 'Balance']
NordeaOld = Bank('Nordea (gamla)', NordeaOldHeader, delimiter=',')
banks[toKey(NordeaOld.name)] = NordeaOld

# All information regarding the payee is in a different field called "Rubrik"
# while "Betalningsmottagare" (i.e, "payee" in English) is empty.
# This makes no sense, but that's the format they currently use.
NordeaHeader = ['Date', 'Amount', "Sender" ,"TruePayee", "Name", "Payee", "Balance", "Currency"]
Nordea = Bank('Nordea', NordeaHeader, delimiter=';')
banks[toKey(Nordea.name)] = Nordea

IcaHeader = ['Date', 'Payee', 'Transaction', 'Memo', 'Amount', 'Balance']
Ica = Bank('ICA Banken', IcaHeader, delimiter=';')
banks[toKey(Ica.name)] = Ica