@@ -40,13 +40,12 @@ def popen_wrapper(args, os_err_exc_type=Exception, stdout_encoding='utf-8'):
40
40
p = Popen (args , shell = False , stdout = PIPE , stderr = PIPE , close_fds = os .name != 'nt' )
41
41
except OSError as e :
42
42
strerror = force_text (e .strerror , DEFAULT_LOCALE_ENCODING , strings_only = True )
43
- raise Exception (os_err_exc_type , os_err_exc_type ('Error executing %s: %s' %
44
- (args [0 ], strerror )), sys .exc_info ()[2 ])
43
+ raise Exception (os_err_exc_type , os_err_exc_type ('Error executing %s: %s' % (args [0 ], strerror )), sys .exc_info ()[2 ])
45
44
output , errors = p .communicate ()
46
45
return (
47
46
force_text (output , stdout_encoding , strings_only = True , errors = 'strict' ),
48
47
force_text (errors , DEFAULT_LOCALE_ENCODING , strings_only = True , errors = 'replace' ),
49
- p .returncode
48
+ p .returncode ,
50
49
)
51
50
52
51
@@ -65,7 +64,13 @@ def get_system_encoding():
65
64
66
65
67
66
_PROTECTED_TYPES = (
68
- type (None ), int , float , Decimal , datetime .datetime , datetime .date , datetime .time ,
67
+ type (None ),
68
+ int ,
69
+ float ,
70
+ Decimal ,
71
+ datetime .datetime ,
72
+ datetime .date ,
73
+ datetime .time ,
69
74
)
70
75
71
76
@@ -111,8 +116,7 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
111
116
# working unicode method. Try to handle this without raising a
112
117
# further exception by individually forcing the exception args
113
118
# to unicode.
114
- s = ' ' .join (force_text (arg , encoding , strings_only , errors )
115
- for arg in s )
119
+ s = ' ' .join (force_text (arg , encoding , strings_only , errors ) for arg in s )
116
120
return s
117
121
118
122
@@ -140,17 +144,14 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
140
144
print ('processing file %s in %s\n ' % (f , dirpath ))
141
145
po_path = os .path .join (dirpath , f )
142
146
if has_bom (po_path ):
143
- raise Exception ("The %s file has a BOM (Byte Order Mark). "
144
- "Django only supports .po files encoded in "
145
- "UTF-8 and without any BOM." % po_path )
147
+ raise Exception (
148
+ "The %s file has a BOM (Byte Order Mark). " "Django only supports .po files encoded in " "UTF-8 and without any BOM." % po_path
149
+ )
146
150
base_path = os .path .splitext (po_path )[0 ]
147
151
# Check writability on first location
148
152
if i == 0 and not is_writable ((base_path + '.mo' )):
149
- raise Exception ("The po files under %s are in a seemingly not writable location. "
150
- "mo files will not be updated/created." % dirpath )
151
- args = [program ] + program_options + [
152
- '-o' , (base_path + '.mo' ), (base_path + '.po' )
153
- ]
153
+ raise Exception ("The po files under %s are in a seemingly not writable location. " "mo files will not be updated/created." % dirpath )
154
+ args = [program ] + program_options + ['-o' , (base_path + '.mo' ), (base_path + '.po' )]
154
155
output , errors , status = popen_wrapper (args )
155
156
if status :
156
157
if errors :
0 commit comments