Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite089abc

Browse files
Sync typeshed (#20415)
Source commit:python/typeshed@2f3c3b7---------Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
1 parent65f35f9 commite089abc

File tree

20 files changed

+208
-89
lines changed

20 files changed

+208
-89
lines changed

‎mypy/typeshed/stdlib/_ctypes.pyi‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from abc import abstractmethod
55
fromcollections.abcimportCallable,Iterable,Iterator,Mapping,Sequence
66
fromctypesimportCDLL,ArgumentErrorasArgumentError,c_void_p
77
fromtypesimportGenericAlias
8-
fromtypingimportAny,ClassVar,Final,Generic,TypeVar,final,overload,type_check_only
8+
fromtypingimportAny,ClassVar,Final,Generic,Literal,TypeVar,final,overload,type_check_only
99
fromtyping_extensionsimportSelf,TypeAlias
1010

1111
_T=TypeVar("_T")
@@ -266,6 +266,10 @@ class Structure(_CData, metaclass=_PyCStructType):
266266
ifsys.version_info>= (3,13):
267267
_align_:ClassVar[int]
268268

269+
ifsys.version_info>= (3,14):
270+
# _layout_ can be defined by the user, but is not always present.
271+
_layout_:ClassVar[Literal["ms","gcc-sysv"]]
272+
269273
def__init__(self,*args:Any,**kw:Any)->None: ...
270274
def__getattr__(self,name:str)->Any: ...
271275
def__setattr__(self,name:str,value:Any)->None: ...

‎mypy/typeshed/stdlib/_winapi.pyi‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ if sys.platform == "win32":
192192
template_file:int,
193193
/,
194194
)->int: ...
195+
defCreateFileMapping(
196+
file_handle:int,security_attributes:int,protect:int,max_size_high:int,max_size_low:int,name:str,/
197+
)->int: ...
195198
defCreateJunction(src_path:str,dst_path:str,/)->None: ...
196199
defCreateNamedPipe(
197200
name:str,
@@ -235,6 +238,9 @@ if sys.platform == "win32":
235238
defGetModuleFileName(module_handle:int,/)->str: ...
236239
defGetStdHandle(std_handle:int,/)->int: ...
237240
defGetVersion()->int: ...
241+
defMapViewOfFile(
242+
file_map:int,desired_access:int,file_offset_high:int,file_offset_low:int,number_bytes:int,/
243+
)->int: ...
238244
defOpenProcess(desired_access:int,inherit_handle:bool,process_id:int,/)->int: ...
239245
defPeekNamedPipe(handle:int,size:int=0,/)->tuple[int,int]|tuple[bytes,int,int]: ...
240246
ifsys.version_info>= (3,10):
@@ -251,6 +257,7 @@ if sys.platform == "win32":
251257
named_pipe:int,mode:int|None,max_collection_count:int|None,collect_data_timeout:int|None,/
252258
)->None: ...
253259
defTerminateProcess(handle:int,exit_code:int,/)->None: ...
260+
defVirtualQuerySize(address:int,/)->int: ...
254261
defWaitForMultipleObjects(handle_seq:Sequence[int],wait_flag:bool,milliseconds:int=0xFFFFFFFF,/)->int: ...
255262
defWaitForSingleObject(handle:int,milliseconds:int,/)->int: ...
256263
defWaitNamedPipe(name:str,timeout:int,/)->None: ...
@@ -281,6 +288,8 @@ if sys.platform == "win32":
281288
defResetEvent(event:int)->None: ...
282289
defSetEvent(event:int)->None: ...
283290

291+
defOpenFileMapping(desired_access:int,inherit_handle:bool,name:str,/)->int: ...
292+
284293
ifsys.version_info>= (3,12):
285294
defCopyFile2(existing_file_name:str,new_file_name:str,flags:int,progress_routine:int|None=None)->int: ...
286295
defNeedCurrentDirectoryForExePath(exe_name:str,/)->bool: ...

