repo.or.cz
/
git-cola.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
diff: use slices instead of indexing
[git-cola.git]
/
extras
/
build_util.py
blob
70ad7a1956f659be2d4b72c936e3c84b5a391e40
1
def
encode
(
string
):
2
try
:
3
result
=
string
.
encode
(
'utf-8'
)
4
except
(
ValueError
,
UnicodeEncodeError
):
5
result
=
string
6
return
result
7
8
9
def
make_string
(
x
):
10
if
x
:
11
x
=
str
(
x
)
12
return
x
13
14
15
def
stringify_options
(
items
):
16
return
[[
make_string
(
x
)
for
x
in
i
]
for
i
in
items
]
17
18
19
def
stringify_list
(
items
):
20
return
[
make_string
(
i
)
for
i
in
items
]