Enriches existing user configured data.
322691
protected function enrichCustomData()
    {
        // Check set filters and enrich them as required
        $filters = [];

        foreach ($this->info->list->filters as $key => $filter) {

            try {
                $this->enrichFilter($key, $filter, $filters);

            } catch (\Exception $e) {

                // Wrap and decorate exceptions so it is easier to track the problem source
                throw (new ModelInformationEnrichmentException(
                    "Issue with list filter '{$key}' (list.filters.{$key}): \n{$e->getMessage()}",
                    $e->getCode(),
                    $e
                ))
                    ->setSection('list.filters')
                    ->setKey($key);
            }
        }

        $this->info->list->filters = $filters;
    }
103357
def build(config):
    """"""
    logger.info("\nRendering website now...\n")
    logger.info("entries:")
    tags = dict()
    entries = list()
    for post, post_id in find_new_posts_and_pages(DB):
        # this method will also parse the post's tags and
        # update the db collection containing the tags.
        if post.render():
            if post.header['kind'] in ['writing', 'link']:
                for tag in post.tags:
                    tag.posts = [post_id]
                    tags[tag.name] = tag
                entries.append(post)
            logger.info("%s" % post.path)

    for name, to in tags.items():
        logger.info("updating tag %s" % name)
        to.render()

    # This is expensive, we should insert only the recent entries
    # to the index using BeautifulSoup
    # update index
    logger.info("Updating index")
    last_entries, all_entries = _get_last_entries(DB, config['INDEX_SIZE'])
    last_entries = list(_filter_none_public(last_entries))
    update_index(last_entries)

    # update archive
    logger.info("Updating archive")

    # This is expensive, we should insert only the recent entries
    # to the archive using BeautifulSoup

    entries = [Entry.entry_from_db(
               os.path.join(CONFIG['content_root'],
                            e.get('filename')), e.doc_id) for e in
               DB.posts.all()]
    all_entries = list(_filter_none_public(all_entries))
    all_entries.sort(key=operator.attrgetter('date'), reverse=True)
    render_archive(all_entries[config['ARCHIVE_SIZE']:])
498936
def _extend_data(self, datapoint, new_data):
        
        if new_data:
            try:
                self.data[datapoint].extend(new_data)
            except KeyError:
                self.data[datapoint] = new_data
990406
def extra_data
      {
        component: {
          manifest_name: component.try(:manifest_name),
          title: title_for(component)
        }.compact,
        participatory_space: {
          manifest_name: participatory_space_manifest_name,
          title: title_for(participatory_space)
        }.compact,
        resource: {
          title: title_for(resource)
        }.compact,
        user: {
          ip: user.current_sign_in_ip,
          name: user.name,
          nickname: user.nickname
        }.compact
      }.deep_merge(resource_extra)
    end
609488
def initialise_modified_data(self):
        
        if self.__modified_data__ is None:
            if self.__original_data__:
                self.__modified_data__ = list(self.__original_data__)
            else:
                self.__modified_data__ = []
1307603
function(key, data) {
        var currentData;
        currentData = settings[key] || {};
        settings[key] = _.extend(currentData, data);
      }
251687
def _populate_data(self):
        """"""
        if self.id is None:
            self.id = self.meta_data.get("id")
        self.is_anchor = self.meta_data.get("is_anchor")
        self.country_code = self.meta_data.get("country_code")
        self.description = self.meta_data.get("description")
        self.is_public = self.meta_data.get("is_public")
        self.asn_v4 = self.meta_data.get("asn_v4")
        self.asn_v6 = self.meta_data.get("asn_v6")
        self.address_v4 = self.meta_data.get("address_v4")
        self.address_v6 = self.meta_data.get("address_v6")
        self.prefix_v4 = self.meta_data.get("prefix_v4")
        self.prefix_v6 = self.meta_data.get("prefix_v6")
        self.geometry = self.meta_data.get("geometry")
        self.tags = self.meta_data.get("tags")
        self.status = self.meta_data.get("status", {}).get("name")
1112111
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data["properties"]

        ip_configurations = []
        for raw_content in properties.get("ipConfigurations", []):
            resource = Resource.from_raw_data(raw_content)
            ip_configurations.append(resource)
        properties["ipConfigurations"] = ip_configurations

        subnetworks = []
        for raw_subnet in properties.get("subnets", []):
            subnetworks.append(Resource.from_raw_data(raw_subnet))
        properties["subnets"] = subnetworks

        acl_rules = []
        for raw_rule in properties.get("aclRules", []):
            raw_rule["parentResourceID"] = raw_data["resourceId"]
            acl_rules.append(ACLRules.from_raw_data(raw_rule))
        properties["aclRules"] = acl_rules

        return super(AccessControlLists, cls).process_raw_data(raw_data)
