From 020a36055abb64f611d2a06c006304e663b2661c Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 15 Jun 2017 14:56:49 +0200 Subject: prototypes: rlite: use isinstance() rather than type() This is convenient for compatibility between Python 2 and 3. --- rumba/prototypes/rlite.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index cc38255..abab080 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -70,11 +70,11 @@ class Experiment(mod.Experiment): for ipcp in node.ipcps: # Generate the command to create the IPCP - if type(ipcp.dif) is mod.NormalDIF: + if isinstance(ipcp.dif, mod.NormalDIF): ipcp_type = 'normal' - elif type(ipcp.dif) is mod.ShimEthDIF: + elif isinstance(ipcp.dif, mod.ShimEthDIF): ipcp_type = 'shim-eth' - elif type(ipcp.dif) is mod.ShimUDPDIF: + elif isinstance(ipcp.dif, mod.ShimUDPDIF): ipcp_type = 'shim-udp4' else: logger.warning( @@ -87,7 +87,7 @@ class Experiment(mod.Experiment): # Generate the command to configure the interface # name for the shim-eth - if type(ipcp.dif) is mod.ShimEthDIF: + if isinstance(ipcp.dif, mod.ShimEthDIF): cmds.append("rlite-ctl ipcp-config %s netdev %s" % (ipcp.name, ipcp.ifname)) -- cgit v1.2.3