#NEWLINE# def find_deprecated_defs( pkg_dir ) : #NEWLINE# #INDENT# '\n    Return a list of all functions marked with the @deprecated\n    decorator, and classes with an immediate Deprecated base class, in\n    all Python files in the given directory.\n    ' #NEWLINE# for ( root , dirs , files ) in os . walk ( pkg_dir ) : #NEWLINE# #INDENT# for filename in files : #NEWLINE# #INDENT# if filename . endswith ( '.py' ) : #NEWLINE# #INDENT# s = open ( os . path . join ( root , filename ) ) . read ( ) #NEWLINE# for m in DEPRECATED_DEF_RE . finditer ( s ) : #NEWLINE# #INDENT# if m . group ( 2 ) : #NEWLINE# #INDENT# name = m . group ( 2 ) #NEWLINE# msg = ' ' . join ( ( strip_quotes ( s ) for s in STRING_RE . findall ( m . group ( 1 ) ) ) ) #NEWLINE# msg = ' ' . join ( msg . split ( ) ) #NEWLINE# if ( m . group ( ) [ 0 ] in ' \t' ) : #NEWLINE# #INDENT# cls = find_class ( s , m . start ( ) ) #NEWLINE# deprecated_methods [ name ] . add ( ( msg , cls , '()' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# deprecated_funcs [ name ] . add ( ( msg , '' , '()' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# name = m . group ( 3 ) #NEWLINE# m2 = STRING_RE . match ( s , m . end ( ) ) #NEWLINE# if m2 : #NEWLINE# #INDENT# msg = strip_quotes ( m2 . group ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = '' #NEWLINE# #UNINDENT# msg = ' ' . join ( msg . split ( ) ) #NEWLINE# deprecated_classes [ name ] . add ( ( msg , '' , '' ) )