String (hwx.inspire.Attributes)#

class String(default='', **kwds)#

Bases: Attribute

Store string value

Method Table#

Name

Description

castForSet (self, obj, value)

Converts and validates the specified string value before setting the value.

create (self, obj)

Creates a string attribute for the specified object.

Example

from hwx.inspire import *

class Message(GeneralObject):
text = String("Hello World")

message = Message()
print(message.text)
create(obj)#

Creates a string attribute for the specified object.

castForSet(obj, value)#

Converts and validates the specified string value before setting the value.

Parameters:
  • obj (GeneralObject) – Object this attribute belongs to.

  • value (str) – Value of the attribute to set.

Returns:

Validated and converted value.

Return type:

str

class Value(value, obj, attr)#

Bases: str