@classmethod
    def extract_document(cls, obj):
        attrs = ('id', 'average_daily_users', 'bayesian_rating', 'created',
                 'default_locale', 'guid', 'hotness', 'is_disabled',
                 'is_listed', 'last_updated', 'public_stats', 'slug', 'status',
                 'type', 'weekly_downloads')
        data = {attr: getattr(obj, attr) for attr in attrs}

        if obj.type == amo.ADDON_PERSONA:
            try:
                # Boost on popularity.
                data['boost'] = obj.persona.popularity ** .2
                data['has_theme_rereview'] = (
                    obj.persona.rereviewqueuetheme_set.exists())
                # 'weekly_downloads' field is used globally to sort, but
                # for themes weekly_downloads don't make much sense, use
                # popularity instead (FIXME: should be the other way around).
                data['weekly_downloads'] = obj.persona.popularity
            except ObjectDoesNotExist:
                # The instance won't have a persona while it's being created.
                pass
        else:
            # Boost by the number of users on a logarithmic scale. The maximum
            # boost (11,000,000 users for adblock) is about 5x.
            data['boost'] = obj.average_daily_users ** .2
            data['has_theme_rereview'] = None

        data['app'] = [app.id for app in obj.compatible_apps.keys()]
        data['appversion'] = {}
        for app, appver in obj.compatible_apps.items():
            if appver:
                min_, max_ = appver.min.version_int, appver.max.version_int
            else:
                # Fake wide compatibility for search tools and personas.
                min_, max_ = 0, version_int('9999')
            data['appversion'][app.id] = dict(min=min_, max=max_)
        data['authors'] = [a.name for a in obj.listed_authors]
        # Quadruple the boost if the add-on is public.
        if obj.status == amo.STATUS_PUBLIC and 'boost' in data:
            data['boost'] = max(data['boost'], 1) * 4
        # We go through attach_categories and attach_tags transformer before
        # calling this function, it sets category_ids and tag_list.
        data['category'] = getattr(obj, 'category_ids', [])
        if obj.current_version:
            data['current_version'] = {
                'id': obj.current_version.pk,
                'files': [{
                    'id': file_.id,
                    'created': file_.created,
                    'filename': file_.filename,
                    'hash': file_.hash,
                    'platform': file_.platform,
                    'size': file_.size,
                    'status': file_.status,
                } for file_ in obj.current_version.all_files],
                'reviewed': obj.current_version.reviewed,
                'version': obj.current_version.version,
            }
            data['has_version'] = True
            data['platforms'] = [p.id for p in
                                 obj.current_version.supported_platforms]
        else:
            data['has_version'] = None
        data['tags'] = getattr(obj, 'tag_list', [])

        # Handle localized fields.
        # First, deal with the 3 fields that need everything:
        for field in ('description', 'name', 'summary'):
            data.update(cls.extract_field_raw_translations(obj, field))
            data.update(cls.extract_field_search_translations(obj, field))
            data.update(cls.extract_field_analyzed_translations(obj, field))

        # Then add fields that only need to be returned to the API without
        # contributing to search relevancy.
        for field in ('homepage', 'support_email', 'support_url'):
            data.update(cls.extract_field_raw_translations(obj, field))

        # Finally, add the special sort field, coercing the current translation
        # into an unicode object first.
        data['name_sort'] = unicode(obj.name).lower()

        return data
Return a dictionary of scheme -> proxy server URL mappings.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/addons/indexers.py/AddonIndexer.extract_document--crossover with--dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/urllib.py/getproxies_registry