/
githubmirror
/
rdma-core
Обзор
Документация
Войти
/
githubmirror
/
rdma-core
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pyverbs/examples/ib_devices.py
21 строка
670 B
Benjamin Drung
pyverbs: Add shebang to ib_devices.py example
24 янв 2019, 15:41
24 янв 2019, 15:41
07ff3d4
Код
Авторство
О чём код?
#!/usr/bin/env python3 # SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) # Copyright (c) 2018, Mellanox Technologies. All rights reserved. See COPYING file from pyverbs import device as d import sys lst = d.get_device_list() dev = 'Device' node = 'Node Type' trans = 'Transport Type' guid = 'Node GUID' print_format = '{:^20}{:^20}{:^20}{:^20}' print (print_format.format(dev, node, trans, guid)) print (print_format.format('-'*len(dev), '-'*len(node), '-'*len(trans), '-'*len(guid))) for i in lst: print (print_format.format(i.name.decode(), d.translate_node_type(i.node_type), d.translate_transport_type(i.transport_type), d.guid_to_hex(i.guid)))