harvester/ext/importer/ckan_sync_client.py
def _find_datasets_by_source(self, source_name):
        """
        Find all datasets matching the current source.
        Returns a dict mapping source ids with dataset objects.
        """

        # HACK: We are reporting *twice* the number of datasets,
        #       to give an estimate of the remaining steps..

        _total = len(self._client.list_datasets())
        _current = itertools.count(1).next

        results = {}
        report_progress(('get ckan state',), 0, _total * 2)
        for dataset in self._client.iter_datasets():
            if HARVEST_SOURCE_ID_FIELD in dataset.extras:
                source_id = dataset.extras[HARVEST_SOURCE_ID_FIELD]
                _name, _id = self._parse_source_id(source_id)
                if _name == source_name:
                    results[_id] = dataset
            report_progress(('get ckan state',), _current(), _total * 2)

        report_progress(('get ckan state',), _total, _total)

        return results

        Find all datasets matching the current source.
        Returns a dict mapping source ids with dataset objects.
        
Find all datasets matching the current source.
Returns a dict mapping source ids with dataset objects.
Find all datasets matching the current source . Returns a dict mapping source ids with dataset objects .
def _find_datasets_by_source(self, source_name):
        _total = len(self._client.list_datasets())
        _current = itertools.count(1).next
        results = {}
        report_progress(('get ckan state',), 0, _total * 2)
        for dataset in self._client.iter_datasets():
            if HARVEST_SOURCE_ID_FIELD in dataset.extras:
                source_id = dataset.extras[HARVEST_SOURCE_ID_FIELD]
                _name, _id = self._parse_source_id(source_id)
                if _name == source_name:
                    results[_id] = dataset
            report_progress(('get ckan state',), _current(), _total * 2)
        report_progress(('get ckan state',), _total, _total)
        return results
def _find_datasets_by_source ( self , source_name ) : _total = len ( self . _client . list_datasets ( ) ) _current = itertools . count ( 1 ) . next results = { } report_progress ( ( 'get ckan state' , ) , 0 , _total * 2 ) for dataset in self . _client . iter_datasets ( ) : if HARVEST_SOURCE_ID_FIELD in dataset . extras : source_id = dataset . extras [ HARVEST_SOURCE_ID_FIELD ] _name , _id = self . _parse_source_id ( source_id ) if _name == source_name : results [ _id ] = dataset report_progress ( ( 'get ckan state' , ) , _current ( ) , _total * 2 ) report_progress ( ( 'get ckan state' , ) , _total , _total ) return results
Find all datasets matching the current source.
Find all datasets matching the current source .
"""
        Find all datasets matching the current source.
        Returns a dict mapping source ids with dataset objects.
        """ # HACK: We are reporting *twice* the number of datasets, #       to give an estimate of the remaining steps..
self
source_name