‎mypy/typeshed/stdlib/_zstd.pyi‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ class ZstdCompressor:
4646
FLUSH_BLOCK:Final=1
4747
FLUSH_FRAME:Final=2
4848
def__new__(
49-
cls,level:int|None=None,options:Mapping[int,int]|None=None,zstd_dict:ZstdDict|None=None
49+
cls,
50+
level:int|None=None,
51+
options:Mapping[int,int]|None=None,
52+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
5053
)->Self: ...
5154
defcompress(
5255
self,/,data:ReadableBuffer,mode:_ZstdCompressorContinue|_ZstdCompressorFlushBlock|_ZstdCompressorFlushFrame=0
@@ -58,7 +61,9 @@ class ZstdCompressor:
5861

5962
@final
6063
classZstdDecompressor:
61-
def__new__(cls,zstd_dict:ZstdDict|None=None,options:Mapping[int,int]|None=None)->Self: ...
64+
def__new__(
65+
cls,zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,options:Mapping[int,int]|None=None
66+
)->Self: ...
6267
defdecompress(self,/,data:ReadableBuffer,max_length:int=-1)->bytes: ...
6368
@property
6469
defeof(self)->bool: ...

‎mypy/typeshed/stdlib/argparse.pyi‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
251251
def_read_args_from_files(self,arg_strings:list[str])->list[str]: ...
252252
def_match_argument(self,action:Action,arg_strings_pattern:str)->int: ...
253253
def_match_arguments_partial(self,actions:Sequence[Action],arg_strings_pattern:str)->list[int]: ...
254-
def_parse_optional(self,arg_string:str)->tuple[Action|None,str,str|None]|None: ...
254+
ifsys.version_info>= (3,12):
255+
def_parse_optional(self,arg_string:str)->list[tuple[Action|None,str,str|None,str|None]]|None: ...
256+
else:
257+
def_parse_optional(self,arg_string:str)->tuple[Action|None,str,str|None]|None: ...
258+
255259
def_get_option_tuples(self,option_string:str)->list[tuple[Action,str,str|None]]: ...
256260
def_get_nargs_pattern(self,action:Action)->str: ...
257261
def_get_values(self,action:Action,arg_strings:list[str])->Any: ...

‎mypy/typeshed/stdlib/builtins.pyi‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,13 @@ class bytes(Sequence[int]):
633633
deftranslate(self,table:ReadableBuffer|None,/,delete:ReadableBuffer=b"")->bytes: ...
634634
defupper(self)->bytes: ...
635635
defzfill(self,width:SupportsIndex,/)->bytes: ...
636-
@classmethod
637-
deffromhex(cls,string:str,/)->Self: ...
636+
ifsys.version_info>= (3,14):
637+
@classmethod
638+
deffromhex(cls,string:str|ReadableBuffer,/)->Self: ...
639+
else:
640+
@classmethod
641+
deffromhex(cls,string:str,/)->Self: ...
642+
638643
@staticmethod
639644
defmaketrans(frm:ReadableBuffer,to:ReadableBuffer,/)->bytes: ...
640645
def__len__(self)->int: ...
@@ -738,8 +743,13 @@ class bytearray(MutableSequence[int]):
738743
deftranslate(self,table:ReadableBuffer|None,/,delete:bytes=b"")->bytearray: ...
739744
defupper(self)->bytearray: ...
740745
defzfill(self,width:SupportsIndex,/)->bytearray: ...
741-
@classmethod
742-
deffromhex(cls,string:str,/)->Self: ...
746+
ifsys.version_info>= (3,14):
747+
@classmethod
748+
deffromhex(cls,string:str|ReadableBuffer,/)->Self: ...
749+
else:
750+
@classmethod
751+
deffromhex(cls,string:str,/)->Self: ...
752+
743753
@staticmethod
744754
defmaketrans(frm:ReadableBuffer,to:ReadableBuffer,/)->bytes: ...
745755
def__len__(self)->int: ...
@@ -846,11 +856,15 @@ class memoryview(Sequence[_I]):
846856
defhex(self,sep:str|bytes= ...,bytes_per_sep:SupportsIndex=1)->str: ...
847857
def__buffer__(self,flags:int,/)->memoryview: ...
848858
def__release_buffer__(self,buffer:memoryview,/)->None: ...
859+
ifsys.version_info>= (3,14):
860+
defindex(self,value:object,start:SupportsIndex=0,stop:SupportsIndex=sys.maxsize,/)->int: ...
861+
defcount(self,value:object,/)->int: ...
862+
else:
863+
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
864+
# See https://github.com/python/cpython/issues/125420
865+
index:ClassVar[None]# type: ignore[assignment]
866+
count:ClassVar[None]# type: ignore[assignment]
849867

850-
# These are inherited from the Sequence ABC, but don't actually exist on memoryview.
851-
# See https://github.com/python/cpython/issues/125420
852-
index:ClassVar[None]# type: ignore[assignment]
853-
count:ClassVar[None]# type: ignore[assignment]
854868
ifsys.version_info>= (3,14):
855869
def__class_getitem__(cls,item:Any,/)->GenericAlias: ...
856870

‎mypy/typeshed/stdlib/compression/zstd/__init__.pyi‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ def get_frame_info(frame_buffer: ReadableBuffer) -> FrameInfo: ...
4444
deftrain_dict(samples:Iterable[ReadableBuffer],dict_size:int)->ZstdDict: ...
4545
deffinalize_dict(zstd_dict:ZstdDict,/,samples:Iterable[ReadableBuffer],dict_size:int,level:int)->ZstdDict: ...
4646
defcompress(
47-
data:ReadableBuffer,level:int|None=None,options:Mapping[int,int]|None=None,zstd_dict:ZstdDict|None=None
47+
data:ReadableBuffer,
48+
level:int|None=None,
49+
options:Mapping[int,int]|None=None,
50+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
51+
)->bytes: ...
52+
defdecompress(
53+
data:ReadableBuffer,zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,options:Mapping[int,int]|None=None
4854
)->bytes: ...
49-
defdecompress(data:ReadableBuffer,zstd_dict:ZstdDict|None=None,options:Mapping[int,int]|None=None)->bytes: ...
5055
@final
5156
classCompressionParameter(enum.IntEnum):
5257
compression_level=_zstd.ZSTD_c_compressionLevel

‎mypy/typeshed/stdlib/compression/zstd/_zstdfile.pyi‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ZstdFile(_streams.BaseStream):
3636
*,
3737
level:None=None,
3838
options:Mapping[int,int]|None=None,
39-
zstd_dict:ZstdDict|None=None,
39+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
4040
)->None: ...
4141
@overload
4242
def__init__(
@@ -47,7 +47,7 @@ class ZstdFile(_streams.BaseStream):
4747
*,
4848
level:int|None=None,
4949
options:Mapping[int,int]|None=None,
50-
zstd_dict:ZstdDict|None=None,
50+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
5151
)->None: ...
5252
defwrite(self,data:ReadableBuffer,/)->int: ...
5353
defflush(self,mode:_ZstdCompressorFlushBlock|_ZstdCompressorFlushFrame=1)->bytes: ...# type: ignore[override]
@@ -71,7 +71,7 @@ def open(
7171
*,
7272
level:None=None,
7373
options:Mapping[int,int]|None=None,
74-
zstd_dict:ZstdDict|None=None,
74+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
7575
encoding:str|None=None,
7676
errors:str|None=None,
7777
newline:str|None=None,
@@ -84,7 +84,7 @@ def open(
8484
*,
8585
level:int|None=None,
8686
options:Mapping[int,int]|None=None,
87-
zstd_dict:ZstdDict|None=None,
87+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
8888
encoding:str|None=None,
8989
errors:str|None=None,
9090
newline:str|None=None,
@@ -97,7 +97,7 @@ def open(
9797
*,
9898
level:None=None,
9999
options:Mapping[int,int]|None=None,
100-
zstd_dict:ZstdDict|None=None,
100+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
101101
encoding:str|None=None,
102102
errors:str|None=None,
103103
newline:str|None=None,
@@ -110,7 +110,7 @@ def open(
110110
*,
111111
level:int|None=None,
112112
options:Mapping[int,int]|None=None,
113-
zstd_dict:ZstdDict|None=None,
113+
zstd_dict:ZstdDict|tuple[ZstdDict,int]|None=None,
114114
encoding:str|None=None,
115115
errors:str|None=None,
116116
newline:str|None=None,

‎mypy/typeshed/stdlib/heapq.pyi‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
importsys
12
from_heapqimport*
23
from_typeshedimportSupportsRichComparison
34
fromcollections.abcimportCallable,Generator,Iterable
45
fromtypingimportAny,Final,TypeVar
56

67
__all__= ["heappush","heappop","heapify","heapreplace","merge","nlargest","nsmallest","heappushpop"]
78

9+
ifsys.version_info>= (3,14):
10+
# Added to __all__ in 3.14.1
11+
__all__+= ["heapify_max","heappop_max","heappush_max","heappushpop_max","heapreplace_max"]
12+
813
_S=TypeVar("_S")
914

1015
__about__:Final[str]

‎mypy/typeshed/stdlib/importlib/readers.pyi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ if sys.version_info >= (3, 10):
5252
defis_file(self)->Literal[False]: ...
5353

5454
ifsys.version_info>= (3,12):
55-
defjoinpath(self,*descendants:str)->abc.Traversable: ...
55+
defjoinpath(self,*descendants:StrPath)->abc.Traversable: ...
5656
elifsys.version_info>= (3,11):
57-
defjoinpath(self,child:str)->abc.Traversable: ...# type: ignore[override]
57+
defjoinpath(self,child:StrPath)->abc.Traversable: ...# type: ignore[override]
5858
else:
5959
defjoinpath(self,child:str)->abc.Traversable: ...
6060

‎mypy/typeshed/stdlib/importlib/resources/abc.pyi‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importsys
2+
from_typeshedimportStrPath
23
fromabcimportABCMeta,abstractmethod
34
fromcollections.abcimportIterator
45
fromioimportBufferedReader
@@ -24,7 +25,7 @@ if sys.version_info >= (3, 11):
2425
@abstractmethod
2526
defiterdir(self)->Iterator[Traversable]: ...
2627
@abstractmethod
27-
defjoinpath(self,*descendants:str)->Traversable: ...
28+
defjoinpath(self,*descendants:StrPath)->Traversable: ...
2829

2930
# The documentation and runtime protocol allows *args, **kwargs arguments,
3031
# but this would mean that all implementers would have to support them,
@@ -38,7 +39,7 @@ if sys.version_info >= (3, 11):
3839
@property
3940
@abstractmethod
4041
defname(self)->str: ...
41-
def__truediv__(self,child:str,/)->Traversable: ...
42+
def__truediv__(self,child:StrPath,/)->Traversable: ...
4243
@abstractmethod
4344
defread_bytes(self)->bytes: ...
4445
@abstractmethod

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp