File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -283,14 +283,13 @@ def is_callable(obj):
283
283
return callable (obj )
284
284
285
285
286
- get_encoding_re = LazyReCompile (r'coding[:=]\s*([-\w.]+)' )
287
- get_encoding_line_re = LazyReCompile (r'^.*coding[:=]\s*[-\w.]+.*$' )
286
+ get_encoding_line_re = LazyReCompile (r'^.*coding[:=]\s*([-\w.]+).*$' )
288
287
289
288
290
289
def get_encoding (obj ):
291
290
"""Try to obtain encoding information of the source of an object."""
292
291
for line in inspect .findsource (obj )[0 ][:2 ]:
293
- m = get_encoding_re .search (line )
292
+ m = get_encoding_line_re .search (line )
294
293
if m :
295
294
return m .group (1 )
296
295
return 'ascii'
@@ -310,7 +309,7 @@ def get_encoding_file(fname):
310
309
with io .open (fname , 'rt' , encoding = 'ascii' , errors = 'ignore' ) as f :
311
310
for unused in range (2 ):
312
311
line = f .readline ()
313
- match = get_encoding_re .search (line )
312
+ match = get_encoding_line_re .search (line )
314
313
if match :
315
314
return match .group (1 )
316
315
return 'ascii'
You can’t perform that action at this time.
0 commit comments