Commit 767ae807 authored by Philippe's avatar Philippe Committed by olb
Browse files

python3: use str instead of unicode

parent 4e844e5e
......@@ -38,10 +38,10 @@ class Hledger(object):
command += " --depth=%s" % depth
if period:
command += " --period=" + unicode(period)
command += " --period=" + str(period)
if end:
command += " --end=" + unicode(end)
command += " --end=" + str(end)
if account:
command += " '" + account + "'"
......@@ -55,10 +55,10 @@ class Hledger(object):
command = "hledger print -x --file '" + self.path + "'"
if period:
command += " --period=" + unicode(period)
command += " --period=" + str(period)
if end:
command += " --end=" + unicode(end)
command += " --end=" + str(end)
if account:
command += " '" + account + "'"
......@@ -126,7 +126,7 @@ class Hledger(object):
),
re.UNICODE)
out = unicode(self.hl_print(), 'utf-8')
out = str(self.hl_print(), 'utf-8')
lines = out.split('\n')
......@@ -148,9 +148,9 @@ class Hledger(object):
account = Account(uname=uname)
logger.debug('{period} // {amount:>10} // {account}'.format(
period=unicode(period),
account=unicode(account),
amount=unicode(amount),
period=str(period),
account=str(account),
amount=str(amount),
))
if self.inverted:
......@@ -223,13 +223,13 @@ class Account(object):
return True
return False
def __unicode__(self):
def __str__(self):
if self.name:
return "{number} − {name}".format(
number=self.number or "",
name=self.name)
else:
return unicode(self.uname)
return str(self.uname)
class Period(object):
......@@ -244,7 +244,7 @@ class Period(object):
return cls.PERIODS[name]
def __init__(self, name):
self.name = unicode(name)
self.name = str(name)
parts = self.name.split('-')
if len(parts) == 3:
year = int(parts[0])
......@@ -273,14 +273,15 @@ class Period(object):
def __hash__(self):
return hash(self.name)
def __unicode__(self):
return unicode(self.name)
def __str__(self):
return str(self.name)
def __str__(self):
return self.name
def month_name(self):
return unicode(self.date.strftime('%b'.encode('utf8')).decode('utf8'))
return str(self.date.strftime('%b'))
class PeriodTable(object):
......@@ -530,7 +531,7 @@ class PeriodTable(object):
for account in self.accounts():
logger.info('{period} // {amount:>10} // {account}'.format(
period=period,
account=unicode(account),
account=str(account),
amount=self.balance(account=account, period=period),
))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment