2323"""
2424
2525import re
26+ from collections .abc import Generator , Iterable
2627from datetime import datetime
2728from enum import Enum
2829from functools import reduce
2930from json import loads as json_loads
30- from typing import Any , Dict , FrozenSet , Generator , Iterable , List , Optional , Tuple , Type , Union
31+ from typing import Any , Optional , Union
3132from urllib .parse import quote as url_quote
3233from uuid import UUID
3334from warnings import warn
@@ -280,7 +281,7 @@ class HashAlgorithm(str, Enum):
280281class _HashTypeRepositorySerializationHelper (serializable .helpers .BaseHelper ):
281282 """ THIS CLASS IS NON-PUBLIC API """
282283
283- __CASES : Dict [ Type [serializable .ViewType ], FrozenSet [HashAlgorithm ]] = dict ()
284+ __CASES : dict [ type [serializable .ViewType ], frozenset [HashAlgorithm ]] = dict ()
284285 __CASES [SchemaVersion1Dot0 ] = frozenset ({
285286 HashAlgorithm .MD5 ,
286287 HashAlgorithm .SHA_1 ,
@@ -304,7 +305,7 @@ class _HashTypeRepositorySerializationHelper(serializable.helpers.BaseHelper):
304305 __CASES [SchemaVersion1Dot6 ] = __CASES [SchemaVersion1Dot5 ]
305306
306307 @classmethod
307- def __prep (cls , hts : Iterable ['HashType' ], view : Type [serializable .ViewType ]) -> Generator ['HashType' , None , None ]:
308+ def __prep (cls , hts : Iterable ['HashType' ], view : type [serializable .ViewType ]) -> Generator ['HashType' , None , None ]:
308309 cases = cls .__CASES .get (view , ())
309310 for ht in hts :
310311 if ht .alg in cases :
@@ -315,8 +316,8 @@ def __prep(cls, hts: Iterable['HashType'], view: Type[serializable.ViewType]) ->
315316
316317 @classmethod
317318 def json_normalize (cls , o : Iterable ['HashType' ], * ,
318- view : Optional [Type [serializable .ViewType ]],
319- ** __ : Any ) -> List [Any ]:
319+ view : Optional [type [serializable .ViewType ]],
320+ ** __ : Any ) -> list [Any ]:
320321 assert view is not None
321322 return [
322323 json_loads (
@@ -328,7 +329,7 @@ def json_normalize(cls, o: Iterable['HashType'], *,
328329 @classmethod
329330 def xml_normalize (cls , o : Iterable ['HashType' ], * ,
330331 element_name : str ,
331- view : Optional [Type [serializable .ViewType ]],
332+ view : Optional [type [serializable .ViewType ]],
332333 xmlns : Optional [str ],
333334 ** __ : Any ) -> XmlElement :
334335 assert view is not None
@@ -342,7 +343,7 @@ def xml_normalize(cls, o: Iterable['HashType'], *,
342343
343344 @classmethod
344345 def json_denormalize (cls , o : Any ,
345- ** __ : Any ) -> List ['HashType' ]:
346+ ** __ : Any ) -> list ['HashType' ]:
346347 return [
347348 HashType .from_json ( # type:ignore[attr-defined]
348349 ht ) for ht in o
@@ -351,14 +352,14 @@ def json_denormalize(cls, o: Any,
351352 @classmethod
352353 def xml_denormalize (cls , o : 'XmlElement' , * ,
353354 default_ns : Optional [str ],
354- ** __ : Any ) -> List ['HashType' ]:
355+ ** __ : Any ) -> list ['HashType' ]:
355356 return [
356357 HashType .from_xml ( # type:ignore[attr-defined]
357358 ht , default_ns ) for ht in o
358359 ]
359360
360361
361- _MAP_HASHLIB : Dict [str , HashAlgorithm ] = {
362+ _MAP_HASHLIB : dict [str , HashAlgorithm ] = {
362363 # from hashlib.algorithms_guaranteed
363364 'md5' : HashAlgorithm .MD5 ,
364365 'sha1' : HashAlgorithm .SHA_1 ,
@@ -593,7 +594,7 @@ class ExternalReferenceType(str, Enum):
593594class _ExternalReferenceSerializationHelper (serializable .helpers .BaseHelper ):
594595 """ THIS CLASS IS NON-PUBLIC API """
595596
596- __CASES : Dict [ Type [serializable .ViewType ], FrozenSet [ExternalReferenceType ]] = dict ()
597+ __CASES : dict [ type [serializable .ViewType ], frozenset [ExternalReferenceType ]] = dict ()
597598 __CASES [SchemaVersion1Dot1 ] = frozenset ({
598599 ExternalReferenceType .VCS ,
599600 ExternalReferenceType .ISSUE_TRACKER ,
@@ -649,7 +650,7 @@ class _ExternalReferenceSerializationHelper(serializable.helpers.BaseHelper):
649650 }
650651
651652 @classmethod
652- def __normalize (cls , extref : ExternalReferenceType , view : Type [serializable .ViewType ]) -> str :
653+ def __normalize (cls , extref : ExternalReferenceType , view : type [serializable .ViewType ]) -> str :
653654 return (
654655 extref
655656 if extref in cls .__CASES .get (view , ())
@@ -658,14 +659,14 @@ def __normalize(cls, extref: ExternalReferenceType, view: Type[serializable.View
658659
659660 @classmethod
660661 def json_normalize (cls , o : Any , * ,
661- view : Optional [Type [serializable .ViewType ]],
662+ view : Optional [type [serializable .ViewType ]],
662663 ** __ : Any ) -> str :
663664 assert view is not None
664665 return cls .__normalize (o , view )
665666
666667 @classmethod
667668 def xml_normalize (cls , o : Any , * ,
668- view : Optional [Type [serializable .ViewType ]],
669+ view : Optional [type [serializable .ViewType ]],
669670 ** __ : Any ) -> str :
670671 assert view is not None
671672 return cls .__normalize (o , view )
@@ -703,7 +704,7 @@ class XsUri(serializable.helpers.BaseHelper):
703704 )
704705
705706 @staticmethod
706- def __spec_replace (v : str , r : Tuple [str , str ]) -> str :
707+ def __spec_replace (v : str , r : tuple [str , str ]) -> str :
707708 return v .replace (* r )
708709
709710 @classmethod
0 commit comments