Get sources list from receiver.

        Internal method which queries device via HTTP to get the receiver's
        input sources.
        This method also determines the type of the receiver
        (avr, avr-x, avr-x-2016).
961112
def _get_receiver_sources(self):
        
        # Test if receiver is a AVR-X with port 80 for pre 2016 devices and
        # port 8080 devices 2016 and later
        r_types = [AVR_X, AVR_X_2016]
        for r_type, port in r_types:
            self._receiver_port = port

            # This XML is needed to get the sources of the receiver
            try:
                root = self.get_status_xml(self._urls.deviceinfo,
                                           suppress_errors=True)
            except (ValueError, requests.exceptions.RequestException):
                self._receiver_type = None
            else:
                # First test by CommApiVers
                try:
                    if bool(DEVICEINFO_COMMAPI_PATTERN.search(
                            root.find("CommApiVers").text) is not None):
                        self._receiver_type = r_type
                        # receiver found break the loop
                        break
                except AttributeError:
                    # AttributeError occurs when ModelName tag is not found.
                    # In this case there is no AVR-X device
                    self._receiver_type = None

                # if first test did not find AVR-X device, check by model name
                if self._receiver_type is None:
                    try:
                        if bool(DEVICEINFO_AVR_X_PATTERN.search(
                                root.find("ModelName").text) is not None):
                            self._receiver_type = r_type
                            # receiver found break the loop
                            break
                    except AttributeError:
                        # AttributeError occurs when ModelName tag is not found
                        # In this case there is no AVR-X device
                        self._receiver_type = None

        # Set ports and update method
        if self._receiver_type is None:
            self._receiver_type = AVR.type
            self._receiver_port = AVR.port
        elif self._receiver_type == AVR_X_2016.type:
            self._receiver_port = AVR_X_2016.port
        else:
            self._receiver_port = AVR_X.port

        _LOGGER.info("Identified receiver type: '%s' on port: '%s'",
                     self._receiver_type, self._receiver_port)

        # Not an AVR-X device, start determination of sources
        if self._receiver_type == AVR.type:
            # Sources list is equal to list of renamed sources.
            non_x_sources, deleted_non_x_sources, status_success = (
                self._get_renamed_deleted_sourcesapp())

            # Backup if previous try with AppCommand was not successful
            if not status_success:
                non_x_sources, deleted_non_x_sources = (
                    self._get_renamed_deleted_sources())

            # Remove all deleted sources
            if self._show_all_inputs is False:
                for deleted_source in deleted_non_x_sources.items():
                    if deleted_source[1] == "DEL":
                        non_x_sources.pop(deleted_source[0], None)
            # Invalid source "SOURCE" needs to be deleted
            non_x_sources.pop("SOURCE", None)
            return non_x_sources

        # Following source determination of AVR-X receivers
        else:
            # receiver_sources is of type dict with "FuncName" as key and
            # "DefaultName" as value.
            receiver_sources = {}
            # Source determination from XML
            favorites = root.find(".//FavoriteStation")
            if favorites:
                for child in favorites:
                    if not child.tag.startswith("Favorite"):
                        continue
                    func_name = child.tag.upper()
                    self._favorite_func_list.append(func_name)
                    receiver_sources[func_name] = child.find("Name").text
            for xml_zonecapa in root.findall("DeviceZoneCapabilities"):
                # Currently only Main Zone (No=0) supported
                if xml_zonecapa.find("./Zone/No").text == "0":
                    # Get list of all input sources of receiver
                    xml_list = xml_zonecapa.find("./InputSource/List")
                    for xml_source in xml_list.findall("Source"):
                        receiver_sources[
                            xml_source.find(
                                "FuncName").text] = xml_source.find(
                                    "DefaultName").text

            return receiver_sources
340284
def get_devices_from_response_dict(response_dict, device_type):
    
    items = response_dict.get('data')

    devices = []

    api_interface = WinkApiInterface()
    check_list = isinstance(device_type, (list,))

    for item in items:
        if (check_list and get_object_type(item) in device_type) or \
                (not check_list and get_object_type(item) == device_type):
            _devices = build_device(item, api_interface)
            for device in _devices:
                devices.append(device)

    return devices
