1010import re
1111from collections .abc import Mapping , MutableMapping , Set
1212from pathlib import Path
13- from typing import Any , Final , Optional , TypeVar , final
13+ from typing import Any , Final , TypeVar , final
1414from urllib .parse import urlparse , urlunparse
1515
1616from fairseq2 .assets .error import AssetError
@@ -25,10 +25,10 @@ class AssetCard:
2525
2626 _name : str
2727 _metadata : MutableMapping [str , Any ]
28- _base : Optional [ AssetCard ]
28+ _base : AssetCard | None
2929
3030 def __init__ (
31- self , metadata : MutableMapping [str , Any ], base : Optional [ AssetCard ] = None
31+ self , metadata : MutableMapping [str , Any ], base : AssetCard | None = None
3232 ) -> None :
3333 """
3434 :param metadata:
@@ -143,7 +143,7 @@ def metadata(self) -> Mapping[str, Any]:
143143 return self ._metadata
144144
145145 @property
146- def base (self ) -> Optional [ AssetCard ] :
146+ def base (self ) -> AssetCard | None :
147147 """The card that this card derives from."""
148148 return self ._base
149149
@@ -187,7 +187,7 @@ def as_(
187187 type_hint : Any ,
188188 * ,
189189 allow_empty : bool = False ,
190- value_converter : Optional [ ValueConverter ] = None ,
190+ value_converter : ValueConverter | None = None ,
191191 set_empty : bool = False ,
192192 ) -> Any :
193193 """Return the value of this field.
@@ -297,10 +297,10 @@ def as_filename(self) -> str:
297297 def get_as_ (
298298 self ,
299299 type_hint : Any ,
300- default : Optional [ T ] = None ,
300+ default : T | None = None ,
301301 * ,
302302 allow_empty : bool = False ,
303- value_converter : Optional [ ValueConverter ] = None ,
303+ value_converter : ValueConverter | None = None ,
304304 set_empty : bool = False ,
305305 ) -> Any :
306306 """Return the value of this field if it exists; otherwise, return ``default``.
@@ -331,7 +331,7 @@ def set(
331331 value : Any ,
332332 * ,
333333 type_hint : Any = None ,
334- value_converter : Optional [ ValueConverter ] = None ,
334+ value_converter : ValueConverter | None = None ,
335335 ) -> None :
336336 """Set the value of this field.
337337
0 commit comments