1
+ # -*- coding: utf-8 -*-
2
+
1
3
import sys
2
4
import os
3
5
import json
8
10
os .path .dirname (os .path .realpath (__file__ )),
9
11
'../python/ext-libs' ))
10
12
11
- from six import string_types
12
-
13
- cpp = open (sys .argv [1 ], "w" )
13
+ cpp = open (sys .argv [1 ], "w" , encoding = "utf-8" )
14
14
cpp .write (
15
15
"#include \" qgsexpression.h\" \n "
16
16
"\n "
@@ -31,7 +31,7 @@ def quote(v):
31
31
elif isinstance (v , list ):
32
32
return map (quote , v )
33
33
34
- elif isinstance (v , string_types ):
34
+ elif isinstance (v , str ):
35
35
return v .replace ('"' , '\\ "' ).replace ('\n ' , '\\ n' )
36
36
37
37
elif isinstance (v , bool ):
@@ -42,7 +42,7 @@ def quote(v):
42
42
43
43
44
44
for f in sorted (glob .glob ('resources/function_help/json/*' )):
45
- with open (f ) as function_file :
45
+ with open (f , encoding = "utf-8" ) as function_file :
46
46
try :
47
47
json_params = json .load (function_file )
48
48
except :
@@ -103,7 +103,7 @@ def quote(v):
103
103
104
104
if 'examples' in v :
105
105
for e in v ['examples' ]:
106
- cpp .write ("\n << HelpExample( tr( \" {0}\" ), tr( \" {1}\" ), tr( \" {2}\" ) )" .format (
106
+ cpp .write ("\n << HelpExample( tr( \" {0}\" ), tr( \" {1}\" ), tr( \" {2}\" ) )" .format (
107
107
e ['expression' ],
108
108
e ['returns' ],
109
109
e .get ('note' , '' ))
0 commit comments