Return our interface object with given string name, default intf if name is falsy (None, empty string, etc). or the input intf arg. Having this fcn return its arg for Intf objects makes it easier to construct functions with flexible input args for inter
( self, intf=None )
| 483 | return None |
| 484 | |
| 485 | def intf( self, intf=None ): |
| 486 | """Return our interface object with given string name, |
| 487 | default intf if name is falsy (None, empty string, etc). |
| 488 | or the input intf arg. |
| 489 | |
| 490 | Having this fcn return its arg for Intf objects makes it |
| 491 | easier to construct functions with flexible input args for |
| 492 | interfaces (those that accept both string names and Intf objects). |
| 493 | """ |
| 494 | if not intf: |
| 495 | return self.defaultIntf() |
| 496 | elif isinstance( intf, BaseString): |
| 497 | return self.nameToIntf[ intf ] |
| 498 | else: |
| 499 | return intf |
| 500 | |
| 501 | def connectionsTo( self, node): |
| 502 | "Return [ intf1, intf2... ] for all intfs that connect self to node." |