@@ -226,7 +226,7 @@ def __repr__(self) -> str:
226226
227227
228228class RelativeDistinguishedName :
229- def __init__ (self , attributes : Iterable [NameAttribute ]):
229+ def __init__ (self , attributes : Iterable [NameAttribute [ str | bytes ] ]):
230230 attributes = list (attributes )
231231 if not attributes :
232232 raise ValueError ("a relative distinguished name cannot be empty" )
@@ -269,7 +269,7 @@ def __eq__(self, other: object) -> bool:
269269 def __hash__ (self ) -> int :
270270 return hash (self ._attribute_set )
271271
272- def __iter__ (self ) -> Iterator [NameAttribute ]:
272+ def __iter__ (self ) -> Iterator [NameAttribute [ str | bytes ] ]:
273273 return iter (self ._attributes )
274274
275275 def __len__ (self ) -> int :
@@ -281,7 +281,9 @@ def __repr__(self) -> str:
281281
282282class Name :
283283 @typing .overload
284- def __init__ (self , attributes : Iterable [NameAttribute ]) -> None : ...
284+ def __init__ (
285+ self , attributes : Iterable [NameAttribute [str | bytes ]]
286+ ) -> None : ...
285287
286288 @typing .overload
287289 def __init__ (
@@ -290,7 +292,9 @@ def __init__(
290292
291293 def __init__ (
292294 self ,
293- attributes : Iterable [NameAttribute | RelativeDistinguishedName ],
295+ attributes : Iterable [
296+ NameAttribute [str | bytes ] | RelativeDistinguishedName
297+ ],
294298 ) -> None :
295299 attributes = list (attributes )
296300 if all (isinstance (x , NameAttribute ) for x in attributes ):
@@ -358,7 +362,7 @@ def __hash__(self) -> int:
358362 # for you, consider optimizing!
359363 return hash (tuple (self ._attributes ))
360364
361- def __iter__ (self ) -> Iterator [NameAttribute ]:
365+ def __iter__ (self ) -> Iterator [NameAttribute [ str | bytes ] ]:
362366 for rdn in self ._attributes :
363367 yield from rdn
364368
@@ -454,7 +458,7 @@ def _parse_rdn(self) -> RelativeDistinguishedName:
454458
455459 return RelativeDistinguishedName (nas )
456460
457- def _parse_na (self ) -> NameAttribute :
461+ def _parse_na (self ) -> NameAttribute [ str ] :
458462 try :
459463 oid_value = self ._read_re (self ._OID_RE )
460464 except ValueError :
0 commit comments