mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Modernize syntax in various stubs (#7469)
Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
from typing import Text
|
||||
|
||||
class InvalidToken(Exception): ...
|
||||
|
||||
class Fernet:
|
||||
def __init__(self, key: bytes | Text) -> None: ...
|
||||
def __init__(self, key: bytes | str) -> None: ...
|
||||
def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ...
|
||||
# decrypt_at_time accepts None ttl at runtime but it's an implementtion detail and it doesn't really
|
||||
# make sense for the client code to use it like that, so the parameter is typed as int as opposed to
|
||||
|
||||
@@ -3,7 +3,7 @@ from _typeshed import Self
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from enum import Enum
|
||||
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
|
||||
from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, Text, TypeVar
|
||||
from typing import Any, ClassVar, Generator, Generic, Iterable, Sequence, TypeVar
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import X509Backend
|
||||
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
|
||||
@@ -108,8 +108,8 @@ class ExtendedKeyUsageOID:
|
||||
|
||||
class NameAttribute:
|
||||
oid: ObjectIdentifier
|
||||
value: Text
|
||||
def __init__(self, oid: ObjectIdentifier, value: Text) -> None: ...
|
||||
value: str
|
||||
def __init__(self, oid: ObjectIdentifier, value: str) -> None: ...
|
||||
def rfc4514_string(self) -> str: ...
|
||||
|
||||
class RelativeDistinguishedName:
|
||||
@@ -254,8 +254,8 @@ class DirectoryName(GeneralName):
|
||||
def __init__(self, value: Name) -> None: ...
|
||||
|
||||
class DNSName(GeneralName):
|
||||
value: Text
|
||||
def __init__(self, value: Text) -> None: ...
|
||||
value: str
|
||||
def __init__(self, value: str) -> None: ...
|
||||
|
||||
class IPAddress(GeneralName):
|
||||
value: IPv4Address | IPv6Address | IPv4Network | IPv6Network
|
||||
@@ -271,12 +271,12 @@ class RegisteredID(GeneralName):
|
||||
def __init__(self, value: ObjectIdentifier) -> None: ...
|
||||
|
||||
class RFC822Name(GeneralName):
|
||||
value: Text
|
||||
def __init__(self, value: Text) -> None: ...
|
||||
value: str
|
||||
def __init__(self, value: str) -> None: ...
|
||||
|
||||
class UniformResourceIdentifier(GeneralName):
|
||||
value: Text
|
||||
def __init__(self, value: Text) -> None: ...
|
||||
value: str
|
||||
def __init__(self, value: str) -> None: ...
|
||||
|
||||
# X.509 Extensions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user