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

Before Change


            nmap.run()

            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",
                                  parse_exc.msg)
                    self.last_results = []
                    return False

            else:
                self.last_results = []
                _LOGGER.error(nmap.stderr)
                return False

After Change


            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: 5

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: tyarkoni/pliers
Commit Name: 8be8a8a2403d10fde3e6e44344cbf021bcef1fa9
Time: 2018-03-05
Author: quinten.mcnamara@gmail.com
File Name: pliers/stimuli/api.py
Class Name: TweetStimFactory
Method Name: validate_keys


Project Name: snorkel-team/snorkel
Commit Name: 958c796ba3a6fb884eb5a4a1a830f7c810c0c408
Time: 2016-12-08
Author: ajratner@gmail.com
File Name: snorkel/viewer.py
Class Name: Viewer
Method Name: __init__