918028
def get_protocols(self, device):
        """"""
        return self._reg.device_builder(device, self._rv).protocols
487118
def get_filtered_devices(
        self, model_name, device_types="upnp:rootdevice", timeout=2
    ):
        

        # get list of all UPNP devices in the network
        upnp_devices = self.discover_upnp_devices(st=device_types)

        # go through all UPNP devices and filter wanted devices
        filtered_devices = collections.defaultdict(dict)
        for dev in upnp_devices.values():
            try:
                # download XML file with information about the device
                # from the device's location
                r = requests.get(dev.location, timeout=timeout)

                if r.status_code == requests.codes.ok:
                    # parse returned XML
                    root = ET.fromstring(r.text)

                    # add shortcut for XML namespace to access sub nodes
                    ns = {"upnp": "urn:schemas-upnp-org:device-1-0"}

                    # get device element
                    device = root.find("upnp:device", ns)

                    if model_name in device.find(
                        "upnp:modelName", ns
                    ).text:
                        # model name is wanted => add to list

                        # get unique UDN of the device that is used as key
                        udn = device.find("upnp:UDN", ns).text

                        # add url base
                        url_base = root.find("upnp:URLBase", ns)
                        if url_base is not None:
                            filtered_devices[udn][
                                "URLBase"
                            ] = url_base.text

                        # add interesting device attributes and
                        # use unique UDN as key
                        for attr in (
                            "deviceType", "friendlyName", "manufacturer",
                            "manufacturerURL", "modelDescription",
                            "modelName", "modelNumber"
                        ):
                            el = device.find("upnp:%s" % attr, ns)
                            if el is not None:
                                filtered_devices[udn][
                                    attr
                                ] = el.text.strip()

            except ET.ParseError:
                # just skip devices that are invalid xml
                pass
            except requests.exceptions.ConnectTimeout:
                # just skip devices that are not replying in time
                print("Timeout for '%s'. Skipping." % dev.location)

        return filtered_devices
718584
public static void getTo(
                    final URL from_url,
                    final Writer to_writer,
                    final List<MediaType> accept_media_types
                    )
    {
        _LOG_.debug( "HTTP GET: from URL=" + from_url + ", accept=" + accept_media_types );

        AcceptHeaderRequestCallback  callback =
                        new AcceptHeaderRequestCallback( accept_media_types );
        WriterResponseExtractor  extractor = new WriterResponseExtractor( to_writer );
        _execute( from_url, HttpMethod.GET, callback, extractor );
    }
