44
55
66"""
7+ from __future__ import annotations
78
89import re
9- from typing import Union
1010from convex_api .key_pair import KeyPair
1111
1212
1313class Account :
1414
1515 @staticmethod
16- def is_address (text : Union [ int , str ] ) -> bool :
16+ def is_address (text : int | str ) -> bool :
1717 """
1818 Returns True if the text value is a valid address.
1919
@@ -25,9 +25,9 @@ def is_address(text: Union[int, str]) -> bool:
2525 return Account .to_address (text ) >= 0
2626
2727 @staticmethod
28- def to_address (value : Union [ ' Account' , int , str ] ) -> int :
28+ def to_address (value : Account | int | str ) -> int :
2929 """
30- Convert address text with possible leading '#' to an interger address value.
30+ Convert address text with possible leading '#' to an integer address value.
3131
3232 :param str text: Address text to convert
3333
@@ -47,7 +47,7 @@ def to_address(value: Union['Account', int, str]) -> int:
4747 raise ValueError (f'Invalid address { value } ' )
4848 return address
4949
50- def __init__ (self , key_pair : KeyPair , address : Union [ ' Account' , int , str ] , name : Union [ str , None ] = None ):
50+ def __init__ (self , key_pair : KeyPair , address : Account | int | str , name : str | None = None ):
5151 """
5252
5353 Create a new account with a private key KeyPair.
@@ -133,7 +133,7 @@ def address(self) -> int:
133133 return self ._address
134134
135135 @address .setter
136- def address (self , value : Union [ ' Account' , int , str ] ) -> None :
136+ def address (self , value : Account | int | str ) -> None :
137137 """
138138
139139 Sets the network address of this account
@@ -154,7 +154,7 @@ def address(self, value: Union['Account', int, str]) -> None:
154154 self ._address = Account .to_address (value )
155155
156156 @property
157- def name (self ) -> Union [ str , None ] :
157+ def name (self ) -> str | None :
158158 return self ._name
159159
160160 @name .setter
0 commit comments