From 1a875a0ad8a7a1d01fc30269fb663460a4658808 Mon Sep 17 00:00:00 2001 From: Avasam Date: Thu, 22 Aug 2024 22:58:24 -0400 Subject: [PATCH] Resolve some stubtest allowlist entries by marking params as keyword-only --- stubs/caldav/@tests/stubtest_allowlist.txt | 4 +--- stubs/caldav/caldav/davclient.pyi | 3 ++- stubs/pyasn1/@tests/stubtest_allowlist.txt | 6 ------ stubs/pyasn1/pyasn1/codec/ber/decoder.pyi | 4 ++-- stubs/pyasn1/pyasn1/codec/native/decoder.pyi | 2 +- stubs/pyasn1/pyasn1/codec/native/encoder.pyi | 2 +- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/stubs/caldav/@tests/stubtest_allowlist.txt b/stubs/caldav/@tests/stubtest_allowlist.txt index 293f7da8b10a..8977c67cd205 100644 --- a/stubs/caldav/@tests/stubtest_allowlist.txt +++ b/stubs/caldav/@tests/stubtest_allowlist.txt @@ -1,7 +1,5 @@ -# **kwargs replaced with actual arguments in stubs -caldav.DAVClient.calendar +# Passes its *args after a kwarg, which is a SyntaxError, so we allow kwargs only caldav.DAVClient.principal -caldav.davclient.DAVClient.calendar caldav.davclient.DAVClient.principal # Initialized in class, but immediately overwritten in __init__ diff --git a/stubs/caldav/caldav/davclient.pyi b/stubs/caldav/caldav/davclient.pyi index 9f0bb919f9d7..ee23bc0b186a 100644 --- a/stubs/caldav/caldav/davclient.pyi +++ b/stubs/caldav/caldav/davclient.pyi @@ -58,9 +58,10 @@ class DAVClient: def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... - def principal(self, *, url: str | ParseResult | SplitResult | URL | None = ...) -> Principal: ... + def principal(self, *, url: str | ParseResult | SplitResult | URL | None = None) -> Principal: ... def calendar( self, + *, url: str | ParseResult | SplitResult | URL | None = ..., parent: DAVObject | None = ..., name: str | None = ..., diff --git a/stubs/pyasn1/@tests/stubtest_allowlist.txt b/stubs/pyasn1/@tests/stubtest_allowlist.txt index 5028c70108e2..d9e5a06d1cde 100644 --- a/stubs/pyasn1/@tests/stubtest_allowlist.txt +++ b/stubs/pyasn1/@tests/stubtest_allowlist.txt @@ -5,9 +5,3 @@ pyasn1.codec.native.encoder.SetEncoder.protoDict # Attempted "__ne__" operation on ASN.1 schema object pyasn1.type.base pyasn1.type.univ - -# Specifying kwargs -pyasn1.codec.ber.decoder.Decoder.__call__ -pyasn1.codec.ber.decoder.StreamingDecoder.__init__ -pyasn1.codec.native.decoder.Decoder.__init__ -pyasn1.codec.native.encoder.Encoder.__init__ diff --git a/stubs/pyasn1/pyasn1/codec/ber/decoder.pyi b/stubs/pyasn1/pyasn1/codec/ber/decoder.pyi index 32149c41b330..ded04121b894 100644 --- a/stubs/pyasn1/pyasn1/codec/ber/decoder.pyi +++ b/stubs/pyasn1/pyasn1/codec/ber/decoder.pyi @@ -346,11 +346,11 @@ decode: Decoder class StreamingDecoder: SINGLE_ITEM_DECODER: type[SingleItemDecoder] - def __init__(self, substrate, asn1Spec=None, tagMap=..., typeMap=..., **ignored: Unused) -> None: ... + def __init__(self, substrate, asn1Spec=None, *, tagMap=..., typeMap=..., **ignored: Unused) -> None: ... def __iter__(self): ... class Decoder: STREAMING_DECODER: type[StreamingDecoder] @classmethod - def __call__(cls, substrate, asn1Spec=None, tagMap=..., typeMap=..., **ignored: Unused): ... + def __call__(cls, substrate, asn1Spec=None, *, tagMap=..., typeMap=..., **ignored: Unused): ... diff --git a/stubs/pyasn1/pyasn1/codec/native/decoder.pyi b/stubs/pyasn1/pyasn1/codec/native/decoder.pyi index a1bbb983bd79..ecc906bf43b8 100644 --- a/stubs/pyasn1/pyasn1/codec/native/decoder.pyi +++ b/stubs/pyasn1/pyasn1/codec/native/decoder.pyi @@ -36,7 +36,7 @@ class SingleItemDecoder: class Decoder: SINGLE_ITEM_DECODER: type[SingleItemDecoder] - def __init__(self, tagMap=..., typeMap=..., **options: Unused) -> None: ... + def __init__(self, *, tagMap=..., typeMap=..., **options: Unused) -> None: ... def __call__(self, pyObject, asn1Spec=None, **kwargs): ... decode: Decoder diff --git a/stubs/pyasn1/pyasn1/codec/native/encoder.pyi b/stubs/pyasn1/pyasn1/codec/native/encoder.pyi index a69a11346ceb..83abcc3b4a78 100644 --- a/stubs/pyasn1/pyasn1/codec/native/encoder.pyi +++ b/stubs/pyasn1/pyasn1/codec/native/encoder.pyi @@ -65,7 +65,7 @@ class SingleItemEncoder: class Encoder: SINGLE_ITEM_ENCODER: type[SingleItemEncoder] - def __init__(self, tagMap=..., typeMap=..., **options: Unused): ... + def __init__(self, *, tagMap=..., typeMap=..., **options: Unused): ... def __call__(self, pyObject, asn1Spec=None, **options): ... encode: SingleItemEncoder