File: //opt/alt/python311/lib/python3.11/site-packages/pyroute2/ndb/__pycache__/report.cpython-311.pyc
�
�;ft/ � � � d Z ddlZddlZddlmZ ddlmZ dZdZdd�Z dd �Z
G d
� d� � Z G d� d
e� � Z
G d� de� � Z G d� de
� � ZdS )a�
.. note:: New in verision 0.5.11
.. testsetup::
from pyroute2 import NDB
ndb = NDB(sources=[{'target': 'localhost', 'kind': 'IPMock'}])
.. testcleanup:: *
for key, value in tuple(globals().items()):
if key.startswith('ndb') and hasattr(value, 'close'):
value.close()
Filtering example:
.. testcode::
report = ndb.interfaces.dump()
report.select_fields('index', 'ifname', 'address', 'state')
report.transform_fields(
address=lambda r: '%s%s.%s%s.%s%s' % tuple(r.address.split(':'))
)
for record in report.format('csv'):
print(record)
.. testoutput::
'index','ifname','address','state'
1,'lo','0000.0000.0000','up'
2,'eth0','5254.0072.58b2','up'
� N)�chain)�clii'