def load_projections_from_path(p):
    '''
    load_projections_from_path(p) yields a lazy-map of all the map projection files found in the
      given path specification p. The path specification may be either a directory name, a
      :-separated list of directory names, or a python list of directory names.

    In order to be included in the returned mapping of projections, a projection must have a
    filename that matches the following format:
      <hemi>.<name>[.mp | .map | .projection | <nothing>].json[.gz]
    For example, the following match:
      lh.occipital_pole.mp.json    => map_projections['lh']['occipital_pole']
      rh.frontal.json.gz           => map_projections['rh']['frontal']
      lr.motor.projection.json.gz  => map_projections['lr']['motor']
    '''
    p = dirpath_to_list(p)
    return pyr.pmap(
        {h:pimms.lazy_map(
            {parts[1]: curry(lambda flnm,h: load_map_projection(flnm, chirality=h),
                             os.path.join(pp, fl), h)
             for pp    in p
             for fl    in os.listdir(pp)  if fl.endswith('.json') or fl.endswith('.json.gz')
             for parts in [fl.split('.')] if len(parts) > 2 and parts[0] == h})
         for h in ('lh','rh','lr')})
def load_projections_from_path ( p ) : p = dirpath_to_list ( p ) return pyr . pmap ( { h : pimms . lazy_map ( { parts [ 1 ] : curry ( lambda flnm , h : load_map_projection ( flnm , chirality = h ) , os . path . join ( pp , fl ) , h ) for pp in p for fl in os . listdir ( pp ) if fl . endswith ( '.json' ) or fl . endswith ( '.json.gz' ) for parts in [ fl . split ( '.' ) ] if len ( parts ) > 2 and parts [ 0 ] == h } ) for h in ( 'lh' , 'rh' , 'lr' ) } )
load_projections_from_path(p) yields a lazy-map of all the map projection files found in the
      given path specification p. The path specification may be either a directory name, a
      :-separated list of directory names, or a python list of directory names.

    In order to be included in the returned mapping of projections, a projection must have a
    filename that matches the following format:
      <hemi>.<name>[.mp | .map | .projection | <nothing>].json[.gz]
    For example, the following match:
      lh.occipital_pole.mp.json    => map_projections['lh']['occipital_pole']
      rh.frontal.json.gz           => map_projections['rh']['frontal']
      lr.motor.projection.json.gz  => map_projections['lr']['motor']