def netstats():
    '''
    Return the network stats for this minion

    CLI Example:

    .. code-block:: bash

        salt '*' status.netstats
    '''
    def linux_netstats():
        '''
        freebsd specific netstats implementation
        '''
        procf = '/proc/net/netstat'
        if not os.path.isfile(procf):
            return {}
        stats = salt.utils.fopen(procf, 'r').read().splitlines()
        ret = {}
        headers = ['']
        for line in stats:
            if not line:
                continue
            comps = line.split()
            if comps[0] == headers[0]:
                index = 1 - len(headers)
                row = {}
                for field in range(index):
                    if field < 1:
                        continue
                    else:
                        row[headers[field]] = _number(comps[field])
                rowname = headers[0].replace(':', '')
                ret[rowname] = row
            else:
                headers = comps
        return ret

    def freebsd_netstats():
        '''
        freebsd specific netstats implementation
        '''
        ret = {}
        for line in __salt__['cmd.run']('netstat -s').splitlines():
            if line.startswith('\t\t'):
                continue  # Skip, too detailed
            if not line.startswith('\t'):
                key = line.split()[0]
                ret[key] = {}
            else:
                comps = line.split()
                if comps[0].isdigit():
                    ret[key][' '.join(comps[1:])] = comps[0]
        return ret

    # dict that returns a function that does the right thing per platform
    get_version = {
        'Linux': linux_netstats,
        'FreeBSD': freebsd_netstats,
    }

    errmsg = 'This method is unsupported on the current operating system!'
    return get_version.get(__grains__['kernel'], lambda: errmsg)()
dataset/ETHPy150Open saltstack/salt/salt/modules/status.py/netstats/swapped operands of `-`