def get_sample_data(fname, asfileobj=True):
 import matplotlib
 if matplotlib.rcParams[u'examples.directory']:
  root = matplotlib.rcParams[u'examples.directory']
 else:
  root = os.path.join(matplotlib._get_data_path(), u'sample_data')
 path = os.path.join(root, fname)
 if asfileobj:
  if (os.path.splitext(fname)[(-1)].lower() in (u'.csv', u'.xrc', u'.txt')):
   mode = u'r'
  else:
   mode = u'rb'
  (base, ext) = os.path.splitext(fname)
  if (ext == u'.gz'):
   return gzip.open(path, mode)
  else:
   return open(path, mode)
 else:
  return path

def get_sample_data ( fname , asfileobj = True ) : import matplotlib if matplotlib . rcParams [ u'examples.directory' ] : root = matplotlib . rcParams [ u'examples.directory' ] else : root = os . path . join ( matplotlib . _get_data_path ( ) , u'sample_data' ) path = os . path . join ( root , fname ) if asfileobj : if ( os . path . splitext ( fname ) [ ( - 1 ) ] . lower ( ) in ( u'.csv' , u'.xrc' , u'.txt' ) ) : mode = u'r' else : mode = u'rb' ( base , ext ) = os . path . splitext ( fname ) if ( ext == u'.gz' ) : return gzip . open ( path , mode ) else : return open ( path , mode ) else : return path
return a sample data file .