1
- # ruff: noqa: PYI063 # Several cases throughout file where
2
- # argument names with __ used because of typeshed, see comment for recv in _SocketType
3
-
4
1
from __future__ import annotations
5
2
6
3
import os
@@ -677,11 +674,12 @@ async def accept(self) -> tuple[SocketType, AddressFormat]:
677
674
async def connect (self , address : AddressFormat ) -> None :
678
675
raise NotImplementedError
679
676
680
- def recv (__self , __buflen : int , __flags : int = 0 ) -> Awaitable [bytes ]:
677
+ def recv (self , buflen : int , flags : int = 0 , / ) -> Awaitable [bytes ]:
681
678
raise NotImplementedError
682
679
683
680
def recv_into (
684
- __self ,
681
+ self ,
682
+ / ,
685
683
buffer : Buffer ,
686
684
nbytes : int = 0 ,
687
685
flags : int = 0 ,
@@ -690,15 +688,17 @@ def recv_into(
690
688
691
689
# return type of socket.socket.recvfrom in typeshed is tuple[bytes, Any]
692
690
def recvfrom (
693
- __self ,
694
- __bufsize : int ,
695
- __flags : int = 0 ,
691
+ self ,
692
+ bufsize : int ,
693
+ flags : int = 0 ,
694
+ / ,
696
695
) -> Awaitable [tuple [bytes , AddressFormat ]]:
697
696
raise NotImplementedError
698
697
699
698
# return type of socket.socket.recvfrom_into in typeshed is tuple[bytes, Any]
700
699
def recvfrom_into (
701
- __self ,
700
+ self ,
701
+ / ,
702
702
buffer : Buffer ,
703
703
nbytes : int = 0 ,
704
704
flags : int = 0 ,
@@ -710,10 +710,11 @@ def recvfrom_into(
710
710
):
711
711
712
712
def recvmsg (
713
- __self ,
714
- __bufsize : int ,
715
- __ancbufsize : int = 0 ,
716
- __flags : int = 0 ,
713
+ self ,
714
+ bufsize : int ,
715
+ ancbufsize : int = 0 ,
716
+ flags : int = 0 ,
717
+ / ,
717
718
) -> Awaitable [tuple [bytes , list [tuple [int , int , bytes ]], int , object ]]:
718
719
raise NotImplementedError
719
720
@@ -722,29 +723,32 @@ def recvmsg(
722
723
):
723
724
724
725
def recvmsg_into (
725
- __self ,
726
- __buffers : Iterable [Buffer ],
727
- __ancbufsize : int = 0 ,
728
- __flags : int = 0 ,
726
+ self ,
727
+ buffers : Iterable [Buffer ],
728
+ ancbufsize : int = 0 ,
729
+ flags : int = 0 ,
730
+ / ,
729
731
) -> Awaitable [tuple [int , list [tuple [int , int , bytes ]], int , object ]]:
730
732
raise NotImplementedError
731
733
732
- def send (__self , __bytes : Buffer , __flags : int = 0 ) -> Awaitable [int ]:
734
+ def send (self , bytes : Buffer , flags : int = 0 , / ) -> Awaitable [int ]:
733
735
raise NotImplementedError
734
736
735
737
@overload
736
738
async def sendto (
737
739
self ,
738
- __data : Buffer ,
739
- __address : tuple [object , ...] | str | Buffer ,
740
+ data : Buffer ,
741
+ address : tuple [object , ...] | str | Buffer ,
742
+ / ,
740
743
) -> int : ...
741
744
742
745
@overload
743
746
async def sendto (
744
747
self ,
745
- __data : Buffer ,
746
- __flags : int ,
747
- __address : tuple [object , ...] | str | Buffer ,
748
+ data : Buffer ,
749
+ flags : int ,
750
+ address : tuple [object , ...] | str | Buffer ,
751
+ / ,
748
752
) -> int : ...
749
753
750
754
async def sendto (self , * args : object ) -> int :
@@ -757,10 +761,11 @@ async def sendto(self, *args: object) -> int:
757
761
@_wraps (_stdlib_socket .socket .sendmsg , assigned = (), updated = ())
758
762
async def sendmsg (
759
763
self ,
760
- __buffers : Iterable [Buffer ],
761
- __ancdata : Iterable [tuple [int , int , Buffer ]] = (),
762
- __flags : int = 0 ,
763
- __address : AddressFormat | None = None ,
764
+ buffers : Iterable [Buffer ],
765
+ ancdata : Iterable [tuple [int , int , Buffer ]] = (),
766
+ flags : int = 0 ,
767
+ address : AddressFormat | None = None ,
768
+ / ,
764
769
) -> int :
765
770
raise NotImplementedError
766
771
@@ -1118,11 +1123,8 @@ async def connect(self, address: AddressFormat) -> None:
1118
1123
# complain about AmbiguousType
1119
1124
if TYPE_CHECKING :
1120
1125
1121
- def recv (__self , __buflen : int , __flags : int = 0 ) -> Awaitable [bytes ]: ...
1126
+ def recv (self , buflen : int , flags : int = 0 , / ) -> Awaitable [bytes ]: ...
1122
1127
1123
- # _make_simple_sock_method_wrapper is typed, so this checks that the above is correct
1124
- # this requires that we refrain from using `/` to specify pos-only
1125
- # args, or mypy thinks the signature differs from typeshed.
1126
1128
recv = _make_simple_sock_method_wrapper (
1127
1129
_stdlib_socket .socket .recv ,
1128
1130
_core .wait_readable ,
@@ -1135,7 +1137,8 @@ def recv(__self, __buflen: int, __flags: int = 0) -> Awaitable[bytes]: ...
1135
1137
if TYPE_CHECKING :
1136
1138
1137
1139
def recv_into (
1138
- __self ,
1140
+ self ,
1141
+ / ,
1139
1142
buffer : Buffer ,
1140
1143
nbytes : int = 0 ,
1141
1144
flags : int = 0 ,
@@ -1153,9 +1156,10 @@ def recv_into(
1153
1156
if TYPE_CHECKING :
1154
1157
# return type of socket.socket.recvfrom in typeshed is tuple[bytes, Any]
1155
1158
def recvfrom (
1156
- __self ,
1157
- __bufsize : int ,
1158
- __flags : int = 0 ,
1159
+ self ,
1160
+ bufsize : int ,
1161
+ flags : int = 0 ,
1162
+ / ,
1159
1163
) -> Awaitable [tuple [bytes , AddressFormat ]]: ...
1160
1164
1161
1165
recvfrom = _make_simple_sock_method_wrapper (
@@ -1170,7 +1174,8 @@ def recvfrom(
1170
1174
if TYPE_CHECKING :
1171
1175
# return type of socket.socket.recvfrom_into in typeshed is tuple[bytes, Any]
1172
1176
def recvfrom_into (
1173
- __self ,
1177
+ self ,
1178
+ / ,
1174
1179
buffer : Buffer ,
1175
1180
nbytes : int = 0 ,
1176
1181
flags : int = 0 ,
@@ -1191,10 +1196,11 @@ def recvfrom_into(
1191
1196
if TYPE_CHECKING :
1192
1197
1193
1198
def recvmsg (
1194
- __self ,
1195
- __bufsize : int ,
1196
- __ancbufsize : int = 0 ,
1197
- __flags : int = 0 ,
1199
+ self ,
1200
+ bufsize : int ,
1201
+ ancbufsize : int = 0 ,
1202
+ flags : int = 0 ,
1203
+ / ,
1198
1204
) -> Awaitable [tuple [bytes , list [tuple [int , int , bytes ]], int , object ]]: ...
1199
1205
1200
1206
recvmsg = _make_simple_sock_method_wrapper (
@@ -1213,10 +1219,11 @@ def recvmsg(
1213
1219
if TYPE_CHECKING :
1214
1220
1215
1221
def recvmsg_into (
1216
- __self ,
1217
- __buffers : Iterable [Buffer ],
1218
- __ancbufsize : int = 0 ,
1219
- __flags : int = 0 ,
1222
+ self ,
1223
+ buffers : Iterable [Buffer ],
1224
+ ancbufsize : int = 0 ,
1225
+ flags : int = 0 ,
1226
+ / ,
1220
1227
) -> Awaitable [tuple [int , list [tuple [int , int , bytes ]], int , object ]]: ...
1221
1228
1222
1229
recvmsg_into = _make_simple_sock_method_wrapper (
@@ -1231,7 +1238,7 @@ def recvmsg_into(
1231
1238
1232
1239
if TYPE_CHECKING :
1233
1240
1234
- def send (__self , __bytes : Buffer , __flags : int = 0 ) -> Awaitable [int ]: ...
1241
+ def send (self , bytes : Buffer , flags : int = 0 , / ) -> Awaitable [int ]: ...
1235
1242
1236
1243
send = _make_simple_sock_method_wrapper (
1237
1244
_stdlib_socket .socket .send ,
@@ -1245,16 +1252,18 @@ def send(__self, __bytes: Buffer, __flags: int = 0) -> Awaitable[int]: ...
1245
1252
@overload
1246
1253
async def sendto (
1247
1254
self ,
1248
- __data : Buffer ,
1249
- __address : tuple [object , ...] | str | Buffer ,
1255
+ data : Buffer ,
1256
+ address : tuple [object , ...] | str | Buffer ,
1257
+ / ,
1250
1258
) -> int : ...
1251
1259
1252
1260
@overload
1253
1261
async def sendto (
1254
1262
self ,
1255
- __data : Buffer ,
1256
- __flags : int ,
1257
- __address : tuple [object , ...] | str | Buffer ,
1263
+ data : Buffer ,
1264
+ flags : int ,
1265
+ address : tuple [object , ...] | str | Buffer ,
1266
+ / ,
1258
1267
) -> int : ...
1259
1268
1260
1269
@_wraps (_stdlib_socket .socket .sendto , assigned = (), updated = ())
@@ -1287,6 +1296,7 @@ async def sendmsg(
1287
1296
ancdata : Iterable [tuple [int , int , Buffer ]] = (),
1288
1297
flags : int = 0 ,
1289
1298
address : AddressFormat | None = None ,
1299
+ / ,
1290
1300
) -> int :
1291
1301
"""Similar to :meth:`socket.socket.sendmsg`, but async.
1292
1302
0 commit comments