Return rels item XML for source with *source_uri* or None if no rels
        item is present.
9296
def rels_xml_for(self, source_uri):
        
        try:
            rels_xml = self.blob_for(source_uri.rels_uri)
        except KeyError:
            rels_xml = None
        return rels_xml
611763
def getItemLocals(item):
    '''
    

    '''
    for name in dir(item):
        try:
            valu = getattr(item, name, None)
            yield name, valu
        except Exception:
            pass
487971
def get_resps(self, source_tree):
        
        resps = set()
        bearers = source_tree.xpath('//*[@resp]',
                                    namespaces=constants.NAMESPACES)
        for bearer in bearers:
            for resp in resp_splitter.split(bearer.get('resp')):
                if resp:
                    resps.add(tuple(resp.split('|', maxsplit=1)))
        return sorted(resps), bearers
759799
def get_resources_dests(resources_root, rules):
    """"""

    def get_rel_path(base, path):
        # normalizes and returns a lstripped-/-separated path
        base = base.replace(os.path.sep, '/')
        path = path.replace(os.path.sep, '/')
        assert path.startswith(base)
        return path[len(base):].lstrip('/')


    destinations = {}
    for base, suffix, dest in rules:
        prefix = os.path.join(resources_root, base)
        for abs_base in iglob(prefix):
            abs_glob = os.path.join(abs_base, suffix)
            for abs_path in iglob(abs_glob):
                resource_file = get_rel_path(resources_root, abs_path)
                if dest is None:  # remove the entry if it was here
                    destinations.pop(resource_file, None)
                else:
                    rel_path = get_rel_path(abs_base, abs_path)
                    rel_dest = dest.replace(os.path.sep, '/').rstrip('/')
                    destinations[resource_file] = rel_dest + '/' + rel_path
    return destinations
409480
def grab_xml(host, token=None):
    """"""
    urllib3.disable_warnings()
    if token:
        scheme = "https"
    if not token:
        scheme = "http"
        token = "1234567890"
    url = (
            scheme + '://' + host + '/gwr/gop.php?cmd=GWRBatch&data=<gwrcmds><gwrcmd><gcmd>RoomGetCarousel</gcmd><gdata><gip><version>1</version><token>' + token + '</token><fields>name,status</fields></gip></gdata></gwrcmd></gwrcmds>&fmt=xml')
    response = requests.get(url, verify=False)
    parsed = xmltodict.parse(response.content, force_list={'room', 'device'})
    parsed = parsed['gwrcmds']['gwrcmd']['gdata']['gip']['room']
    return parsed
563607
def get(uri)
      uri = Resync::XML.to_uri(uri)
      @helper.fetch(uri: uri)
    end
1218023
def source(self, source):
        """"""
        if isinstance(source, list):
            # if source is a list, get first item or None
            source = source[0] if len(source) > 0 else None
        self._source = source
1163807
def get_source(self, objtxt):
        """"""
        obj, valid = self._eval(objtxt)
        if valid:
            return getsource(obj)
1195984
def get_uri(source):
    

    import gst

    src_info = source_info(source)

    if src_info['is_file']:  # Is this a file?
        return get_uri(src_info['uri'])

    elif gst.uri_is_valid(source):  # Is this a valid URI source for Gstreamer
        uri_protocol = gst.uri_get_protocol(source)
        if gst.uri_protocol_is_supported(gst.URI_SRC, uri_protocol):
            return source
        else:
            raise IOError('Invalid URI source for Gstreamer')
    else:
        raise IOError('Failed getting uri for path %s: no such file' % source)
911200
def XML(content, source=None):
    
    try:
        tree = ET.XML(content)
    except ET.ParseError as err:
        x_parse_error(err, content, source)
    return tree
1062658
def source_uris(self):
        """"""
        return [x.path for x in luigi.task.flatten(self.input())]
901352
def _get_xml(xml_str):
    '''
    
    '''
    try:
        xml_data = etree.XML(xml_str)
    # XMLSyntaxError seems to be only available from lxml, but that is the xml
    # library loaded by this module
    except etree.XMLSyntaxError as err:
        # opennebula returned invalid XML, which could be an error message, so
        # log it
        raise SaltCloudSystemExit('opennebula returned: {0}'.format(xml_str))
    return xml_data
81067
def get(self, uri):
        '''
        '''
        if uri.startswith('cid:'):
            # Content-ID, so raise exception if not found.
            head, part = self.id_dict[uri[4:]]
            return StringIO.StringIO(part.getvalue())
        if self.loc_dict.has_key(uri):
            head, part = self.loc_dict[uri]
            return StringIO.StringIO(part.getvalue())
        return None
779729
def _get_catalog_url(self, url):
        '''
        
        '''
        u = urlparse.urlsplit(url)
        name, ext = os.path.splitext(u.path)
        if ext == ".html":
            u = urlparse.urlsplit(url.replace(".html", ".xml"))
        url = u.geturl()
        return url
578087
def parse_description_xml(location):
    
    class _URLBase(str):
        """ Convenient access to hostname (ip) portion of the URL """
        @property
        def hostname(self):
            return urlsplit(self).hostname

    # """TODO: review error handling on xml"""
    # may want to suppress ParseError in the event that it was caused
    # by a none bridge device although this seems unlikely
    try:
        xml_str = from_url(location)
    except urllib.request.HTTPError as error:
        logger.info("No description for %s: %s", location, error)
        return None, error
    except urllib.request.URLError as error:
        logger.info("No HTTP server for %s: %s", location, error)
        return None, error
    else:
        root = ET.fromstring(xml_str)
        rootname = {'root': root.tag[root.tag.find('{')+1:root.tag.find('}')]}
        baseip = root.find('root:URLBase', rootname).text
        device = root.find('root:device', rootname)
        serial = device.find('root:serialNumber', rootname).text
        # anicon = device.find('root:iconList', rootname).find('root:icon', rootname)
        # imgurl = anicon.find('root:url', rootname).text

        # Alternatively, could look directly in the modelDescription field
        if all(x in xml_str.lower() for x in ['philips', 'hue']):
            return serial, _URLBase(baseip)
        else:
            return None, None
667868
def read_rels(archive):
    """"""
    xml_source = archive.read(ARC_WORKBOOK_RELS)
    tree = fromstring(xml_source)
    for element in safe_iterator(tree, '{%s}Relationship' % PKG_REL_NS):
        rId = element.get('Id')
        pth = element.get("Target")
        typ = element.get('Type')
        # normalise path
        if pth.startswith("/xl"):
            pth = pth.replace("/xl", "xl")
        elif not pth.startswith("xl") and not pth.startswith(".."):
            pth = "xl/" + pth
        yield rId, {'path':pth, 'type':typ}
279914
def _load_resource(self, source_r, abs_path=False):
        

        r = self.doc.resource(source_r.name)

        r.url = self.resource_root.join(r.url).inner