Catalogue methods
327507
public Catalogue getCatalogue( String uri, Parameter... parameters )
    {
        return invoke( catalogueDigesterLoader, uri, parameters );
    }
29152
def folderitems(self):
        
        items = super(ReferenceResultsView, self).folderitems()
        self.categories.sort()
        return items
1367998
def list_catalog(self, cat_slug, **kwargs):
        '''
        
        '''
        post_data = self.get_post_data()
        tag = post_data.get('tag', '')

        def get_pager_idx():
            '''
            Get the pager index.
            '''
            cur_p = kwargs.get('cur_p')
            the_num = int(cur_p) if cur_p else 1
            the_num = 1 if the_num < 1 else the_num
            return the_num

        current_page_num = get_pager_idx()
        cat_rec = MCategory.get_by_slug(cat_slug)
        if not cat_rec:
            return False

        num_of_cat = MPost2Catalog.count_of_certain_category(cat_rec.uid, tag=tag)

        page_num = int(num_of_cat / CMS_CFG['list_num']) + 1
        cat_name = cat_rec.name
        kwd = {'cat_name': cat_name,
               'cat_slug': cat_slug,
               'title': cat_name,
               'router': router_post[cat_rec.kind],
               'current_page': current_page_num,
               'kind': cat_rec.kind,
               'tag': tag}


        # Todo: review the following codes.


        if self.order:
            tmpl = 'list/catalog_list.html'
        else:
            tmpl = 'list/category_list.html'

        infos = MPost2Catalog.query_pager_by_slug(
            cat_slug,
            current_page_num,
            tag=tag,
            order=self.order
        )

        # ToDo: `gen_pager_purecss` should not use any more.
        self.render(tmpl,
                    catinfo=cat_rec,
                    infos=infos,
                    pager=tools.gen_pager_purecss(
                        '/list/{0}'.format(cat_slug),
                        page_num,
                        current_page_num),
                    userinfo=self.userinfo,
                    html2text=html2text,
                    cfg=CMS_CFG,
                    kwd=kwd,
                    router=router_post[cat_rec.kind])
1319240
def main(catalog):
    
    res = validate_catalog(catalog, only_errors=True, fmt="list",
                           export_path=None, validator=None)
    print("")
    print("=== Errores a nivel de CATALOGO ===")
    pprint(res["catalog"])

    print("")
    print("=== Errores a nivel de DATASET ===")
    pprint(res["dataset"])
1202099
def load_messages(self, directory, catalogue):
        
        if not os.path.isdir(directory):
            raise ValueError("{0} is not a directory".format(directory))

        for format, loader in list(self.loaders.items()):
            extension = "{0}.{1}".format(catalogue.locale, format)
            files = find_files(directory, "*.{0}".format(extension))
            for file in files:
                domain = file.split("/")[-1][:-1 * len(extension) - 1]
                catalogue.add_catalogue(
                    loader.load(
                        file,
                        catalogue.locale,
                        domain))
1009448
public static List<Catalog> getCatalogs(@NonNull final MetadataContext context, final boolean nonempty)
            throws SQLException {
        final List<Catalog> catalogs = context.getCatalogs();
        if (catalogs.isEmpty() && nonempty) {
            final Catalog catalog = new Catalog();
            catalog.virtual = true;
            catalog.setTableCat("");
            catalogs.add(catalog);
            if (!context.isSuppressionPath("catalog/schemas")) {
                catalog.getSchemas().addAll(context.getSchemas(catalog.getTableCat(), ""));
            }
        }
        if (!context.isSuppressionPath("catalog/schemas")) {
            boolean allempty = true;
            for (final Catalog catalog : catalogs) {
                if (!catalog.getSchemas().isEmpty()) {
                    allempty = false;
                    break;
                }
            }
            if (allempty) {
                logger.warning("schemas are all empty");
                for (final Catalog catalog : catalogs) {
                    catalog.getSchemas().addAll(getSchemas(context, catalog.getTableCat(), true));
                }
            }
        }
        return catalogs;
    }
1350343
def load_user_catalog():
    """"""
    cat_dir = user_data_dir()
    if not os.path.isdir(cat_dir):
        return Catalog()
    else:
        return YAMLFilesCatalog(cat_dir)
747969
def get_catalog(mid):
    
    if isinstance(mid, _uuid.UUID):
        mid = mid.hex
    return _get_catalog(mid)
1117225
def create_catalog(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinAdminSession.create_bin
        return Catalog(
            self._provider_manager,
            self._get_provider_session('catalog_admin_session').create_catalog(*args, **kwargs),
            self._runtime,
            self._proxy)
1202612
def folderitems(self):
        
        items = super(AnalysisProfileAnalysesView, self).folderitems()
        self.categories.sort()
        return items
840009
def get_collections(self):
        
        result = self.api_request('/catalog')

        # get the collection name from the url
        return [(os.path.split(x)[1], x) for x in result['collections']]
427993
def select_catalogue_events(self, id0):
        '''
        
        '''
        for key in self.data:
            if isinstance(
                    self.data[key], np.ndarray) and len(self.data[key]) > 0:
                # Dictionary element is numpy array - use logical indexing
                self.data[key] = self.data[key][id0]
            elif isinstance(
                    self.data[key], list) and len(self.data[key]) > 0:
                # Dictionary element is list
                self.data[key] = [self.data[key][iloc] for iloc in id0]
            else:
                continue
680237
def createCatalog(config,roi=None,lon=None,lat=None):
    
    import ugali.observation.catalog
    if roi is None: roi = createROI(config,lon,lat)
    catalog = ugali.observation.catalog.Catalog(config,roi=roi)
    return catalog
566307
def write_catalogue(self, output_file, key_list=SORTED_ATTRIBUTE_LIST):
        

        with open(output_file, 'w') as of:
            writer = csv.DictWriter(of, fieldnames=key_list)
            writer.writeheader()
            for i in range(self.get_number_events()):
                row_dict = {}
                for key in key_list:
                    if len(self.data[key]) > 0:
                        data = self.data[key][i]
                        if key in self.INT_ATTRIBUTE_LIST:
                            if np.isnan(data):
                                data = ''
                            else:
                                data = int(data)
                        if key in self.FLOAT_ATTRIBUTE_LIST:
                            if np.isnan(data):
                                data = ''
                            else:
                                data = float(data)
                    row_dict[key] = data
                writer.writerow(row_dict)
1089732
def get_catalogue_header_value(cls, catalog, key):
        """"""
        header_value = None
        if '' in catalog:
            for line in catalog[''].split('\n'):
                if line.startswith('%s:' % key):
                    header_value = line.split(':', 1)[1].strip()

        return header_value
324355
def inventory(self, source_id):
        
        if self.n_sources==0:
            print('Please run group_sources() to create the catalog first.')
        
        else:
            
            if source_id>self.n_sources or source_id<1 or not isinstance(source_id, int):
                print('Please enter an integer between 1 and',self.n_sources)
            
            else:
            
                print('Source:')
                print(at.Table.from_pandas(self.catalog[self.catalog['id']==source_id]).pprint())
                for cat_name in self.catalogs:
                    cat = getattr(self, cat_name)
                    rows = cat[cat['source_id']==source_id]
                    if not rows.empty:
                        print('\n{}:'.format(cat_name))
                        at.Table.from_pandas(rows).pprint()
499306
def catalog(self):
        
        from pyspark.sql.catalog import Catalog
        if not hasattr(self, "_catalog"):
            self._catalog = Catalog(self)
        return self._catalog