bfb5089ed59f1df8cf53a3b517ac6b091f539a26,homeassistant/components/device_tracker/nmap_tracker.py,NmapDeviceScanner,_update_info,#NmapDeviceScanner#,81

Before Change



            if nmap.rc == 0:
                try:
                    results = NmapParser.parse(nmap.stdout)
                    self.last_results = []
                    for host in results.hosts:
                        if host.is_up():
                            if host.hostnames:
                                name = host.hostnames[0]
                            else:
                                name = host.ipv4
                            if host.mac:
                                mac = host.mac
                            else:
                                mac = _arp(host.ipv4)
                            if mac:
                                device = Device(mac, name)
                                self.last_results.append(device)
                    _LOGGER.info("nmap scan successful")
                    return True
                except NmapParserException as parse_exc:
                    _LOGGER.error("failed to parse nmap results: %s",

After Change


            exclude_targets = set()
            if self.home_interval:
                now = datetime.now()
                for host in self.last_results:
                    if host.last_update + self.home_interval > now:
                        exclude_targets.add(host)
                if len(exclude_targets) > 0:
                    target_list = [t.ip for t in exclude_targets]
                    options += " --exclude {}".format(",".join(target_list))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: home-assistant/home-assistant
Commit Name: bfb5089ed59f1df8cf53a3b517ac6b091f539a26
Time: 2015-03-08
Author: andyt05@gmail.com
File Name: homeassistant/components/device_tracker/nmap_tracker.py
Class Name: NmapDeviceScanner
Method Name: _update_info


Project Name: pantsbuild/pants
Commit Name: 91d4af0d59877cdc19b76854f3c90ed0341a367e
Time: 2019-12-10
Author: john.sirois@gmail.com
File Name: src/python/pants/backend/python/subsystems/pex_build_util.py
Class Name: PexBuilderWrapper
Method Name: add_resolved_requirements


Project Name: senarvi/theanolm
Commit Name: 1167a9006becd15490004c167ac8eab22521513a
Time: 2017-10-16
Author: seppo.git@marjaniemi.com
File Name: theanolm/network/additionlayer.py
Class Name: AdditionLayer
Method Name: create_structure