diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-06-16 21:23:31 -0400 |
---|---|---|
committer | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-06-17 01:56:06 +0000 |
commit | 8a2fa3b482b2f32da8e0b634fd09c9bdef2e9443 (patch) | |
tree | b785c5ae541f00418a2348b6233e227ccc4c66d4 /src/vpp-api/python/vpp_papi | |
parent | d67a428b3b2183cd78d7fca82e8afe2f26387810 (diff) |
misc: vpp-api - add __repr__ to VPPApiClient.
Show the constructor of the object instead of the memory location.
api client: <VPPApiClient apifiles=None, testmode=False,
async_thread=True, logger=<logging.Logger object at 0x7f35d1bd2590>,
read_timeout=1, use_socket=False,
server_address='/tmp/vpp-unittest-TestGbpApi-pOKbWg/api.sock'>
vs.
api client: <vpp_papi.vpp_papi.VPPApiClient object at 0x7fa0003df750>
Type: feature
Change-Id: I1460d76f6796776dd525c0844e9e426ec2d52398
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_papi.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py index 1f5cce23a79..78809653ddb 100644 --- a/src/vpp-api/python/vpp_papi/vpp_papi.py +++ b/src/vpp-api/python/vpp_papi/vpp_papi.py @@ -232,6 +232,10 @@ class VPPApiClient(object): self.read_timeout = read_timeout self.async_thread = async_thread self.event_thread = None + self.testmode = testmode + self.use_socket = use_socket + self.server_address = server_address + self._apifiles = apifiles if use_socket: from . vpp_transport_socket import VppTransport @@ -717,6 +721,15 @@ class VPPApiClient(object): if self.event_callback: self.event_callback(msgname, r) + def __repr__(self): + return "<VPPApiClient apifiles=%s, testmode=%s, async_thread=%s, " \ + "logger=%s, read_timeout=%s, use_socket=%s, " \ + "server_address='%s'>" % ( + self._apifiles, self.testmode, self.async_thread, + self.logger, self.read_timeout, self.use_socket, + self.server_address) + + # Provide the old name for backward compatibility. VPP = VPPApiClient |