8d34b76d510c64eaf1fea257260d11ec5a206478,homeassistant/components/device_tracker/asuswrt.py,AsusWrtDeviceScanner,get_asuswrt_data,#AsusWrtDeviceScanner#,103

Before Change


    def get_asuswrt_data(self):
        Retrieve data from ASUSWRT and return parsed result.
        from pexpect import pxssh
        try:
            ssh = pxssh.pxssh()
            ssh.login(self.host, self.username, self.password)
            ssh.sendline("ip neigh")
            ssh.prompt()
            neighbors = ssh.before.split(b"\n")[1:-1]
            ssh.sendline("cat /var/lib/misc/dnsmasq.leases")
            ssh.prompt()
            leases_result = ssh.before.split(b"\n")[1:-1]
            ssh.logout()
        except pxssh.ExceptionPxssh as exc:
            _LOGGER.exception("Unexpected response from router: %s", exc)
            return

        devices = {}
        for lease in leases_result:
            match = _LEASES_REGEX.search(lease.decode("utf-8"))

After Change



    def get_asuswrt_data(self):
        Retrieve data from ASUSWRT and return parsed result.
        if self.protocol == "telnet":
            neighbors, leases_result = self.telnet_connection()
        else:
            neighbors, leases_result = self.ssh_connection()

        devices = {}
        for lease in leases_result:
            match = _LEASES_REGEX.search(lease.decode("utf-8"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: home-assistant/home-assistant
Commit Name: 8d34b76d510c64eaf1fea257260d11ec5a206478
Time: 2016-05-17
Author: brian.lenihan@gmail.com
File Name: homeassistant/components/device_tracker/asuswrt.py
Class Name: AsusWrtDeviceScanner
Method Name: get_asuswrt_data


Project Name: home-assistant/home-assistant
Commit Name: 35f0270688d2bd1e31e45ebbc1771f1ff940bff6
Time: 2015-07-16
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/components/sun.py
Class Name:
Method Name: setup


Project Name: home-assistant/home-assistant
Commit Name: 9f54bcc21b1744f2850a35e54903f3581d14badb
Time: 2015-12-23
Author: marhje52@kth.se
File Name: homeassistant/components/mysensors.py
Class Name:
Method Name: setup


Project Name: home-assistant/home-assistant
Commit Name: ecc249aa27a8177ba2a9050465fd35319f7e1b24
Time: 2017-08-18
Author: mezz@johnmihalic.com
File Name: homeassistant/components/sensor/usps.py
Class Name:
Method Name: setup_platform