Did I find the right examples for you? yes no

All Samples(32)  |  Call(32)  |  Derive(0)  |  Import(0)
Parse input string and return int, float or str depending on format.

@param val:       Input string.
@param parsebool: If True parse yes / no, on / off as boolean.
@return:          Value of type int, float or str.
    

        def parse_value(val, parsebool=False):
    """Parse input string and return int, float or str depending on format.
    
    @param val:       Input string.
    @param parsebool: If True parse yes / no, on / off as boolean.
    @return:          Value of type int, float or str.
        
    """
    try:
        return int(val)
    except ValueError:
        pass
    try:
        return float(val)
    except:
        pass
    if parsebool:
        if re.match('yes|on', str(val), re.IGNORECASE):
            return True
        elif re.match('no|off', str(val), re.IGNORECASE):
            return False
    return val
        


src/p/y/PyMunin-0.9.27/pysysinfo/memcached.py   PyMunin(Download)
            mobj = re.match('^STAT\s(\w+)\s(\S+)$',  line)
            if mobj:
                info_dict[mobj.group(1)] = util.parse_value(mobj.group(2), True)
                continue
            elif parse_slabs:
                    if not info_dict['slabs'].has_key(slab):
                        info_dict['slabs'][slab] = {}
                    info_dict['slabs'][slab][key] = util.parse_value(val, True)
        return info_dict
 

src/p/y/PyMunin-HEAD/pysysinfo/memcached.py   PyMunin(Download)
            mobj = re.match('^STAT\s(\w+)\s(\S+)$',  line)
            if mobj:
                info_dict[mobj.group(1)] = util.parse_value(mobj.group(2), True)
                continue
            elif parse_slabs:
                    if not info_dict['slabs'].has_key(slab):
                        info_dict['slabs'][slab] = {}
                    info_dict['slabs'][slab][key] = util.parse_value(val, True)
        return info_dict
 

src/p/y/PyMunin-0.9.27/pysysinfo/postgresql.py   PyMunin(Download)
        cur.execute(query)
        row = cur.fetchone()
        return util.parse_value(row[0])
 
    def getVersion(self):
        cur.execute("SHOW %s" % key)
        row = cur.fetchone()
        return util.parse_value(row[0])
 
    def getParams(self):
        for row in rows:
            key = row[0]
            val = util.parse_value(row[1])
            info_dict[key] = val
        return info_dict

src/p/y/PyMunin-HEAD/pysysinfo/postgresql.py   PyMunin(Download)
        cur.execute(query)
        row = cur.fetchone()
        return util.parse_value(row[0])
 
    def getVersion(self):
        cur.execute("SHOW %s" % key)
        row = cur.fetchone()
        return util.parse_value(row[0])
 
    def getParams(self):
        for row in rows:
            key = row[0]
            val = util.parse_value(row[1])
            info_dict[key] = val
        return info_dict

src/p/y/PyMunin-0.9.27/pysysinfo/nginx.py   PyMunin(Download)
                for key in ('accepts','handled','requests'):
                    idx += 1
                    self._statusDict[key] = util.parse_value(mobj.group(idx))
            else:
                for (key,val) in re.findall('(\w+):\s*(\d+)', line):
                    self._statusDict[key.lower()] = util.parse_value(val)

src/p/y/PyMunin-HEAD/pysysinfo/nginx.py   PyMunin(Download)
                for key in ('accepts','handled','requests'):
                    idx += 1
                    self._statusDict[key] = util.parse_value(mobj.group(idx))
            else:
                for (key,val) in re.findall('(\w+):\s*(\d+)', line):
                    self._statusDict[key.lower()] = util.parse_value(val)

src/p/y/PyMunin-0.9.27/pysysinfo/tomcat.py   PyMunin(Download)
        if node is not None:
            for (key,val) in node.items():
                memstats[key] = util.parse_value(val)
        return memstats
 
                                        stats[key] = float(val) / 1000.0
                                    else:
                                        stats[key] = util.parse_value(val)
                            if stats:
                                connstats[port][tag] = stats

src/p/y/PyMunin-HEAD/pysysinfo/tomcat.py   PyMunin(Download)
        if node is not None:
            for (key,val) in node.items():
                memstats[key] = util.parse_value(val)
        return memstats
 
                                        stats[key] = float(val) / 1000.0
                                    else:
                                        stats[key] = util.parse_value(val)
                            if stats:
                                connstats[port][tag] = stats

src/p/y/PyMunin-0.9.27/pysysinfo/varnish.py   PyMunin(Download)
            if mobj:
                fname = mobj.group(1).replace('.', '_')
                info_dict[fname] = util.parse_value(mobj.group(2))
                self._descDict[fname] = mobj.group(4)
        return info_dict

src/p/y/PyMunin-0.9.27/pysysinfo/phpfpm.py   PyMunin(Download)
            mobj = re.match('([\w\s]+):\s+(\w+)$', line)
            if mobj:
                stats[mobj.group(1)] = util.parse_value(mobj.group(2))
        return stats
 

  1 | 2  Next