Skip to content

Commit 9a88e73

Browse files
combine res
1 parent 0a4344e commit 9a88e73

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bpython/inspection.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,13 @@ def is_callable(obj):
283283
return callable(obj)
284284

285285

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.]+).*$')
288287

289288

290289
def get_encoding(obj):
291290
"""Try to obtain encoding information of the source of an object."""
292291
for line in inspect.findsource(obj)[0][:2]:
293-
m = get_encoding_re.search(line)
292+
m = get_encoding_line_re.search(line)
294293
if m:
295294
return m.group(1)
296295
return 'ascii'
@@ -310,7 +309,7 @@ def get_encoding_file(fname):
310309
with io.open(fname, 'rt', encoding='ascii', errors='ignore') as f:
311310
for unused in range(2):
312311
line = f.readline()
313-
match = get_encoding_re.search(line)
312+
match = get_encoding_line_re.search(line)
314313
if match:
315314
return match.group(1)
316315
return 'ascii'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy