From: Guido van Rossum Date: Tue, 13 Oct 1998 16:12:36 +0000 (+0000) Subject: Ever-so-slight improvementL the patterns to recognize import X-Git-Tag: v1.5.2a2~46 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e73d702344ad85fa1386d77cfa4d56091e39835b;p=python Ever-so-slight improvementL the patterns to recognize import statements now also stop at ';' (formerly they only stopped at '#'). --- diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py index 6af4692074..25fc33f44e 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -42,8 +42,8 @@ id = '[A-Za-z_][A-Za-z0-9_]*' # match identifier blank_line = re.compile('^[ \t]*($|#)') is_class = re.compile('^class[ \t]+(?P'+id+')[ \t]*(?P\([^)]*\))?[ \t]*:') is_method = re.compile('^[ \t]+def[ \t]+(?P'+id+')[ \t]*\(') -is_import = re.compile('^import[ \t]*(?P[^#]+)') -is_from = re.compile('^from[ \t]+(?P'+id+'([ \t]*\\.[ \t]*'+id+')*)[ \t]+import[ \t]+(?P[^#]+)') +is_import = re.compile('^import[ \t]*(?P[^#;]+)') +is_from = re.compile('^from[ \t]+(?P'+id+'([ \t]*\\.[ \t]*'+id+')*)[ \t]+import[ \t]+(?P[^#;]+)') dedent = re.compile('^[^ \t]') indent = re.compile('^[^ \t]*')