3434class Item :
3535 """Base item class."""
3636
37- types : typing .Sequence [typing . Type [openhab .command_types .CommandType ]] = []
38- state_types : typing .Sequence [typing . Type [openhab .command_types .CommandType ]] = []
39- command_event_types : typing .Sequence [typing . Type [openhab .command_types .CommandType ]] = []
40- state_event_types : typing .Sequence [typing . Type [openhab .command_types .CommandType ]] = []
41- state_changed_event_types : typing .Sequence [typing . Type [openhab .command_types .CommandType ]] = []
37+ types : typing .Sequence [type [openhab .command_types .CommandType ]] = []
38+ state_types : typing .Sequence [type [openhab .command_types .CommandType ]] = []
39+ command_event_types : typing .Sequence [type [openhab .command_types .CommandType ]] = []
40+ state_event_types : typing .Sequence [type [openhab .command_types .CommandType ]] = []
41+ state_changed_event_types : typing .Sequence [type [openhab .command_types .CommandType ]] = []
4242
4343 TYPENAME = 'unknown'
4444
@@ -144,7 +144,7 @@ def unit_of_measure(self) -> str:
144144 return self ._unitOfMeasure
145145
146146 @property
147- def members (self ) -> typing . Dict [str , typing .Any ]:
147+ def members (self ) -> dict [str , typing .Any ]:
148148 """If item is a type of Group, it will return all member items for this group.
149149
150150 For none group item empty dictionary will be returned.
@@ -155,7 +155,7 @@ def members(self) -> typing.Dict[str, typing.Any]:
155155 """
156156 return self ._members
157157
158- def _validate_value (self , value : typing .Union [str , typing . Type [openhab .command_types .CommandType ]]) -> None :
158+ def _validate_value (self , value : typing .Union [str , type [openhab .command_types .CommandType ]]) -> None :
159159 """Private method for verifying the new value before modifying the state of the item."""
160160 if self .type_ == 'String' :
161161 if not isinstance (value , (str , bytes )):
@@ -176,7 +176,7 @@ def _validate_value(self, value: typing.Union[str, typing.Type[openhab.command_t
176176 else :
177177 raise ValueError
178178
179- def _parse_rest (self , value : str ) -> typing . Tuple [str , str ]:
179+ def _parse_rest (self , value : str ) -> tuple [str , str ]:
180180 """Parse a REST result into a native object."""
181181 return value , ''
182182
@@ -289,7 +289,7 @@ def persistence(
289289 page : int = 0 ,
290290 page_length : int = 0 ,
291291 boundary : bool = False ,
292- ) -> typing .Iterator [typing . Dict [str , typing .Union [str , int ]]]:
292+ ) -> typing .Iterator [dict [str , typing .Union [str , int ]]]:
293293 """Method for fetching persistence data for a given item.
294294
295295 Args:
@@ -321,8 +321,8 @@ class GroupItem(Item):
321321 """String item type."""
322322
323323 TYPENAME = 'Group'
324- types : typing . List [ typing . Type [openhab .command_types .CommandType ]] = []
325- state_types : typing . List [ typing . Type [openhab .command_types .CommandType ]] = []
324+ types : list [ type [openhab .command_types .CommandType ]] = []
325+ state_types : list [ type [openhab .command_types .CommandType ]] = []
326326
327327
328328class StringItem (Item ):
@@ -382,7 +382,7 @@ def __ne__(self, other: object) -> bool:
382382
383383 return not self .__eq__ (other )
384384
385- def _parse_rest (self , value : str ) -> typing . Tuple [datetime .datetime , str ]: # type: ignore[override]
385+ def _parse_rest (self , value : str ) -> tuple [datetime .datetime , str ]: # type: ignore[override]
386386 """Parse a REST result into a native object.
387387
388388 Args:
@@ -470,7 +470,7 @@ class NumberItem(Item):
470470 types = [openhab .command_types .DecimalType ]
471471 state_types = types
472472
473- def _parse_rest (self , value : str ) -> typing . Tuple [typing .Union [float , None ], str ]: # type: ignore[override]
473+ def _parse_rest (self , value : str ) -> tuple [typing .Union [float , None ], str ]: # type: ignore[override]
474474 """Parse a REST result into a native object.
475475
476476 Args:
@@ -499,7 +499,7 @@ def _parse_rest(self, value: str) -> typing.Tuple[typing.Union[float, None], str
499499
500500 raise ValueError (f'{ self .__class__ } : unable to parse value "{ value } "' )
501501
502- def _rest_format (self , value : typing .Union [float , typing . Tuple [float , str ], str ]) -> typing .Union [str , bytes ]:
502+ def _rest_format (self , value : typing .Union [float , tuple [float , str ], str ]) -> typing .Union [str , bytes ]:
503503 """Format a value before submitting to openHAB.
504504
505505 Args:
@@ -545,7 +545,7 @@ class DimmerItem(Item):
545545 types = [openhab .command_types .OnOffType , openhab .command_types .PercentType , openhab .command_types .IncreaseDecreaseType ]
546546 state_types = [openhab .command_types .PercentType ]
547547
548- def _parse_rest (self , value : str ) -> typing . Tuple [float , str ]: # type: ignore[override]
548+ def _parse_rest (self , value : str ) -> tuple [float , str ]: # type: ignore[override]
549549 """Parse a REST result into a native object.
550550
551551 Args:
@@ -595,7 +595,7 @@ class ColorItem(DimmerItem):
595595 types = [openhab .command_types .OnOffType , openhab .command_types .PercentType , openhab .command_types .IncreaseDecreaseType , openhab .command_types .ColorType ]
596596 state_types = [openhab .command_types .ColorType ]
597597
598- def _parse_rest (self , value : str ) -> typing . Tuple [typing .Optional [typing . Tuple [float , float , float ]], str ]: # type: ignore[override]
598+ def _parse_rest (self , value : str ) -> tuple [typing .Optional [tuple [float , float , float ]], str ]: # type: ignore[override]
599599 """Parse a REST result into a native object.
600600
601601 Args:
@@ -608,7 +608,7 @@ def _parse_rest(self, value: str) -> typing.Tuple[typing.Optional[typing.Tuple[f
608608 result = openhab .command_types .ColorType .parse (value )
609609 return result , ''
610610
611- def _rest_format (self , value : typing .Union [typing . Tuple [int , int , float ], str , int ]) -> str :
611+ def _rest_format (self , value : typing .Union [tuple [int , int , float ], str , int ]) -> str :
612612 """Format a value before submitting to openHAB.
613613
614614 Args:
@@ -634,7 +634,7 @@ class RollershutterItem(Item):
634634 types = [openhab .command_types .UpDownType , openhab .command_types .PercentType , openhab .command_types .StopMoveType ]
635635 state_types = [openhab .command_types .PercentType ]
636636
637- def _parse_rest (self , value : str ) -> typing . Tuple [int , str ]: # type: ignore[override]
637+ def _parse_rest (self , value : str ) -> tuple [int , str ]: # type: ignore[override]
638638 """Parse a REST result into a native object.
639639
640640 Args:
@@ -680,7 +680,7 @@ class LocationItem(Item):
680680 types = [openhab .command_types .PointType ]
681681 state_types = [openhab .command_types .PointType ]
682682
683- def _parse_rest (self , value : str ) -> typing . Tuple [typing .Optional [typing . Tuple [float , float , float ]], str ]: # type: ignore[override]
683+ def _parse_rest (self , value : str ) -> tuple [typing .Optional [tuple [float , float , float ]], str ]: # type: ignore[override]
684684 """Parse a REST result into a native object.
685685
686686 Args:
@@ -692,7 +692,7 @@ def _parse_rest(self, value: str) -> typing.Tuple[typing.Optional[typing.Tuple[f
692692 """
693693 return openhab .command_types .PointType .parse (value ), ''
694694
695- def _rest_format (self , value : typing .Union [typing . Tuple [float , float , float ], str ]) -> str :
695+ def _rest_format (self , value : typing .Union [tuple [float , float , float ], str ]) -> str :
696696 """Format a value before submitting to openHAB.
697697
698698 Args:
0 commit comments