From 13911ae206921d947313f0b3502401a6d134b02a Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 04:52:09 -0500 Subject: [PATCH 1/6] subprocess: Backport `universal_newlines typings See also: https://github.com/python/typeshed/blob/1ce1c1ad17c6eb3c5cab19f8dac94af6a5894bca/stdlib/subprocess.pyi --- src/libvcs/_internal/subprocess.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index 34b72de5d..e93000fab 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -219,7 +219,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin): def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, text: Optional[bool] = ..., encoding: str, @@ -230,7 +230,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, text: Optional[bool] = ..., encoding: Optional[str] = ..., @@ -253,7 +253,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, text: Literal[True], encoding: Optional[str] = ..., @@ -264,7 +264,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Literal[False] = ..., + universal_newlines: Literal[False, None] = ..., *, text: Literal[None, False] = ..., encoding: None = ..., @@ -325,7 +325,7 @@ def check_call(self, **kwargs: Any) -> int: @overload def check_output( self, - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, input: Optional[Union[str, bytes]] = ..., encoding: Optional[str] = ..., @@ -349,7 +349,7 @@ def check_output( @overload def check_output( self, - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, input: Optional[Union[str, bytes]] = ..., encoding: Optional[str] = ..., @@ -373,7 +373,7 @@ def check_output( @overload def check_output( self, - universal_newlines: Literal[False], + universal_newlines: Literal[False, None], *, input: Optional[Union[str, bytes]] = ..., encoding: None = ..., @@ -432,7 +432,7 @@ def check_output( @overload def run( self, - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, capture_output: bool = ..., check: bool = ..., @@ -445,7 +445,7 @@ def run( @overload def run( self, - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, capture_output: bool = ..., check: bool = ..., @@ -458,7 +458,7 @@ def run( @overload def run( self, - universal_newlines: bool = ..., + universal_newlines: Optional[bool] = ..., *, capture_output: bool = ..., check: bool = ..., @@ -485,7 +485,7 @@ def run( @overload def run( self, - universal_newlines: Literal[False] = ..., + universal_newlines: Literal[False, None] = ..., *, capture_output: bool = ..., check: bool = ..., From dd9c650855be81c832122ed35b9202764995c070 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 07:00:14 -0500 Subject: [PATCH 2/6] subprocess: Update pass_fds type annotation See also: https://github.com/python/typeshed/commit/bff43b53e50adf873c20faebb125a5fe808d4ad6 --- src/libvcs/_internal/subprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index e93000fab..f57b404b9 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -42,7 +42,7 @@ import dataclasses import subprocess import sys -from collections.abc import Mapping, Sequence +from collections.abc import Collection, Mapping, Sequence from typing import ( IO, TYPE_CHECKING, @@ -197,7 +197,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin): # POSIX-only restore_signals: bool = True start_new_session: bool = False - pass_fds: Any = () + pass_fds: Collection[int] = () umask: int = -1 if sys.version_info >= (3, 10): pipesize: int = -1 From ae5196e7cca421934eb733cab522408628722bb8 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 07:05:48 -0500 Subject: [PATCH 3/6] subprocess: Improve bytes-related types Backport of https://github.com/python/typeshed/commit/b9eab637cbac042e14016d5e4db10c140aeeffff --- src/libvcs/_internal/subprocess.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index f57b404b9..11b03f287 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -60,6 +60,7 @@ from .dataclasses import SkipDefaultFieldsReprMixin if TYPE_CHECKING: + from _typeshed import ReadableBuffer from typing_extensions import TypeAlias @@ -79,7 +80,7 @@ def __init__(self, output: str, *args: object) -> None: Mapping[str, StrOrBytesPath], ] _FILE: "TypeAlias" = Union[None, int, IO[Any]] -_TXT: "TypeAlias" = Union[bytes, str] +_InputString: "TypeAlias" = Union["ReadableBuffer", str] #: Command _CMD: "TypeAlias" = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] @@ -438,7 +439,7 @@ def run( check: bool = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., - input: Optional[str] = ..., + input: Optional["_InputString"] = ..., text: Literal[True], ) -> subprocess.CompletedProcess[str]: ... @@ -451,7 +452,7 @@ def run( check: bool = ..., encoding: str, errors: Optional[str] = ..., - input: Optional[str] = ..., + input: Optional["_InputString"] = ..., text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -464,7 +465,7 @@ def run( check: bool = ..., encoding: Optional[str] = ..., errors: str, - input: Optional[str] = ..., + input: Optional["_InputString"] = ..., text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -478,7 +479,7 @@ def run( check: bool = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., - input: Optional[str] = ..., + input: Optional["_InputString"] = ..., text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -491,7 +492,7 @@ def run( check: bool = ..., encoding: None = ..., errors: None = ..., - input: Optional[bytes] = ..., + input: Optional["ReadableBuffer"] = ..., text: Literal[None, False] = ..., ) -> subprocess.CompletedProcess[bytes]: ... @@ -503,7 +504,7 @@ def run( check: bool = False, encoding: Optional[str] = None, errors: Optional[str] = None, - input: Optional[Union[str, bytes]] = None, + input: Optional[Union["_InputString", "ReadableBuffer"]] = None, text: Optional[bool] = None, timeout: Optional[float] = None, **kwargs: Any, From 1b1c2483958084cabf42013f49270e77a7763b86 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 07:14:16 -0500 Subject: [PATCH 4/6] subprocess: Add new defaults See also: https://github.com/python/typeshed/commit/33a62ae42d7a3a503d75013efed06e954415b48f#diff-347f4fd6225979bcc49049c1bb73d89fad43609975f9c4ce7fbc5bae37192b8c --- src/libvcs/_internal/subprocess.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index 11b03f287..41f7baaca 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -435,11 +435,11 @@ def run( self, universal_newlines: Optional[bool] = ..., *, - capture_output: bool = ..., - check: bool = ..., + capture_output: bool = False, + check: bool = False, encoding: Optional[str] = ..., errors: Optional[str] = ..., - input: Optional["_InputString"] = ..., + input: Optional["_InputString"] = None, text: Literal[True], ) -> subprocess.CompletedProcess[str]: ... @@ -448,11 +448,11 @@ def run( self, universal_newlines: Optional[bool] = ..., *, - capture_output: bool = ..., - check: bool = ..., + capture_output: bool = False, + check: bool = False, encoding: str, errors: Optional[str] = ..., - input: Optional["_InputString"] = ..., + input: Optional["_InputString"] = None, text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -461,11 +461,11 @@ def run( self, universal_newlines: Optional[bool] = ..., *, - capture_output: bool = ..., - check: bool = ..., + capture_output: bool = False, + check: bool = False, encoding: Optional[str] = ..., errors: str, - input: Optional["_InputString"] = ..., + input: Optional["_InputString"] = None, text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -475,11 +475,11 @@ def run( *, universal_newlines: Literal[True], # where the *real* keyword only args start - capture_output: bool = ..., - check: bool = ..., + capture_output: bool = False, + check: bool = False, encoding: Optional[str] = ..., errors: Optional[str] = ..., - input: Optional["_InputString"] = ..., + input: Optional["_InputString"] = None, text: Optional[bool] = ..., ) -> subprocess.CompletedProcess[str]: ... @@ -488,11 +488,11 @@ def run( self, universal_newlines: Literal[False, None] = ..., *, - capture_output: bool = ..., - check: bool = ..., + capture_output: bool = False, + check: bool = False, encoding: None = ..., errors: None = ..., - input: Optional["ReadableBuffer"] = ..., + input: Optional["ReadableBuffer"] = None, text: Literal[None, False] = ..., ) -> subprocess.CompletedProcess[bytes]: ... From bdc37cb72750b628958893e6570645b9cdc28edd Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 07:19:02 -0500 Subject: [PATCH 5/6] subprocess: More standard library defaults See also: https://github.com/python/typeshed/commit/53747b264e490c3dc19b40175115e2ac05bb5f55#diff-347f4fd6225979bcc49049c1bb73d89fad43609975f9c4ce7fbc5bae37192b8c' --- src/libvcs/_internal/subprocess.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index 41f7baaca..2d5780b6f 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -220,7 +220,7 @@ class SubprocessCommand(SkipDefaultFieldsReprMixin): def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Optional[bool] = ..., + universal_newlines: Optional[bool] = False, *, text: Optional[bool] = ..., encoding: str, @@ -231,7 +231,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Optional[bool] = ..., + universal_newlines: Optional[bool] = False, *, text: Optional[bool] = ..., encoding: Optional[str] = ..., @@ -254,7 +254,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Optional[bool] = ..., + universal_newlines: Optional[bool] = False, *, text: Literal[True], encoding: Optional[str] = ..., @@ -265,11 +265,11 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Literal[False, None] = ..., + universal_newlines: Literal[False, None] = False, *, text: Literal[None, False] = ..., - encoding: None = ..., - errors: None = ..., + encoding: None = None, + errors: None = None, ) -> subprocess.Popen[bytes]: ... def Popen( @@ -377,8 +377,8 @@ def check_output( universal_newlines: Literal[False, None], *, input: Optional[Union[str, bytes]] = ..., - encoding: None = ..., - errors: None = ..., + encoding: None = None, + errors: None = None, text: Literal[None, False] = ..., **kwargs: Any, ) -> bytes: ... @@ -490,8 +490,8 @@ def run( *, capture_output: bool = False, check: bool = False, - encoding: None = ..., - errors: None = ..., + encoding: None = None, + errors: None = None, input: Optional["ReadableBuffer"] = None, text: Literal[None, False] = ..., ) -> subprocess.CompletedProcess[bytes]: ... From 5b965dc0ba28ccd4f5d248f03f2868647a1fe4da Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Mon, 6 May 2024 07:25:16 -0500 Subject: [PATCH 6/6] subprocess: More standard library defaults See also: https://github.com/python/typeshed/commit/516f6655051b061652f086445ea54e8e82232349#diff-347f4fd6225979bcc49049c1bb73d89fad43609975f9c4ce7fbc5bae37192b8c --- src/libvcs/_internal/subprocess.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libvcs/_internal/subprocess.py b/src/libvcs/_internal/subprocess.py index 2d5780b6f..6211d26ad 100644 --- a/src/libvcs/_internal/subprocess.py +++ b/src/libvcs/_internal/subprocess.py @@ -265,7 +265,7 @@ def Popen( def Popen( self, args: Optional[_CMD] = ..., - universal_newlines: Literal[False, None] = False, + universal_newlines: Optional[Literal[False]] = False, *, text: Literal[None, False] = ..., encoding: None = None, @@ -374,7 +374,7 @@ def check_output( @overload def check_output( self, - universal_newlines: Literal[False, None], + universal_newlines: Optional[Literal[False]], *, input: Optional[Union[str, bytes]] = ..., encoding: None = None, @@ -486,7 +486,7 @@ def run( @overload def run( self, - universal_newlines: Literal[False, None] = ..., + universal_newlines: Optional[Literal[False]] = ..., *, capture_output: bool = False, check: bool = False, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy