Return opensearch.xml.
162098
def opensearch(request):
    

    contact_email = settings.CONTACT_EMAIL
    short_name = settings.SHORT_NAME
    description = settings.DESCRIPTION
    favicon_width = settings.FAVICON_WIDTH
    favicon_height = settings.FAVICON_HEIGHT
    favicon_type = settings.FAVICON_TYPE
    favicon_file = settings.FAVICON_FILE
    url = "{url}?{querystring}{{searchTerms}}".format(**{
        "url": request.build_absolute_uri(reverse(settings.SEARCH_URL)),
        "querystring": settings.SEARCH_QUERYSTRING,
    })
    input_encoding = settings.INPUT_ENCODING.upper()

    return render_to_response("opensearch/opensearch.xml", context=locals(), content_type="application/opensearchdescription+xml")
279343
def get(self):
        """"""
        # It is import to avoid accessing Qt C++ object as it has probably
        # already been destroyed, due to the Qt.WA_DeleteOnClose attribute
        if self.outfile:
            if self.result in ['list', 'dict', 'OrderedDict']:
                fd = open(self.outfile + '.py', 'w')
                fd.write(str(self.data))
            elif self.result == 'JSON':
                fd = open(self.outfile + '.json', 'w')
                data = json.loads(self.data, object_pairs_hook=OrderedDict)
                json.dump(data, fd)
            elif self.result == 'XML':
                fd = open(self.outfile + '.xml', 'w')
                root = ET.fromstring(self.data)
                tree = ET.ElementTree(root)
                tree.write(fd, encoding='UTF-8')
            fd.close()
        else:
            return self.data
1108841
def search(cls, query, search_opts=None):
        

        if search_opts is None:
            search_opts = {}

        xmlrpc = XMLRPCConnection()
        try:
            search_result = xmlrpc.connection.search_pool(
                {
                    'query': query,
                    'search_options': search_opts,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)
        result = dict()
        result['result'] = []
        result['search_options'] = search_result['search_options']
        for pool in search_result['result']:
            p = Pool.from_dict(pool)
            result['result'].append(p)

        return result
347208
def get(self, default=None, callback=None):
        """
        value = self._xml.text if self._xml.text else default
        return callback(value) if callback else value
1359777
def getXMLDescription(cliExecutable, **kwargs):
    """"""

    command = [cliExecutable, '--xml']
    
    stdout, stdoutFilename = tempfile.mkstemp('.stdout')
    stderr, stderrFilename = tempfile.mkstemp('.stderr')
    try:
        p = popenCLIExecutable(command, stdout = stdout, stderr = stderr, **kwargs)
        ec = p.wait()
        with open(stderrFilename) as f:
            for line in f:
                logger.warning('%s: %s' % (os.path.basename(cliExecutable), line[:-1]))
        if ec:
            raise RuntimeError("Calling %s failed (exit code %d)" % (cliExecutable, ec))
        with open(stdoutFilename) as f:
            return ET.parse(f)
    finally:
        os.close(stdout)
        os.close(stderr)
        os.unlink(stdoutFilename)
        os.unlink(stderrFilename)
1060209
def doc(self):
        
        ret = libxml2mod.xmlParserGetDoc(self._o)
        if ret is None:raise parserError('xmlParserGetDoc() failed')
        __tmp = xmlDoc(_obj=ret)
        return __tmp
1123134
def find_xml_all(cls, url, markup, tag, pattern):
        
        body = cls.find_xml(url, markup)
        return body.find_all(tag, href=re.compile(pattern))
160653
def get_log_entries_by_search(self, log_entry_query, log_entry_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_log_entries_by_search(log_entry_query, log_entry_search)
143168
def response_doc(self):
        """"""
        try:
            return self.__dict__['response_doc']
        except KeyError:
            self.__dict__['response_doc'] = ElementTree.fromstring(
                self.response_xml
            )
            return self.__dict__['response_doc']
757685
def find_xml(cls, url, features):
        
        req = cls._get_content(url)
        if req.status_code in range(200, 300):
            return BeautifulSoup(req.text, features)
        else:
            raise MlbAmHttpNotFound('HTTP Error url: {url} status: {status}'.format(url=url, status=req.status_code))
959259
def xpathNsLookup(self, prefix):
        
        ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
        return ret
1138089
def _normalize_xml_search_response(self, xml):
        
        target = XMLSearchResult()
        parser = ElementTree.XMLParser(target=target)
        parser.feed(xml)
        return parser.close()
240690
def main() -> None:
    
    parser = ArgumentParser(
        formatter_class=RawDescriptionHelpFormatter,
        description="""
Performs a grep (global-regular-expression-print) search of files in OpenXML
format, which is to say inside ZIP files.

Note that you can chain; for example, to search for OpenXML files containing
both "armadillo" and "bonobo", you can do:

    grep_in_openxml -l armadillo *.pptx | grep_in_openxml -x -l bonobo
                    ^^                                    ^^
                print filenames                       read filenames from stdin

"""
    )
    parser.add_argument(
        "pattern",
        help="Regular expression pattern to apply."
    )
    parser.add_argument(
        "filename", nargs="*",
        help="File(s) to check. You can also specify directores if you use "
             "--recursive"
    )
    parser.add_argument(
        "--filenames_from_stdin", "-x", action="store_true",
        help="Take filenames from stdin instead, one line per filename "
             "(useful for chained grep)."
    )
    parser.add_argument(
        "--recursive", action="store_true",
        help="Allow search to descend recursively into any directories "
             "encountered."
    )
    # Flag abbreviations to match grep:
    parser.add_argument(
        "--ignore_case", "-i", action="store_true",
        help="Ignore case"
    )
    parser.add_argument(
        "--invert_match", "-v", action="store_true",
        help="Invert match"
    )
    parser.add_argument(
        "--files_with_matches", "-l", action="store_true",
        help="Show filenames of files with matches"
    )
    parser.add_argument(
        "--files_without_match", "-L", action="store_true",
        help="Show filenames of files with no match"
    )
    parser.add_argument(
        "--grep_inner_file_name", action="store_true",
        help="Search the NAMES of the inner files, not their contents."
    )
    parser.add_argument(
        "--show_inner_file", action="store_true",
        help="For hits, show the filenames of inner files, within each ZIP."
    )
    parser.add_argument(
        "--nprocesses", type=int, default=multiprocessing.cpu_count(),
        help="Specify the number of processes to run in parallel."
    )
    parser.add_argument(
        "--verbose", action="store_true",
        help="Verbose output"
    )
    args = parser.parse_args()
    main_only_quicksetup_rootlogger(
        level=logging.DEBUG if args.verbose else logging.INFO)
    if args.files_with_matches and args.files_without_match:
        raise ValueError("Can't specify both --files_with_matches (-l) and "
                         "--files_without_match (-L)!")
    if bool(args.filenames_from_stdin) == bool(args.filename):
        raise ValueError("Specify --filenames_from_stdin or filenames on the "
                         "command line, but not both")

    # Compile regular expression
    if args.grep_inner_file_name:
        final_pattern = args.pattern
    else:
        encoding = getdefaultencoding()
        final_pattern = args.pattern.encode(encoding)
    flags = re.IGNORECASE if args.ignore_case else 0
    log.debug("Using regular expression {!r} with flags {!r}",
              final_pattern, flags)
    regex = re.compile(final_pattern, flags)

    # Set up pool for parallel processing
    pool = multiprocessing.Pool(processes=args.nprocesses)

    # Iterate through files
    parse_kwargs = dict(
        regex=regex,
        invert_match=args.invert_match,
        files_with_matches=args.files_with_matches,
        files_without_match=args.files_without_match,
        grep_inner_file_name=args.grep_inner_file_name,
        show_inner_file=args.show_inner_file
    )
    if args.filenames_from_stdin:
        for line in stdin.readlines():
            zipfilename = line.strip()
            parallel_kwargs = {'zipfilename': zipfilename}
            parallel_kwargs.update(**parse_kwargs)
            pool.apply_async(parse_zip, [], parallel_kwargs)
    else:
        for zipfilename in gen_filenames(starting_filenames=args.filename,
                                         recursive=args.recursive):
            parallel_kwargs = {'zipfilename': zipfilename}
            parallel_kwargs.update(**parse_kwargs)
            pool.apply_async(parse_zip, [], parallel_kwargs)
    pool.close()
    pool.join()
1366019
def NewDoc(self, cur, URL, encoding, options):
        
        ret = libxml2mod.xmlReaderNewDoc(self._o, cur, URL, encoding, options)
        return ret
550009
def index_as_xml(self):
        """"""
        self.default_capability()
        s = self.new_sitemap()
        return s.resources_as_xml(self, sitemapindex=True)
844737
def xmltreefromfile(filename):
    """"""
    try:
        return ElementTree.parse(filename, ElementTree.XMLParser(collect_ids=False))
    except TypeError:
        return ElementTree.parse(filename, ElementTree.XMLParser())
1348980
def search(self, release_name, lang):
        """"""
        subtitles = []
        language = babelfish.Language.fromalpha2(lang).name
        payload = {'q': release_name, 'r': 'true'}
        url = 'http://subscene.com/subtitles/release'
        response = requests.get(url, params=payload, headers=self.headers).text
        soup = BS(response, "lxml")
        positive = soup.find_all(class_='l r positive-icon')
        neutral = soup.find_all(class_='l r neutral-icon')
        for node in chain(positive, neutral):
            suburl = node.parent['href']
            quality = node['class'][2].split('-')[0]
            name = node.parent.findChildren()[1].text.strip()
            if language.lower() in suburl and 'trailer' not in name.lower():
                subtitle = {}
                subtitle['release'] = name
                subtitle['link'] = urljoin(self.base_url, suburl)
                subtitle['lang'] = lang
                subtitle['movie'] = name+quality
                subtitle['date'] = '10/10/2010'
                subtitles.append(subtitle)
        return subtitles