1072443
def user_parse(data):
        """"""
        yield 'id', data.get('id')
        yield 'email', data.get('email')
        first_name, _, last_name = (data.get('name') or '').partition(' ')
        yield 'first_name', first_name
        yield 'last_name', last_name
        yield 'username', data.get('login')
        yield 'picture', data.get('avatar_url')
        yield 'link', data.get('html_url')
        location = data.get('location', '')
        if location:
            split_location = location.split(',')
            yield 'country', split_location[0].strip()
            if len(split_location) > 1:
                yield 'city', split_location[1].strip()
535512
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data["properties"]

        raw_content = properties.get("accessControlList", None)
        if raw_content is not None:
            resource = Resource.from_raw_data(raw_content)
            properties["accessControlList"] = resource

        # TODO(alexcoman): Add model for ServiceInsertion
        raw_content = properties.get("serviceInsertion", None)
        if raw_content is not None:
            resource = Resource.from_raw_data(raw_content)
            properties["serviceInsertion"] = resource

        raw_content = properties.get("routeTable", None)
        if raw_content is not None:
            resource = Resource.from_raw_data(raw_content)
            properties["routeTable"] = resource

        ip_configurations = []
        for raw_config in properties.get("ipConfigurations", []):
            ip_configurations.append(Resource.from_raw_data(raw_config))
        properties["ipConfigurations"] = ip_configurations

        return super(SubNetworks, cls).process_raw_data(raw_data)
577600
def generate_additional_context(self, matching_datasets):
        """"""
        top_tags = Tag.objects.filter(
            dataset__in=matching_datasets
        ).annotate(
            tag_count=Count('word')
        ).order_by('-tag_count')[:3]

        top_authors = Dataset.objects.filter(
            id__in=matching_datasets
        ).values('uploaded_by').annotate(
            author_count=Count('uploaded_by')
        ).order_by('-author_count')[:3]

        for author in top_authors:
            author['fullName'] = grab_names_from_emails([
                author['uploaded_by']
            ])[author['uploaded_by']]

        return {
            'top_tags': top_tags,
            'top_authors': top_authors
        }
96983
def enrich(self, columns):
        

        for column in columns:
            if column not in self.data.columns:
                return self.data

        for column in columns:
            a = self.data[column].apply(self.__remove_surrogates)
            self.data[column] = a

        return self.data
980459
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict:
        
        """
        return defaults(
            dict(data) if not isinstance(data, dict) else data,
            *(dict(item) for item in additional))
162079
def extend(self, values):
        """"""
        if self.asserted:
            raise RuntimeError("Fact already asserted")

        self._multifield.extend(values)
446084
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data.get("properties", {})

        frontend_ip_configurations = []
        for raw_content in properties.get("frontendIPConfigurations", []):
            resource = Resource.from_raw_data(raw_content)
            frontend_ip_configurations.append(resource)
        properties["frontendIPConfigurations"] = frontend_ip_configurations

        raw_content = properties.get("backendAddressPool", None)
        if raw_content is not None:
            resource = Resource.from_raw_data(raw_content)
            properties["backendAddressPool"] = resource

        raw_content = properties.get("probe", None)
        if raw_content is not None:
            resource = Resource.from_raw_data(raw_content)
            properties["probe"] = resource

        return super(LoadBalancingRules, cls).process_raw_data(raw_data)
1231057
def user_parse(data):
        """"""
        yield 'id', data.get('id') or data.get('user_id')
        first_name, _, last_name = data['name'].partition(' ')
        yield 'first_name', first_name
        yield 'last_name', last_name
        yield 'picture', data.get('profile_image_url')
        yield 'locale', data.get('lang')
        yield 'link', data.get('url')
        yield 'username', data.get('screen_name')
        city, _, country = map(lambda s: s.strip(),
                               data.get('location', '').partition(','))
        yield 'city', city
        yield 'country', country
736628
protected function performEnrichment()
    {
        if ( ! count($this->info->form->fields)) {
            $this->fillDataForEmpty();
        } else {
            $this->enrichCustomData();
        }
    }