mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import os
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsLessThanT
|
||||
from typing import List, Sequence, Tuple, Union, overload
|
||||
from typing import List, Sequence, Tuple, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
# All overloads can return empty string. Ideally, Literal[""] would be a valid
|
||||
# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return
|
||||
# Iterable[T], so that List[T] | Literal[""] could be used as a return
|
||||
# type. But because this only works when T is str, we need Sequence[T] instead.
|
||||
@overload
|
||||
def commonprefix(m: Sequence[StrPath]) -> str: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ...
|
||||
def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user