1212import re
1313from binascii import b2a_base64
1414from email .errors import HeaderParseError
15- from typing import Any , Dict , Iterator , List , Optional , Tuple , Type , Union
15+ from typing import Any , Dict , Iterator , List , Optional , Tuple , Type
1616
1717from httoop .exceptions import InvalidHeader
1818from httoop .six import with_metaclass
@@ -57,10 +57,10 @@ def __init__(self, value: str, params: Optional[Any] = None) -> None:
5757 def sanitize (self ) -> None :
5858 pass
5959
60- def __lt__ (self , other : Union [ str ] ) -> bool :
60+ def __lt__ (self , other : str ) -> bool :
6161 return self .value < getattr (other , 'value' , other )
6262
63- def __gt__ (self , other : Union [ str ] ) -> bool :
63+ def __gt__ (self , other : str ) -> bool :
6464 return self .value > getattr (other , 'value' , other )
6565
6666 def __eq__ (self , other : Any ) -> bool :
@@ -86,7 +86,7 @@ def compose(self) -> bytes:
8686 return b'%s%s' % (self .encode_rfc2047 (self .value ), b'' .join (params ))
8787
8888 @classmethod
89- def parseparams (cls , elementstr : bytes ) -> Union [ Tuple [bytes , Dict [bytes , str ]], Tuple [bytes , Dict [Any , Any ] ]]:
89+ def parseparams (cls , elementstr : bytes ) -> Tuple [bytes , Dict [bytes , str ]] | Tuple [bytes , Dict [Any , Any ]]:
9090 """Transform 'token;key=val' to ('token', {'key': 'val'})."""
9191 # Split the element into a value and parameters. The 'value' may
9292 # be of the form, "token=token", but we don't split that here.
@@ -200,7 +200,7 @@ def merge(cls, elements: List, others: List) -> bytes:
200200 return cls .join ([bytes (x ) for x in cls .sorted (elements + others )])
201201
202202 @classmethod
203- def formatparam (cls , param : bytes , value : Optional [Union [ bytes , str ] ] = None , quote : bool = False ) -> bytes :
203+ def formatparam (cls , param : bytes , value : Optional [bytes | str ] = None , quote : bool = False ) -> bytes :
204204 """
205205 Convenience function to format and return a key=value pair.
206206
@@ -367,7 +367,7 @@ def __eq__(self, other: str) -> bool:
367367 other = _AcceptElement (other )
368368 return other .value == self .value and other .quality == self .quality
369369
370- def __lt__ (self , other : Union [ str ] ) -> bool :
370+ def __lt__ (self , other : str ) -> bool :
371371 if not isinstance (other , _AcceptElement ):
372372 other = _AcceptElement (other )
373373 if self .quality == other .quality :
0 commit comments