(self, key, value)
return "'{}': {}".format(key, displayed.replace('\x00', ''))
Display a dictionary of OID results with indexes.

        This is tailored made for the structure we build for results in the check.

        Output:
            'ifInOctets: {'0': 3123, '1': 728}
Display a dictionary of OID results with indexes.
Display a dictionary of OID results with indexes .
def oid_dict(self, key, value):
        # type: (str, Dict[Any, Any]) -> str
        """Display a dictionary of OID results with indexes.

        This is tailored made for the structure we build for results in the check.

        Output:
            'ifInOctets: {'0': 3123, '1': 728}
        """
        values = []
        have_indexes = False
        for indexes, data in value.items():
            try:
                data = int(data)
            except (TypeError, ValueError):
                data = "'{}'".format(data)
            if indexes:
                values.append("'{}': {}".format('.'.join(indexes), data))
                have_indexes = True
            else:
                values.append(str(data))

        if not have_indexes:
            displayed = values[0]
        else:
            displayed = '{{{}}}'.format(', '.join(values))
        return "'{}': {}".format(key, displayed.replace('\x00', ''))
def oid_dict ( self , key , value ) : # type: (str, Dict[Any, Any]) -> str values = [ ] have_indexes = False for indexes , data in value . items ( ) : try : data = int ( data ) except ( TypeError , ValueError ) : data = "'{}'" . format ( data ) if indexes : values . append ( "'{}': {}" . format ( '.' . join ( indexes ) , data ) ) have_indexes = True else : values . append ( str ( data ) ) if not have_indexes : displayed = values [ 0 ] else : displayed = '{{{}}}' . format ( ', ' . join ( values ) ) return "'{}': {}" . format ( key , displayed . replace ( '\x00' , '' ) )