Commit Graph

45 Commits

Author SHA1 Message Date
Stephen Morton
c606b4f8ad add socket.AF_DECnet value (#13172) 2024-12-03 09:08:49 +01:00
Stephen Morton
308a09f056 Clean up/rework socket constants and add __all__ (#13044) 2024-11-20 14:05:11 +01:00
Stephen Morton
f30d367c7a move socket.error classes from _socket to socket (#12746)
They're implemented in C, but consider themselves to live in
socket.
2024-10-05 18:19:34 -07:00
bytemarx
a10e4135fe Add missing ETH_P_ALL identifier to socket (#11876) 2024-05-10 11:50:37 +02:00
Eric Traut
17f1c4628a Add precise values for enum members where possible (#11299)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-04-22 15:10:59 +01:00
Avasam
1a942aa36d Replace Flake8 checks with Ruff (except for flake8-pyi) (#11496)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-03-10 14:35:45 +00:00
Shantanu
470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Sebastian Rittau
53a8193d64 Update typing_extensions imports in stdlib (#11244)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2024-01-05 08:15:19 -08:00
Sebastian Rittau
23604858a6 Remove Python 3.7 branches (#11238) 2024-01-05 11:39:39 +01:00
Shantanu
2cafcc90a7 socket: rework to match docs more closely, improve accuracy on linux (#11219)
Match the documentation more closely

Fixes some of #8101
2024-01-04 14:36:31 -08:00
Nikita Sobolev
bd4462cc62 Re-export SYSPROTO_CONTROL and PF_SYSTEM in socket on macos (#10814) 2023-10-01 15:38:44 +01:00
Shane Smiskol
5e2fe131fa Add missing TCP_USER_TIMEOUT to socket module (#10530) 2023-08-04 21:11:14 +01:00
Nikita Sobolev
702226e1fd Add missing TCP_CONNECTION_INFO to socket module (#10402) 2023-07-04 12:32:38 +02:00
Nikita Sobolev
9456f5501b Update socket stubs for Python3.12 (#10247)
Docs: https://github.com/python/cpython/blob/3.12/Doc/library/socket.rst
Source: https://github.com/python/cpython/blob/3.12/Modules/socketmodule.c#L8441
2023-06-05 09:32:02 +01:00
Alex Waygood
6ba28ae547 Remove unused type: ignore comments (#9801) 2023-02-23 12:59:50 -08:00
Alex Waygood
9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex Waygood
33a62ae42d Add more defaults to the stdlib (#9606)
Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Alex Waygood
d98d1674e7 Fix a few issues with parameter defaults (#9572) 2023-01-20 09:47:59 -08:00
Jelle Zijlstra
ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Avasam
c70d303985 Audit stdlib object annotations (#9519) 2023-01-17 15:40:00 +00:00
Jelle Zijlstra
cff08b674a isort: Add more to extra_standard_library (#9098) 2022-11-04 22:56:40 -07:00
Jelle Zijlstra
287fce4872 ssl, socket, array: Improve bytes handling (#8997) 2022-10-28 15:35:51 +02:00
Kevin Kirsche
a8c8178127 Add missing NETLINK re-exports of linux socket constants (#8555) 2022-08-18 20:24:58 +01:00
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex Waygood
c6de37df53 Overhaul socket stubs on Windows and MacOS (#8106)
Reduce the `socket` allowlists for these platforms to a handful of missing constants
2022-06-20 20:11:50 +01:00
Shantanu
34579f1edf socket: add TCP_KEEPALIVE (#8100)
bpo-34932

Co-authored-by: hauntsaninja <>
2022-06-19 17:57:07 +01:00
Alex Waygood
411d85feeb socket.AddressFamily: Fix AF_LINK (#8103)
Slipped through the net in #8099
2022-06-19 09:10:33 +01:00
Shantanu
b7f8d847be socket: consistency between constants and enums (#8099)
This matches what happens at runtime, from Enum._convert_
Helps with #8098. Closes #5696.
2022-06-19 08:57:55 +01:00
Sebastian Rittau
f21898abb9 Improve I/O types in socket.pyi (#7852)
* Use a protocol for socket.sendfile() "file" argument.
* Use concrete classes for socket.makefile() return types.
2022-05-17 06:11:50 -07:00
Jelle Zijlstra
ab1dcafec2 socket: add SO_INCOMING_CPU for 3.11 (#7801)
python/cpython#31237
2022-05-06 22:46:34 -07:00
Jelle Zijlstra
85a6f0ffe9 socket: add all_errors param to create_connection (#7691)
python/cpython#91704
2022-04-25 22:10:29 -06:00
Alex Waygood
74ecce5b68 Improve host parameter of socket.getaddrinfo() (#7518)
As pointed out by @srittau in #7517, `bytearray` [is redundant](https://docs.python.org/3/library/typing.html#typing.ByteString) in a union where `bytes` is also in the union.
2022-03-20 23:35:03 +00:00
Martin Fischer
8138981492 stdlib: socket.CMSG_LEN & socket.CMSG_SPACE are only available on Unix (#7384) 2022-03-06 16:04:05 -08:00
Alex Waygood
96c9abb058 Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable

* Revert changes to `google-cloud-ndb` (ambiguous)

* Remove empty line added by script

* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`

* Manually add a few more that the script missed

* Improve `filelock` annotation

Source code here: 79ec7b2826/src/filelock/_api.py (L207)

* Improve `opentracing/scope` annotation

Source code here: 3e1d357a34/opentracing/scope.py (L71)

* Improve `redis/client` stub

Source code here: 15f315a496/redis/client.py (L1217)

* Improve `redis/lock` annotation

Source code here: 15f315a496/redis/lock.py (L155)

* Improve `requests/models` annotation

Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Rui Cunha
d00b3b2d12 Add socket.IPPROTO_MPTCP (#6863) 2022-01-08 20:57:03 +02:00
Akuli
a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
Stefan Tatschner
7720f9b7df Add CAN_RAW_JOIN_FILTERS constant to socket stub (#6159)
This constant has been added in python 3.9.
2021-10-13 16:29:03 +02:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Anton Grübel
96e0660fba Use _typeshed.Self with __enter__ (#5717)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-01 12:32:32 +02:00
Sebastian Rittau
6ee67483a3 Rework socket (#5545)
* Extract _socket.pyi from socket.pyi.
* Extract _socket.socket from socket.socket.
* Fix socket.family annotation.
* Annotate SocketIO properly.
* SocketType is an alias of _socket.socket.
* Sort items in socket.pyi in the same order as in socket.py.
* Remove socket.EINTR.
* Use _typeshed.WriteableBuffer instead of custom alias.
* Add errorTab (Windows only).
* Add _socket.dup().
* Mark positional-only argments.
* Remove constructors from socket exceptions.
* socket.timeout is an alias for TimeoutError, starting with Python 3.10.
* Use PEP 604 in changed lines.
* Add alias for fileno arguments.
* getaddrinfo() port can be bytes.
* Explicitly override some SSLSocket methods.
* Allow ReadableBuffer in _CMSG arguments.
2021-05-30 20:17:33 +02:00
Sebastian Rittau
6a9c89e928 Replace 'Text' with 'str' in py3 stdlib (#5466) 2021-05-16 07:10:48 -07:00
Akuli
17dcea4a68 Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)
* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-05-15 15:33:39 +03:00
hatal175
b8e5f637b9 Stubtest fixes (#5391) 2021-05-13 18:20:55 -07:00
Eric Traut
0ec182227c Added a few missing type arguments for generic types used in stdlib stubs
I just found and fixed a bug in pyright's "missing type arguments" check. When type arguments were omitted for a generic type within a subscript expression, the error was being suppressed. With this bug fixed, I found several new cases where type arguments were missing in stdlib stubs. (#5130)

Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-03-22 18:28:04 -07:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00