def extensions(self, value): if isinstance(value, Extensions): self._extensions = value elif value is None: self._extensions = Extensions() else: try: self._extensions = Extensions(value) except Exception: raise TypeError( f"Property 'extensions' in a 'tincan.{self.__class__.__name__}'" f" object must be set with a " f"tincan.Extensions, dict, or None.\n\n")
def extensions(self, value): if isinstance(value, Extensions): self._extensions = value elif value is None: self._extensions = Extensions() else: try: self._extensions = Extensions(value) except Exception as e: msg = ( "Property 'extensions' in a 'tincan.%s' object must be set with a " "tincan.Extensions, dict, or None.\n\n" % self.__class__.__name__, ) msg += e.message raise TypeError(msg)
def extensions(self, value): if value is None or isinstance(value, Extensions): self._extensions = value return try: self._extensions = Extensions(value) except Exception as e: e_type = ValueError if isinstance(value, dict) else TypeError raise e_type( f"Property 'extensions' in 'tincan.{self.__class__.__name__}' object: could not create a" f" 'tincan.Extensions' object from value: {repr(value)}\n\n{repr(e)}" )
def extensions(self, value): if value is None or isinstance(value, Extensions): self._extensions = value return try: self._extensions = Extensions(value) except Exception as e: msg = ( "Property 'extensions' in 'tincan.%s' object: could not create a" " 'tincan.Extensions' object from value: %s\n\n" % (self.__class__.__name__, repr(value))) msg += e.message e_type = ValueError if isinstance(value, dict) else TypeError raise e_type(msg)
def extensions(self, value): if value is not None and not isinstance(value, Extensions): value = Extensions(value) self._extensions = value