Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
olb
hreports
Commits
767ae807
Commit
767ae807
authored
Mar 10, 2018
by
Philippe
Committed by
olb
Aug 25, 2019
Browse files
python3: use str instead of unicode
parent
4e844e5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
hreports/hledger.py
View file @
767ae807
...
...
@@ -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
),
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment