<commit_before># -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
from xml.sax.saxutils import escape
from colorama import Fore, Back, Style

import json
import re


class SearchResultView(object):

    def __init__(self, time_consumed, alfred_format=False, alfred_v3=False):
        self.time_consumed = time_consumed
        self.alfred_format = alfred_format
        self.alfred_v3 = alfred_v3

    def print_search_result(self, search_result, keywords=None):
            
        if self.alfred_format:
            results = []
            count = 0
            
            for repo in search_result:
                count += 1
                if count == 1:
                    continue
                    
                full_name = repo.get('full_name')
                url = repo.get('url')
                language = repo.get('language')
                description = repo.get('description')
                if self.alfred_v3:
                    results.append({
                        "title": full_name,
                        "subtitle": '%s [%s]' % (description, 
                            language if language else ''),
                        "arg": url,
                    })

                else:  # legacy xml format for v2
                    results.append('<item uid="" arg="{}"'.format(url))
                    results.append('<title>{}</title>'.format(escape(full_name)))
                    if description:
                        results.append('<subtitle>{} {}</subtitle>'.format(
                            escape(description),<commit_msg>fix xml output<commit_after># -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
from xml.sax.saxutils import escape
from colorama import Fore, Back, Style

import json
import re


class SearchResultView(object):

    def __init__(self, time_consumed, alfred_format=False, alfred_v3=False):
        self.time_consumed = time_consumed
        self.alfred_format = alfred_format
        self.alfred_v3 = alfred_v3

    def print_search_result(self, search_result, keywords=None):
            
        if self.alfred_format:
            results = []
            count = 0
            
            for repo in search_result:
                count += 1
                if count == 1:
                    continue
                    
                full_name = repo.get('full_name')
                url = repo.get('url')
                language = repo.get('language')
                description = repo.get('description')
                if self.alfred_v3:
                    results.append({
                        "title": full_name,
                        "subtitle": '%s [%s]' % (description, 
                            language if language else ''),
                        "arg": url,
                    })

                else:  # legacy xml format for v2
                    results.append('<item uid="" arg="{}">'.format(url))
                    results.append('<title>{}</title>'.format(escape(full_name)))
                    if description:
                        results.append('<subtitle>{} {}</subtitle>'.format(
                            escape(description),
{'fraction_non_alphanumeric': 0.10090361445783133, 'fraction_numerical': 0.005421686746987952, 'mean_word_length': 1.4691449814126394, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7202684', 'n_tokens_mistral': 873, 'n_tokens_neox': 813, 'n_words': 195}