def get_source_file(filename, include_no_ext=False):
 (base, orig_ext) = os.path.splitext(os.path.abspath(filename))
 for ext in PY_SOURCE_EXTS:
  source_path = ('%s.%s' % (base, ext))
  if os.path.exists(source_path):
   return source_path
 if (include_no_ext and (not orig_ext) and os.path.exists(base)):
  return base
 raise NoSourceFile(filename)

def get_source_file ( filename , include_no_ext = False ) : ( base , orig_ext ) = os . path . splitext ( os . path . abspath ( filename ) ) for ext in PY_SOURCE_EXTS : source_path = ( '%s.%s' % ( base , ext ) ) if os . path . exists ( source_path ) : return source_path if ( include_no_ext and ( not orig_ext ) and os . path . exists ( base ) ) : return base raise NoSourceFile ( filename )
given a python modules file name return the matching source file name :type filename: str .