113074
public ArrayList getAllPubSubOutputHandlerMatchTargets()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getAllPubSubOutputHandlerMatchTargets");

    ArrayList outputHandlerList;

    // Get from the HashMap, with synch, there may be other accessors
    synchronized(_targets)
    {
      outputHandlerList = new ArrayList(_targets.size());
      Iterator itr = _targets.keySet().iterator();

      while (itr.hasNext())
      {
        Object key = itr.next();

        if (key instanceof ControllableProxySubscription)
          outputHandlerList.add(
            ((ControllableProxySubscription) key).getOutputHandler());

      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(
        tc,
        "getAllPubSubOutputHandlerMatchTargets",
        outputHandlerList);

    return outputHandlerList;
  }
46929
public List getReceivers() {
		ArrayList result = new ArrayList();
		synchronized (attributes) {
			Iterator i = attributes.values().iterator();
			while (i.hasNext()) {
				Object o = i.next();
				if (o instanceof ReceiverQueue) {
					result.add(o);
				}
			}
		}
		return result;
	}
565017
def _get_chromecast_from_host(host, tries=None, retry_wait=None, timeout=None,
                              blocking=True):
    """"""
    # Build device status from the mDNS info, this information is
    # the primary source and the remaining will be fetched
    # later on.
    ip_address, port, uuid, model_name, friendly_name = host
    _LOGGER.debug("_get_chromecast_from_host %s", host)
    cast_type = CAST_TYPES.get(model_name.lower(),
                               CAST_TYPE_CHROMECAST)
    device = DeviceStatus(
        friendly_name=friendly_name, model_name=model_name,
        manufacturer=None, uuid=uuid, cast_type=cast_type,
    )
    return Chromecast(host=ip_address, port=port, device=device, tries=tries,
                      timeout=timeout, retry_wait=retry_wait,
                      blocking=blocking)
1032248
def _get_receivers(self, sender):
        '''  '''
        key = _make_id(sender)
        receivers = []
        for (receiver_key, sender_key), receiver in self.receivers.items():
            if sender_key == key:
                receivers.append(receiver)
        return receivers
948600
protected List<String> getEndpointUris() throws AdapterException {
        List<String> urlmap = new ArrayList<String>();
        try {
            String map = getAttributeValue(ENDPOINT_URI);
            List<String[]> urlmaparray;
            if (map==null)
                urlmaparray = new ArrayList<String[]>();
                else
                    urlmaparray = StringHelper.parseTable(map, ',', ';', 1);

            for (String[] entry : urlmaparray)
                urlmap.add(getValueSmart(entry[0], ""));
        }
        catch (Exception ex) {
            throw new AdapterException(-1, ex.getMessage(), ex);
        }
        return urlmap;
    }
714474
def _get_receiver_name(self):
        """"""
        # If name is not set yet, get it from Main Zone URL
        if self._name is None and self._urls.mainzone is not None:
            name_tag = {"FriendlyName": None}
            try:
                root = self.get_status_xml(self._urls.mainzone)
            except (ValueError,
                    requests.exceptions.RequestException):
                _LOGGER.warning("Receiver name could not be determined. "
                                "Using standard name: Denon AVR.")
                self._name = "Denon AVR"
            else:
                # Get the tags from this XML
                name_tag = self._get_status_from_xml_tags(root, name_tag)
                if name_tag:
                    _LOGGER.warning("Receiver name could not be determined. "
                                    "Using standard name: Denon AVR.")
                    self._name = "Denon AVR"
824996
def get(provider_name, node_type_name)
      name = "#{provider_name}/#{node_type_name}/"
      response = http_get(resource_url(name))
      format_object(response, TYPE)
    end
126704
def get(self, request, bot_id, id, format=None):
        
        return super(SourceStateList, self).get(request, bot_id, id, format)
1279916
def receiver(self):
        """"""
        try:
            return current_webhooks.receivers[self.receiver_id]
        except KeyError:
            raise ReceiverDoesNotExist(self.receiver_id)
865209
def get_interfaces(self):
        
        interfaces = self.xml.find('devices').iter('interface')
        iobjs = []
        for interface in interfaces:
            _type = interface.attrib['type']
            mac = interface.find('mac').attrib['address']
            source = interface.find('source').attrib[_type]
            model = interface.find('model').attrib['type']
            iobjs.append(NetworkInterface(_type, mac, source, model))
        return iobjs
1350001
function getSource(url) {
        if (typeof url !== 'string') {
            return [];
        }

        if (!_has(sourceCache, url)) {
            // URL needs to be able to fetched within the acceptable domain.  Otherwise,
            // cross-domain errors will be triggered.
            /*
                Regex matches:
                0 - Full Url
                1 - Protocol
                2 - Domain
                3 - Port (Useful for internal applications)
                4 - Path
            */
            var source = '';
            var domain = '';
            try { domain = window.document.domain; } catch (e) { }
            var match = /(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(url);
            if (match && match[2] === domain) {
                source = loadSource(url);
            }
            sourceCache[url] = source ? source.split('\n') : [];
        }

        return sourceCache[url];
    }
633647
def _proxy_addr(self):
        
        proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy
        proxy_port = proxy_port or DEFAULT_PORTS.get(proxy_type)
        if not proxy_port:
            raise GeneralProxyError("Invalid proxy type")
        return proxy_addr, proxy_port