remotelogin/devices/properties.py
def _get_default_instance(self, cls, default_value):
        """ gets default instance for Interface, User or Tunnel given the provided value """

        if not default_value:
            return None

        manager_instance = getattr(self.manager, cls.NAME_IN_MANAGER)

        if isinstance(default_value, str):
            return manager_instance[default_value]

        if isinstance(default_value, dict):
            default_value = cls(**default_value)

        if isinstance(default_value, cls):
            if default_value not in manager_instance:
                manager_instance.add(default_value)
            elif default_value != manager_instance[default_value.name]:
                raise ValueError(
                    "This {item_name} ({name}) is already defined in the device but it has different attribute"
                    " values please define it correctly.".format(
                        item_name=cls.__name__, name=default_value.name
                    )
                )
            return default_value

        raise ValueError(
            "The value provided for {} cannot be converted to the proper class. Check attributes"
            "".format(cls.__name__)
        )
 gets default instance for Interface, User or Tunnel given the provided value 
gets default instance for Interface, User or Tunnel given the provided value
gets default instance for Interface User or Tunnel given the provided value
def _get_default_instance(self, cls, default_value):
        if not default_value:
            return None
        manager_instance = getattr(self.manager, cls.NAME_IN_MANAGER)
        if isinstance(default_value, str):
            return manager_instance[default_value]
        if isinstance(default_value, dict):
            default_value = cls(**default_value)
        if isinstance(default_value, cls):
            if default_value not in manager_instance:
                manager_instance.add(default_value)
            elif default_value != manager_instance[default_value.name]:
                raise ValueError(
                    "This {item_name} ({name}) is already defined in the device but it has different attribute"
                    " values please define it correctly.".format(
                        item_name=cls.__name__, name=default_value.name
                    )
                )
            return default_value
        raise ValueError(
            "The value provided for {} cannot be converted to the proper class. Check attributes"
            "".format(cls.__name__)
        )
def _get_default_instance ( self , cls , default_value ) : if not default_value : return None manager_instance = getattr ( self . manager , cls . NAME_IN_MANAGER ) if isinstance ( default_value , str ) : return manager_instance [ default_value ] if isinstance ( default_value , dict ) : default_value = cls ( ** default_value ) if isinstance ( default_value , cls ) : if default_value not in manager_instance : manager_instance . add ( default_value ) elif default_value != manager_instance [ default_value . name ] : raise ValueError ( "This {item_name} ({name}) is already defined in the device but it has different attribute" " values please define it correctly." . format ( item_name = cls . __name__ , name = default_value . name ) ) return default_value raise ValueError ( "The value provided for {} cannot be converted to the proper class. Check attributes" "" . format ( cls . __name__ ) )
gets default instance for Interface, User or Tunnel given the provided value
gets default instance for Interface User or Tunnel given the provided value
""" gets default instance for Interface, User or Tunnel given the provided value """
self
cls
default_value