chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f816de0c-e7a6-4482-93cd-9e0d2aa53ab3 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,860 | supabase-export-v2 | 4718ed730b7275b8 | a Naive Bayesian Classifier <https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Person_classification>`_. The challenge is to predict a person's gender from measurements of normally distributed features including height, weight, and foot size.
We're given a training dataset with measurements for eight people. The
mea... | trusted_official_docs | CPython Docs | a Naive Bayesian Classifier <https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Person_classification>`_. The challenge is to predict a person's gender from measurements of normally distributed features including height, weight, and foot size.
We're given a training dataset with measurements for eight people. The
mea... | a Naive Bayesian Classifier <https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Person_classification>`_. The challenge is to predict a person's gender from measurements of normally distributed features including height, weight, and foot size.
We're given a training dataset with measurements for eight people. The
mea... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f910852e-7395-4b3e-9b54-bb988eb3a98a | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,745 | supabase-export-v2 | d9fe163faa42e1ea | .. doctest::
# Decile cut points for empirically sampled data
>>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,
... 100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,
... 106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,
... 111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,
... 103, 107, 101, 81, 109, ... | trusted_official_docs | CPython Docs | .. doctest::
# Decile cut points for empirically sampled data
>>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,
... 100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,
... 106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,
... 111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,
... 103, 107, 101, 81, 109, ... | .. doctest::
# Decile cut points for empirically sampled data
>>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,
... 100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,
... 106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,
... 111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,
... 103, 107, 101, 81, 109, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb122c29-a327-4d24-bb19-9e48a131180f | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,625 | supabase-export-v2 | ea281a76c86973d6 | `Kernel Density Estimation (KDE) <https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf>`_: Create a continuous probability density function or cumulative distribution function from discrete samples.
The basic idea is to smooth the data using `a kernel function
<https://en.wikipedia.or... | trusted_official_docs | CPython Docs | `Kernel Density Estimation (KDE) <https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf>`_: Create a continuous probability density function or cumulative distribution function from discrete samples.
The basic idea is to smooth the data using `a kernel function
<https://en.wikipedia.or... | `Kernel Density Estimation (KDE) <https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf>`_: Create a continuous probability density function or cumulative distribution function from discrete samples.
The basic idea is to smooth the data using `a kernel function
<https://en.wikipedia.or... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fbf73ba2-70b5-4426-a0db-a49b480fec7b | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,839 | supabase-export-v2 | cddaaba8ef4a4244 | :class:`NormalDist` readily solves classic probability problems.
For example, given `historical data for SAT exams
<https://nces.ed.gov/programs/digest/d17/tables/dt17_226.40.asp>`_ showing
that scores are normally distributed with a mean of 1060 and a standard
deviation of 195, determine the percentage of students wit... | trusted_official_docs | CPython Docs | :class:`NormalDist` readily solves classic probability problems.
For example, given `historical data for SAT exams
<https://nces.ed.gov/programs/digest/d17/tables/dt17_226.40.asp>`_ showing
that scores are normally distributed with a mean of 1060 and a standard
deviation of 195, determine the percentage of students wit... | :class:`NormalDist` readily solves classic probability problems.
For example, given `historical data for SAT exams
<https://nces.ed.gov/programs/digest/d17/tables/dt17_226.40.asp>`_ showing
that scores are normally distributed with a mean of 1060 and a standard
deviation of 195, determine the percentage of students wit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff5e68c5-7d9a-4848-876f-b99666f24590 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,764 | supabase-export-v2 | 17d5ec29db3c7df1 | >>> # Observe that a linear relationship is imperfect >>> round(correlation(orbital_period, dist_from_sun), 4) 0.9882
>>> # Demonstrate Kepler's third law: There is a linear correlation
>>> # between the square of the orbital period and the cube of the
>>> # distance from the sun. >>> period_squared = [p * p for p in... | trusted_official_docs | CPython Docs | >>> # Observe that a linear relationship is imperfect >>> round(correlation(orbital_period, dist_from_sun), 4) 0.9882
>>> # Demonstrate Kepler's third law: There is a linear correlation
>>> # between the square of the orbital period and the cube of the
>>> # distance from the sun. >>> period_squared = [p * p for p in... | >>> # Observe that a linear relationship is imperfect >>> round(correlation(orbital_period, dist_from_sun), 4) 0.9882
>>> # Demonstrate Kepler's third law: There is a linear correlation
>>> # between the square of the orbital period and the cube of the
>>> # distance from the sun. >>> period_squared = [p * p for p in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff613156-58f3-44aa-a57c-d6aa27801073 | CPython Docs | file://datasets/cpython/Doc/library/statistics.rst | unknown | 2728187e-f963-4035-be91-c4d7c16028dc | 40,776 | supabase-export-v2 | 9fc20826fedd1d6f | proportional. The data is fit to a line passing through the origin. Since the *intercept* will always be 0.0, the underlying linear function simplifies to:
*y = slope \* x + noise* | trusted_official_docs | CPython Docs | proportional. The data is fit to a line passing through the origin. Since the *intercept* will always be 0.0, the underlying linear function simplifies to:
*y = slope \* x + noise* | proportional. The data is fit to a line passing through the origin. Since the *intercept* will always be 0.0, the underlying linear function simplifies to:
*y = slope \* x + noise* | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01d57f30-311d-4413-9a1d-9bdec3bcd4e4 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,930 | supabase-export-v2 | f9f2ffd2c26247d4 | .. method:: service_actions()
This is called in the :meth:`serve_forever` loop. This method can be
overridden by subclasses or mixin classes to perform actions specific to
a given service, such as cleanup actions. | trusted_official_docs | CPython Docs | .. method:: service_actions()
This is called in the :meth:`serve_forever` loop. This method can be
overridden by subclasses or mixin classes to perform actions specific to
a given service, such as cleanup actions. | .. method:: service_actions()
This is called in the :meth:`serve_forever` loop. This method can be
overridden by subclasses or mixin classes to perform actions specific to
a given service, such as cleanup actions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02a06234-72bd-49be-aa0d-a25b0c3c6035 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,965 | supabase-export-v2 | 4942a713a1946f06 | .. method:: process_request(request, client_address)
Calls :meth:`finish_request` to create an instance of the
:attr:`RequestHandlerClass`. If desired, this function can create a new process
or thread to handle the request; the :class:`ForkingMixIn` and
:class:`ThreadingMixIn` classes do this. | trusted_official_docs | CPython Docs | .. method:: process_request(request, client_address)
Calls :meth:`finish_request` to create an instance of the
:attr:`RequestHandlerClass`. If desired, this function can create a new process
or thread to handle the request; the :class:`ForkingMixIn` and
:class:`ThreadingMixIn` classes do this. | .. method:: process_request(request, client_address)
Calls :meth:`finish_request` to create an instance of the
:attr:`RequestHandlerClass`. If desired, this function can create a new process
or thread to handle the request; the :class:`ForkingMixIn` and
:class:`ThreadingMixIn` classes do this. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
071a189d-3535-4542-abb4-328cb08f92d1 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,960 | supabase-export-v2 | 389652316e5282da | .. method:: handle_error(request, client_address)
This function is called if the :meth:`~BaseRequestHandler.handle`
method of a :attr:`RequestHandlerClass` instance raises
an exception. The default action is to print the traceback to
standard error and continue handling further requests. | trusted_official_docs | CPython Docs | .. method:: handle_error(request, client_address)
This function is called if the :meth:`~BaseRequestHandler.handle`
method of a :attr:`RequestHandlerClass` instance raises
an exception. The default action is to print the traceback to
standard error and continue handling further requests. | .. method:: handle_error(request, client_address)
This function is called if the :meth:`~BaseRequestHandler.handle`
method of a :attr:`RequestHandlerClass` instance raises
an exception. The default action is to print the traceback to
standard error and continue handling further requests. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
109bff04-b24a-4210-81a7-9c184ac4ff69 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,910 | supabase-export-v2 | b34859d23cb883d0 | :meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class attribute to opt-in for the pre-3.7 behaviour.
.. class:: ForkingTCPServer
ForkingUDPServer
ThreadingTCPServer
Thre... | trusted_official_docs | CPython Docs | :meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class attribute to opt-in for the pre-3.7 behaviour.
.. class:: ForkingTCPServer
ForkingUDPServer
ThreadingTCPServer
Thre... | :meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class attribute to opt-in for the pre-3.7 behaviour.
.. class:: ForkingTCPServer
ForkingUDPServer
ThreadingTCPServer
Thre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2147677a-840b-475e-86cf-e932ba8f6ea2 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,925 | supabase-export-v2 | 8c21486d01f2ce29 | .. method:: handle_request()
Process a single request. This function calls the following methods in
order: :meth:`get_request`, :meth:`verify_request`, and
:meth:`process_request`. If the user-provided
:meth:`~BaseRequestHandler.handle` method of the
handler class raises an exception, the server's :meth:`handle_err... | trusted_official_docs | CPython Docs | .. method:: handle_request()
Process a single request. This function calls the following methods in
order: :meth:`get_request`, :meth:`verify_request`, and
:meth:`process_request`. If the user-provided
:meth:`~BaseRequestHandler.handle` method of the
handler class raises an exception, the server's :meth:`handle_err... | .. method:: handle_request()
Process a single request. This function calls the following methods in
order: :meth:`get_request`, :meth:`verify_request`, and
:meth:`process_request`. If the user-provided
:meth:`~BaseRequestHandler.handle` method of the
handler class raises an exception, the server's :meth:`handle_err... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22292a69-b430-43c1-b50b-b8f8f2e716d0 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,005 | supabase-export-v2 | 97667858a6ec9528 | port 9999 with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server: # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever()
An alternative request handler class that makes use of streams (file-like
objects that simplify communication by providing the s... | trusted_official_docs | CPython Docs | port 9999 with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server: # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever()
An alternative request handler class that makes use of streams (file-like
objects that simplify communication by providing the s... | port 9999 with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server: # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever()
An alternative request handler class that makes use of streams (file-like
objects that simplify communication by providing the s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2369fa9e-4188-4708-8956-a7a4d480174d | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,915 | supabase-export-v2 | f957e904cfa23a98 | In this case, you can use a threading server, but you will probably have to use locks to protect the integrity of the shared data.
On the other hand, if you are building an HTTP server where all data is stored
externally (for instance, in the file system), a synchronous class will
essentially render the service "deaf" ... | trusted_official_docs | CPython Docs | In this case, you can use a threading server, but you will probably have to use locks to protect the integrity of the shared data.
On the other hand, if you are building an HTTP server where all data is stored
externally (for instance, in the file system), a synchronous class will
essentially render the service "deaf" ... | In this case, you can use a threading server, but you will probably have to use locks to protect the integrity of the shared data.
On the other hand, if you are building an HTTP server where all data is stored
externally (for instance, in the file system), a synchronous class will
essentially render the service "deaf" ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2a02d2d2-1b5b-4bf6-9cad-07d3fdab43fe | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,012 | supabase-export-v2 | 9a9cbf68b4c0d8cf | HOST, PORT = "localhost", 9999 data = " ".join(sys.argv[1:])
# Create a socket (SOCK_STREAM means a TCP socket)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
# Connect to server and send data
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sock.sendall(b"\n") | trusted_official_docs | CPython Docs | HOST, PORT = "localhost", 9999 data = " ".join(sys.argv[1:])
# Create a socket (SOCK_STREAM means a TCP socket)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
# Connect to server and send data
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sock.sendall(b"\n") | HOST, PORT = "localhost", 9999 data = " ".join(sys.argv[1:])
# Create a socket (SOCK_STREAM means a TCP socket)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
# Connect to server and send data
sock.connect((HOST, PORT))
sock.sendall(bytes(data, "utf-8"))
sock.sendall(b"\n") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f987e0b-ff78-43fd-8c26-68b96bbf0f4b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,895 | supabase-export-v2 | f7899d36ddab2eea | BaseServer | +------------+ | v +-----------+ +------------------+ | TCPServer |------->| UnixStreamServer | +-----------+ +------------------+ | v +-----------+ +--------------------+ | UDPServer |------->| UnixDatagramServer | +-----------+ +--------------------+
Note that :class:`UnixDatagramServer` derives from :cl... | trusted_official_docs | CPython Docs | BaseServer | +------------+ | v +-----------+ +------------------+ | TCPServer |------->| UnixStreamServer | +-----------+ +------------------+ | v +-----------+ +--------------------+ | UDPServer |------->| UnixDatagramServer | +-----------+ +--------------------+
Note that :class:`UnixDatagramServer` derives from :cl... | BaseServer | +------------+ | v +-----------+ +------------------+ | TCPServer |------->| UnixStreamServer | +-----------+ +------------------+ | v +-----------+ +--------------------+ | UDPServer |------->| UnixDatagramServer | +-----------+ +--------------------+
Note that :class:`UnixDatagramServer` derives from :cl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3ba58df6-2731-4e38-aa4e-e87da489731c | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,019 | supabase-export-v2 | 29f18a94680e8952 | .. code-block:: shell-session
$ python TCPClient.py hello world with TCP
Sent: hello world with TCP
Received: HELLO WORLD WITH TCP
$ python TCPClient.py python is nice
Sent: python is nice
Received: PYTHON IS NICE | trusted_official_docs | CPython Docs | .. code-block:: shell-session
$ python TCPClient.py hello world with TCP
Sent: hello world with TCP
Received: HELLO WORLD WITH TCP
$ python TCPClient.py python is nice
Sent: python is nice
Received: PYTHON IS NICE | .. code-block:: shell-session
$ python TCPClient.py hello world with TCP
Sent: hello world with TCP
Received: HELLO WORLD WITH TCP
$ python TCPClient.py python is nice
Sent: python is nice
Received: PYTHON IS NICE | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c08b02c-645e-4a4d-a85c-836e94a33e20 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,043 | supabase-export-v2 | bc5fa45d0a0b4880 | each request server_thread = threading.Thread(target=server.serve_forever) # Exit the server thread when the main thread terminates server_thread.daemon = True server_thread.start() print("Server loop running in thread:", server_thread.name)
client(ip, port, "Hello World 1")
client(ip, port, "Hello World 2")
client(i... | trusted_official_docs | CPython Docs | each request server_thread = threading.Thread(target=server.serve_forever) # Exit the server thread when the main thread terminates server_thread.daemon = True server_thread.start() print("Server loop running in thread:", server_thread.name)
client(ip, port, "Hello World 1")
client(ip, port, "Hello World 2")
client(i... | each request server_thread = threading.Thread(target=server.serve_forever) # Exit the server thread when the main thread terminates server_thread.daemon = True server_thread.start() print("Server loop running in thread:", server_thread.name)
client(ip, port, "Hello World 1")
client(ip, port, "Hello World 2")
client(i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e94f8c1-d160-4d9d-b80b-9f7aa0826ee8 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,918 | supabase-export-v2 | 442f74e975f7c742 | This is particularly important for stream services where each client can potentially be connected for a long time (if threads or subprocesses cannot be used).
.. XXX should data and methods be intermingled, or separate? how should the distinction between class and instance variables be drawn? | trusted_official_docs | CPython Docs | This is particularly important for stream services where each client can potentially be connected for a long time (if threads or subprocesses cannot be used).
.. XXX should data and methods be intermingled, or separate? how should the distinction between class and instance variables be drawn? | This is particularly important for stream services where each client can potentially be connected for a long time (if threads or subprocesses cannot be used).
.. XXX should data and methods be intermingled, or separate? how should the distinction between class and instance variables be drawn? | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43f63063-bd12-48cd-a6c0-9eed6a36f0db | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,914 | supabase-export-v2 | 89d8a227a881cbb9 | class. The request handler class must be different for datagram or stream services. This can be hidden by using the handler subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`.
Of course, you still have to use your head! For instance, it makes no sense to
use a forking server if the service cont... | trusted_official_docs | CPython Docs | class. The request handler class must be different for datagram or stream services. This can be hidden by using the handler subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`.
Of course, you still have to use your head! For instance, it makes no sense to
use a forking server if the service cont... | class. The request handler class must be different for datagram or stream services. This can be hidden by using the handler subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`.
Of course, you still have to use your head! For instance, it makes no sense to
use a forking server if the service cont... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
44b79660-0962-4c25-9b76-3452b16b4f83 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,948 | supabase-export-v2 | d95b51f6ae0eb1e9 | .. attribute:: request_queue_size
The size of the request queue. If it takes a long time to process a single
request, any requests that arrive while the server is busy are placed into a
queue, up to :attr:`request_queue_size` requests. Once the queue is full,
further requests from clients will get a "Connection deni... | trusted_official_docs | CPython Docs | .. attribute:: request_queue_size
The size of the request queue. If it takes a long time to process a single
request, any requests that arrive while the server is busy are placed into a
queue, up to :attr:`request_queue_size` requests. Once the queue is full,
further requests from clients will get a "Connection deni... | .. attribute:: request_queue_size
The size of the request queue. If it takes a long time to process a single
request, any requests that arrive while the server is busy are placed into a
queue, up to :attr:`request_queue_size` requests. Once the queue is full,
further requests from clients will get a "Connection deni... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
49e4c3ad-87d7-4970-9cfc-2ccd10b989f7 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,966 | supabase-export-v2 | 534e9a4f2f809872 | of the :attr:`RequestHandlerClass`. If desired, this function can create a new process or thread to handle the request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` classes do this.
.. Is there any point in documenting the following two functions? What would the purpose of overriding them be: initializing serv... | trusted_official_docs | CPython Docs | of the :attr:`RequestHandlerClass`. If desired, this function can create a new process or thread to handle the request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` classes do this.
.. Is there any point in documenting the following two functions? What would the purpose of overriding them be: initializing serv... | of the :attr:`RequestHandlerClass`. If desired, this function can create a new process or thread to handle the request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` classes do this.
.. Is there any point in documenting the following two functions? What would the purpose of overriding them be: initializing serv... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ecffdc3-d565-4853-9112-e644a465d633 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,001 | supabase-export-v2 | cc37fe955295c3af | class MyTCPHandler(socketserver.BaseRequestHandler): """ The request handler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client. """ | trusted_official_docs | CPython Docs | class MyTCPHandler(socketserver.BaseRequestHandler): """ The request handler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client. """ | class MyTCPHandler(socketserver.BaseRequestHandler): """ The request handler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client. """ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5236e8b2-1f18-4821-816d-c97350315555 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,004 | supabase-export-v2 | 6a2c68819865f820 | if __name__ == "__main__": HOST, PORT = "localhost", 9999
# Create the server, binding to localhost on port 9999
with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever() | trusted_official_docs | CPython Docs | if __name__ == "__main__": HOST, PORT = "localhost", 9999
# Create the server, binding to localhost on port 9999
with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever() | if __name__ == "__main__": HOST, PORT = "localhost", 9999
# Create the server, binding to localhost on port 9999
with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server.serve_forever() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
533526c5-311f-4418-8fcb-3f999cc38cf5 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,891 | supabase-export-v2 | 75788bdcb72708b7 | you would like threads to behave autonomously; the default is :const:`False`, meaning that Python will not exit until all threads created by :class:`ThreadingMixIn` have exited.
Server classes have the same external methods and attributes, no matter what
network protocol they use. | trusted_official_docs | CPython Docs | you would like threads to behave autonomously; the default is :const:`False`, meaning that Python will not exit until all threads created by :class:`ThreadingMixIn` have exited.
Server classes have the same external methods and attributes, no matter what
network protocol they use. | you would like threads to behave autonomously; the default is :const:`False`, meaning that Python will not exit until all threads created by :class:`ThreadingMixIn` have exited.
Server classes have the same external methods and attributes, no matter what
network protocol they use. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
562ab4ec-0d30-4f33-9c54-d495883d5abf | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,958 | supabase-export-v2 | ff1217dc8e1d974e | .. method:: get_request()
Must accept a request from the socket, and return a 2-tuple containing the *new*
socket object to be used to communicate with the client, and the client's
address. | trusted_official_docs | CPython Docs | .. method:: get_request()
Must accept a request from the socket, and return a 2-tuple containing the *new*
socket object to be used to communicate with the client, and the client's
address. | .. method:: get_request()
Must accept a request from the socket, and return a 2-tuple containing the *new*
socket object to be used to communicate with the client, and the client's
address. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5ba6ce73-edd7-48f6-94f1-e8f6d015e845 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,888 | supabase-export-v2 | c84926f54810cf52 | to the TCP and UDP classes, but use Unix domain sockets; they're not available on non-Unix platforms. The parameters are the same as for :class:`TCPServer`.
These four classes process requests :dfn:`synchronously`; each request must be
completed before the next request can be started. This isn't suitable if each
reques... | trusted_official_docs | CPython Docs | to the TCP and UDP classes, but use Unix domain sockets; they're not available on non-Unix platforms. The parameters are the same as for :class:`TCPServer`.
These four classes process requests :dfn:`synchronously`; each request must be
completed before the next request can be started. This isn't suitable if each
reques... | to the TCP and UDP classes, but use Unix domain sockets; they're not available on non-Unix platforms. The parameters are the same as for :class:`TCPServer`.
These four classes process requests :dfn:`synchronously`; each request must be
completed before the next request can be started. This isn't suitable if each
reques... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5da85f4a-4230-41fc-a3e5-dad871a89219 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,007 | supabase-export-v2 | e33d72a0bced7ebb | class MyTCPHandler(socketserver.StreamRequestHandler):
def handle(self):
# self.rfile is a file-like object created by the handler. # We can now use e.g. readline() instead of raw recv() calls. # We limit ourselves to 10000 bytes to avoid abuse by the sender. self.data = self.rfile.readline(10000).rstrip()
print(f"{s... | trusted_official_docs | CPython Docs | class MyTCPHandler(socketserver.StreamRequestHandler):
def handle(self):
# self.rfile is a file-like object created by the handler. # We can now use e.g. readline() instead of raw recv() calls. # We limit ourselves to 10000 bytes to avoid abuse by the sender. self.data = self.rfile.readline(10000).rstrip()
print(f"{s... | class MyTCPHandler(socketserver.StreamRequestHandler):
def handle(self):
# self.rfile is a file-like object created by the handler. # We can now use e.g. readline() instead of raw recv() calls. # We limit ourselves to 10000 bytes to avoid abuse by the sender. self.data = self.rfile.readline(10000).rstrip()
print(f"{s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f009313-9ecc-43bb-9eaa-0afdfce724e6 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,976 | supabase-export-v2 | 23a47c8c3434cfd3 | .. class:: BaseRequestHandler
This is the superclass of all request handler objects. It defines
the interface, given below. A concrete request handler subclass must
define a new :meth:`handle` method, and can override any of
the other methods. A new instance of the subclass is created for each
request. | trusted_official_docs | CPython Docs | .. class:: BaseRequestHandler
This is the superclass of all request handler objects. It defines
the interface, given below. A concrete request handler subclass must
define a new :meth:`handle` method, and can override any of
the other methods. A new instance of the subclass is created for each
request. | .. class:: BaseRequestHandler
This is the superclass of all request handler objects. It defines
the interface, given below. A concrete request handler subclass must
define a new :meth:`handle` method, and can override any of
the other methods. A new instance of the subclass is created for each
request. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
61e02e21-9d7c-47de-a149-7ccb93d1cc9b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,980 | supabase-export-v2 | ea577d7eb49115fd | .. method:: handle()
This function must do all the work required to service a request. The
default implementation does nothing. Several instance attributes are
available to it; the request is available as :attr:`request`; the client
address as :attr:`client_address`; and the server instance as
:attr:`server`, in ca... | trusted_official_docs | CPython Docs | .. method:: handle()
This function must do all the work required to service a request. The
default implementation does nothing. Several instance attributes are
available to it; the request is available as :attr:`request`; the client
address as :attr:`client_address`; and the server instance as
:attr:`server`, in ca... | .. method:: handle()
This function must do all the work required to service a request. The
default implementation does nothing. Several instance attributes are
available to it; the request is available as :attr:`request`; the client
address as :attr:`client_address`; and the server instance as
:attr:`server`, in ca... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
62a4bf51-e4eb-457c-a0f0-c7c7452ab047 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,042 | supabase-export-v2 | 1506b3b5755e6c85 | server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) with server: ip, port = server.server_address
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thr... | trusted_official_docs | CPython Docs | server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) with server: ip, port = server.server_address
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thr... | server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) with server: ip, port = server.server_address
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
646c85eb-0c76-4d12-9cf7-7a3dd90058b0 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,972 | supabase-export-v2 | ad5a91984d4029a0 | .. method:: verify_request(request, client_address)
Must return a Boolean value; if the value is :const:`True`, the request will
be processed, and if it's :const:`False`, the request will be denied. This
function can be overridden to implement access controls for a server. The
default implementation always returns :... | trusted_official_docs | CPython Docs | .. method:: verify_request(request, client_address)
Must return a Boolean value; if the value is :const:`True`, the request will
be processed, and if it's :const:`False`, the request will be denied. This
function can be overridden to implement access controls for a server. The
default implementation always returns :... | .. method:: verify_request(request, client_address)
Must return a Boolean value; if the value is :const:`True`, the request will
be processed, and if it's :const:`False`, the request will be denied. This
function can be overridden to implement access controls for a server. The
default implementation always returns :... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
66c00d04-e540-46e2-b5b7-6fffab774ca1 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,030 | supabase-export-v2 | d2296f98cb34feb0 | UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT)) received = str(sock.recv(1024), "utf-8")
print("Sent: ", data)
print("Received:", received) | trusted_official_docs | CPython Docs | UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT)) received = str(sock.recv(1024), "utf-8")
print("Sent: ", data)
print("Received:", received) | UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT)) received = str(sock.recv(1024), "utf-8")
print("Sent: ", data)
print("Received:", received) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67583e47-34e4-42bd-8420-f8151391a94a | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,973 | supabase-export-v2 | db7831ee0d0f9626 | it's :const:`False`, the request will be denied. This function can be overridden to implement access controls for a server. The default implementation always returns :const:`True`.
.. versionchanged:: 3.6
Support for the :term:`context manager` protocol was added. Exiting the
context manager is equivalent to calling ... | trusted_official_docs | CPython Docs | it's :const:`False`, the request will be denied. This function can be overridden to implement access controls for a server. The default implementation always returns :const:`True`.
.. versionchanged:: 3.6
Support for the :term:`context manager` protocol was added. Exiting the
context manager is equivalent to calling ... | it's :const:`False`, the request will be denied. This function can be overridden to implement access controls for a server. The default implementation always returns :const:`True`.
.. versionchanged:: 3.6
Support for the :term:`context manager` protocol was added. Exiting the
context manager is equivalent to calling ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67ddc31a-510a-4e23-beec-2fafd389e936 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,923 | supabase-export-v2 | ff5addae1fd36139 | .. method:: fileno()
Return an integer file descriptor for the socket on which the server is
listening. This function is most commonly passed to :mod:`selectors`, to
allow monitoring multiple servers in the same process. | trusted_official_docs | CPython Docs | .. method:: fileno()
Return an integer file descriptor for the socket on which the server is
listening. This function is most commonly passed to :mod:`selectors`, to
allow monitoring multiple servers in the same process. | .. method:: fileno()
Return an integer file descriptor for the socket on which the server is
listening. This function is most commonly passed to :mod:`selectors`, to
allow monitoring multiple servers in the same process. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6be4c1a6-9bba-4882-88ec-339b7113c06e | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,927 | supabase-export-v2 | ba580e5cfc11a212 | .. method:: serve_forever(poll_interval=0.5)
Handle requests until an explicit :meth:`shutdown` request. Poll for
shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` attribute. It
also calls :meth:`service_actions`, which may be used by a subclass or mixin
to provide actions specific to a given servi... | trusted_official_docs | CPython Docs | .. method:: serve_forever(poll_interval=0.5)
Handle requests until an explicit :meth:`shutdown` request. Poll for
shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` attribute. It
also calls :meth:`service_actions`, which may be used by a subclass or mixin
to provide actions specific to a given servi... | .. method:: serve_forever(poll_interval=0.5)
Handle requests until an explicit :meth:`shutdown` request. Poll for
shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` attribute. It
also calls :meth:`service_actions`, which may be used by a subclass or mixin
to provide actions specific to a given servi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73b6bf1b-0343-47f9-b07d-fae1a9fea949 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,040 | supabase-export-v2 | 7941944f41eb7614 | def client(ip, port, message): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.connect((ip, port)) sock.sendall(bytes(message, 'ascii')) response = str(sock.recv(1024), 'ascii') print("Received: {}".format(response))
if __name__ == "__main__":
# Port 0 means to select an arbitrary unused port
HOS... | trusted_official_docs | CPython Docs | def client(ip, port, message): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.connect((ip, port)) sock.sendall(bytes(message, 'ascii')) response = str(sock.recv(1024), 'ascii') print("Received: {}".format(response))
if __name__ == "__main__":
# Port 0 means to select an arbitrary unused port
HOS... | def client(ip, port, message): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.connect((ip, port)) sock.sendall(bytes(message, 'ascii')) response = str(sock.recv(1024), 'ascii') print("Received: {}".format(response))
if __name__ == "__main__":
# Port 0 means to select an arbitrary unused port
HOS... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7867bd7d-68f0-41e6-b7dc-82a64b7cb45a | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,961 | supabase-export-v2 | afa2243c150cbe2c | :meth:`~BaseRequestHandler.handle` method of a :attr:`RequestHandlerClass` instance raises an exception. The default action is to print the traceback to standard error and continue handling further requests.
.. versionchanged:: 3.6
Now only called for exceptions derived from the :exc:`Exception`
class. | trusted_official_docs | CPython Docs | :meth:`~BaseRequestHandler.handle` method of a :attr:`RequestHandlerClass` instance raises an exception. The default action is to print the traceback to standard error and continue handling further requests.
.. versionchanged:: 3.6
Now only called for exceptions derived from the :exc:`Exception`
class. | :meth:`~BaseRequestHandler.handle` method of a :attr:`RequestHandlerClass` instance raises an exception. The default action is to print the traceback to standard error and continue handling further requests.
.. versionchanged:: 3.6
Now only called for exceptions derived from the :exc:`Exception`
class. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80a72107-c566-4a44-8ded-0fed9206d9b4 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,952 | supabase-export-v2 | e1e244cdf36af29d | .. attribute:: timeout
Timeout duration, measured in seconds, or :const:`None` if no timeout is
desired. If :meth:`handle_request` receives no incoming requests within the
timeout period, the :meth:`handle_timeout` method is called. | trusted_official_docs | CPython Docs | .. attribute:: timeout
Timeout duration, measured in seconds, or :const:`None` if no timeout is
desired. If :meth:`handle_request` receives no incoming requests within the
timeout period, the :meth:`handle_timeout` method is called. | .. attribute:: timeout
Timeout duration, measured in seconds, or :const:`None` if no timeout is
desired. If :meth:`handle_request` receives no incoming requests within the
timeout period, the :meth:`handle_timeout` method is called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
851176d5-dcc7-4b8b-9e8a-0d49d3eab28d | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,921 | supabase-export-v2 | 80feb4a4b1b81b06 | .. class:: BaseServer(server_address, RequestHandlerClass)
This is the superclass of all Server objects in the module. It defines the
interface, given below, but does not implement most of the methods, which is
done in subclasses. The two parameters are stored in the respective
:attr:`server_address` and :attr:`Requ... | trusted_official_docs | CPython Docs | .. class:: BaseServer(server_address, RequestHandlerClass)
This is the superclass of all Server objects in the module. It defines the
interface, given below, but does not implement most of the methods, which is
done in subclasses. The two parameters are stored in the respective
:attr:`server_address` and :attr:`Requ... | .. class:: BaseServer(server_address, RequestHandlerClass)
This is the superclass of all Server objects in the module. It defines the
interface, given below, but does not implement most of the methods, which is
done in subclasses. The two parameters are stored in the respective
:attr:`server_address` and :attr:`Requ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
893ef289-f637-4667-9b7a-b31f5d37cdae | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,894 | supabase-export-v2 | 12a9ceb0ec32006e | There are five classes in an inheritance diagram, four of which represent synchronous servers of four types::
+------------+
| BaseServer |
+------------+
|
v
+-----------+ +------------------+
| TCPServer |------->| UnixStreamServer |
+-----------+ +------------------+
|
v
+-----------+ +--------------------... | trusted_official_docs | CPython Docs | There are five classes in an inheritance diagram, four of which represent synchronous servers of four types::
+------------+
| BaseServer |
+------------+
|
v
+-----------+ +------------------+
| TCPServer |------->| UnixStreamServer |
+-----------+ +------------------+
|
v
+-----------+ +--------------------... | There are five classes in an inheritance diagram, four of which represent synchronous servers of four types::
+------------+
| BaseServer |
+------------+
|
v
+-----------+ +------------------+
| TCPServer |------->| UnixStreamServer |
+-----------+ +------------------+
|
v
+-----------+ +--------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89912d54-81f4-4408-8c92-7d3f6a2e0b8a | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,003 | supabase-export-v2 | ea25ab6fc40ba503 | = b''.join(pieces) print(f"Received from {self.client_address[0]}:") print(self.data.decode("utf-8")) # just send back the same data, but upper-cased self.request.sendall(self.data.upper()) # after we return, the socket will be closed.
if __name__ == "__main__":
HOST, PORT = "localhost", 9999 | trusted_official_docs | CPython Docs | = b''.join(pieces) print(f"Received from {self.client_address[0]}:") print(self.data.decode("utf-8")) # just send back the same data, but upper-cased self.request.sendall(self.data.upper()) # after we return, the socket will be closed.
if __name__ == "__main__":
HOST, PORT = "localhost", 9999 | = b''.join(pieces) print(f"Received from {self.client_address[0]}:") print(self.data.decode("utf-8")) # just send back the same data, but upper-cased self.request.sendall(self.data.upper()) # after we return, the socket will be closed.
if __name__ == "__main__":
HOST, PORT = "localhost", 9999 | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ca5d4ad-2710-4216-88bf-c44bca31ddd6 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,041 | supabase-export-v2 | e01c820434ddbf0f | if __name__ == "__main__": # Port 0 means to select an arbitrary unused port HOST, PORT = "localhost", 0
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
with server:
ip, port = server.server_address | trusted_official_docs | CPython Docs | if __name__ == "__main__": # Port 0 means to select an arbitrary unused port HOST, PORT = "localhost", 0
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
with server:
ip, port = server.server_address | if __name__ == "__main__": # Port 0 means to select an arbitrary unused port HOST, PORT = "localhost", 0
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
with server:
ip, port = server.server_address | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fcfb406-19e5-4bcf-8806-4bcf663fb614 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,013 | supabase-export-v2 | 4db02b317dd170e5 | Create a socket (SOCK_STREAM means a TCP socket) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: # Connect to server and send data sock.connect((HOST, PORT)) sock.sendall(bytes(data, "utf-8")) sock.sendall(b"\n")
# Receive data from the server and shut down
received = str(sock.recv(1024), "utf-8") | trusted_official_docs | CPython Docs | Create a socket (SOCK_STREAM means a TCP socket) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: # Connect to server and send data sock.connect((HOST, PORT)) sock.sendall(bytes(data, "utf-8")) sock.sendall(b"\n")
# Receive data from the server and shut down
received = str(sock.recv(1024), "utf-8") | Create a socket (SOCK_STREAM means a TCP socket) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: # Connect to server and send data sock.connect((HOST, PORT)) sock.sendall(bytes(data, "utf-8")) sock.sendall(b"\n")
# Receive data from the server and shut down
received = str(sock.recv(1024), "utf-8") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9102d4ae-e5d5-44f4-85e1-696a93f38451 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,936 | supabase-export-v2 | aa347c9c6ba137b8 | .. attribute:: address_family
The family of protocols to which the server's socket belongs. Common
examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and
:const:`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this
module with class attribute ``address_family = AF_INET6`` set if you
want IPv... | trusted_official_docs | CPython Docs | .. attribute:: address_family
The family of protocols to which the server's socket belongs. Common
examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and
:const:`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this
module with class attribute ``address_family = AF_INET6`` set if you
want IPv... | .. attribute:: address_family
The family of protocols to which the server's socket belongs. Common
examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and
:const:`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this
module with class attribute ``address_family = AF_INET6`` set if you
want IPv... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
968bbe3b-cf1c-41a2-9765-2b6840950dad | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,022 | supabase-export-v2 | 2939c604f4da154e | import socketserver
class MyUDPHandler(socketserver.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
there is no connection the client address must be given explicitly
when sending data back via sendto(). ""... | trusted_official_docs | CPython Docs | import socketserver
class MyUDPHandler(socketserver.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
there is no connection the client address must be given explicitly
when sending data back via sendto(). ""... | import socketserver
class MyUDPHandler(socketserver.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
there is no connection the client address must be given explicitly
when sending data back via sendto(). ""... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
97f07881-2ccc-4698-afbf-b7da4399a49b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,928 | supabase-export-v2 | 8f91bead82e7e2d9 | a subclass or mixin to provide actions specific to a given service. For example, the :class:`ForkingMixIn` class uses :meth:`service_actions` to clean up zombie child processes.
.. versionchanged:: 3.3
Added ``service_actions`` call to the ``serve_forever`` method. | trusted_official_docs | CPython Docs | a subclass or mixin to provide actions specific to a given service. For example, the :class:`ForkingMixIn` class uses :meth:`service_actions` to clean up zombie child processes.
.. versionchanged:: 3.3
Added ``service_actions`` call to the ``serve_forever`` method. | a subclass or mixin to provide actions specific to a given service. For example, the :class:`ForkingMixIn` class uses :meth:`service_actions` to clean up zombie child processes.
.. versionchanged:: 3.3
Added ``service_actions`` call to the ``serve_forever`` method. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9be7751e-ea73-4013-b140-0a868226ffc1 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,029 | supabase-export-v2 | 3c64b8cd373ee9d8 | # SOCK_DGRAM is the socket type to use for UDP sockets sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# As you can see, there is no connect() call; UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT))
received = str(sock... | trusted_official_docs | CPython Docs | # SOCK_DGRAM is the socket type to use for UDP sockets sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# As you can see, there is no connect() call; UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT))
received = str(sock... | # SOCK_DGRAM is the socket type to use for UDP sockets sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# As you can see, there is no connect() call; UDP has no connections. # Instead, data is directly sent to the recipient via sendto(). sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT))
received = str(sock... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ea868fa-496c-4c36-a359-6f3ee8b49932 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,981 | supabase-export-v2 | 721ecd180a4449b7 | the request is available as :attr:`request`; the client address as :attr:`client_address`; and the server instance as :attr:`server`, in case it needs access to per-server information.
The type of :attr:`request` is different for datagram or stream
services. For stream services, :attr:`request` is a socket object; for... | trusted_official_docs | CPython Docs | the request is available as :attr:`request`; the client address as :attr:`client_address`; and the server instance as :attr:`server`, in case it needs access to per-server information.
The type of :attr:`request` is different for datagram or stream
services. For stream services, :attr:`request` is a socket object; for... | the request is available as :attr:`request`; the client address as :attr:`client_address`; and the server instance as :attr:`server`, in case it needs access to per-server information.
The type of :attr:`request` is different for datagram or stream
services. For stream services, :attr:`request` is a socket object; for... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a05ae2c4-d0df-43c6-b1e5-bb045d9f968a | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,983 | supabase-export-v2 | a67e2a4bb913f6a0 | .. method:: finish()
Called after the :meth:`handle` method to perform any clean-up actions
required. The default implementation does nothing. If :meth:`setup`
raises an exception, this function will not be called. | trusted_official_docs | CPython Docs | .. method:: finish()
Called after the :meth:`handle` method to perform any clean-up actions
required. The default implementation does nothing. If :meth:`setup`
raises an exception, this function will not be called. | .. method:: finish()
Called after the :meth:`handle` method to perform any clean-up actions
required. The default implementation does nothing. If :meth:`setup`
raises an exception, this function will not be called. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2298422-6774-43eb-a552-232347cb3e2b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,883 | supabase-export-v2 | 65d73fb9434b309a | and server. If *bind_and_activate* is true, the constructor automatically attempts to invoke :meth:`~BaseServer.server_bind` and :meth:`~BaseServer.server_activate`. The other parameters are passed to the :class:`BaseServer` base class.
.. versionchanged:: 3.15
The default queue size is now ``socket.SOMAXCONN`` for :c... | trusted_official_docs | CPython Docs | and server. If *bind_and_activate* is true, the constructor automatically attempts to invoke :meth:`~BaseServer.server_bind` and :meth:`~BaseServer.server_activate`. The other parameters are passed to the :class:`BaseServer` base class.
.. versionchanged:: 3.15
The default queue size is now ``socket.SOMAXCONN`` for :c... | and server. If *bind_and_activate* is true, the constructor automatically attempts to invoke :meth:`~BaseServer.server_bind` and :meth:`~BaseServer.server_activate`. The other parameters are passed to the :class:`BaseServer` base class.
.. versionchanged:: 3.15
The default queue size is now ``socket.SOMAXCONN`` for :c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a23fabbe-4e5c-4128-8d08-9eb90fec9cee | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,953 | supabase-export-v2 | 31be2a8ed4a62250 | measured in seconds, or :const:`None` if no timeout is desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called.
There are various server methods that can be overridden by subclasses of base
server classes like :class:`TCPServer`; these met... | trusted_official_docs | CPython Docs | measured in seconds, or :const:`None` if no timeout is desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called.
There are various server methods that can be overridden by subclasses of base
server classes like :class:`TCPServer`; these met... | measured in seconds, or :const:`None` if no timeout is desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called.
There are various server methods that can be overridden by subclasses of base
server classes like :class:`TCPServer`; these met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad5789cc-7b4c-404a-aeff-2771f3c8eb3f | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,008 | supabase-export-v2 | 0b5c20b2fb4cae4e | by the sender. self.data = self.rfile.readline(10000).rstrip() print(f"{self.client_address[0]} wrote:") print(self.data.decode("utf-8")) # Likewise, self.wfile is a file-like object used to write back # to the client self.wfile.write(self.data.upper())
The difference is that the ``readline()`` call in the second handl... | trusted_official_docs | CPython Docs | by the sender. self.data = self.rfile.readline(10000).rstrip() print(f"{self.client_address[0]} wrote:") print(self.data.decode("utf-8")) # Likewise, self.wfile is a file-like object used to write back # to the client self.wfile.write(self.data.upper())
The difference is that the ``readline()`` call in the second handl... | by the sender. self.data = self.rfile.readline(10000).rstrip() print(f"{self.client_address[0]} wrote:") print(self.data.decode("utf-8")) # Likewise, self.wfile is a file-like object used to write back # to the client self.wfile.write(self.data.upper())
The difference is that the ``readline()`` call in the second handl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4cdd00d-bef9-4a8b-91f1-843486ca5c40 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,909 | supabase-export-v2 | e2552e51ca1c239b | .. versionchanged:: 3.7
:meth:`ForkingMixIn.server_close <BaseServer.server_close>` and
:meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all
child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class
attribute to opt-in for the... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7
:meth:`ForkingMixIn.server_close <BaseServer.server_close>` and
:meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all
child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class
attribute to opt-in for the... | .. versionchanged:: 3.7
:meth:`ForkingMixIn.server_close <BaseServer.server_close>` and
:meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all
child processes and non-daemonic threads complete. Add a new :attr:`ForkingMixIn.block_on_close <block_on_close>` class
attribute to opt-in for the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bee06787-62fb-4bb2-a9b5-b4f7283f4495 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,913 | supabase-export-v2 | 91e5213eabd64ff6 | .. versionadded:: 3.12 The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes were added.
To implement a service, you must derive a class from :class:`BaseRequestHandler`
and redefine its :meth:`~BaseRequestHandler.handle` method. You can then run various versions of
the service by combining one of t... | trusted_official_docs | CPython Docs | .. versionadded:: 3.12 The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes were added.
To implement a service, you must derive a class from :class:`BaseRequestHandler`
and redefine its :meth:`~BaseRequestHandler.handle` method. You can then run various versions of
the service by combining one of t... | .. versionadded:: 3.12 The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes were added.
To implement a service, you must derive a class from :class:`BaseRequestHandler`
and redefine its :meth:`~BaseRequestHandler.handle` method. You can then run various versions of
the service by combining one of t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c33cf695-8578-4a2e-9987-afa8968d7cbc | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,954 | supabase-export-v2 | 406ca3a3139f6b2c | server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external users of the server object.
.. XXX should the default implementations of these be documented, or should
it be assumed that the user will look at socketserver.py? | trusted_official_docs | CPython Docs | server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external users of the server object.
.. XXX should the default implementations of these be documented, or should
it be assumed that the user will look at socketserver.py? | server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external users of the server object.
.. XXX should the default implementations of these be documented, or should
it be assumed that the user will look at socketserver.py? | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c47b70bd-133d-4d18-832e-05cbe992ba92 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,009 | supabase-export-v2 | 77c0bd004b7ca2a2 | sent, but there is no correlation between client ``send()`` or ``sendall()`` calls and the number of ``recv()`` calls on the server required to receive it.
This is the client side:: | trusted_official_docs | CPython Docs | sent, but there is no correlation between client ``send()`` or ``sendall()`` calls and the number of ``recv()`` calls on the server required to receive it.
This is the client side:: | sent, but there is no correlation between client ``send()`` or ``sendall()`` calls and the number of ``recv()`` calls on the server required to receive it.
This is the client side:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c4e30499-2f58-43b4-97a8-c5081f31cf4b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,940 | supabase-export-v2 | a654b514caf241c0 | .. attribute:: server_address
The address on which the server is listening. The format of addresses varies
depending on the protocol family;
see the documentation for the :mod:`socket` module
for details. For internet protocols, this is a tuple containing a string giving
the address, and an integer port number: ``(... | trusted_official_docs | CPython Docs | .. attribute:: server_address
The address on which the server is listening. The format of addresses varies
depending on the protocol family;
see the documentation for the :mod:`socket` module
for details. For internet protocols, this is a tuple containing a string giving
the address, and an integer port number: ``(... | .. attribute:: server_address
The address on which the server is listening. The format of addresses varies
depending on the protocol family;
see the documentation for the :mod:`socket` module
for details. For internet protocols, this is a tuple containing a string giving
the address, and an integer port number: ``(... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c6ec5748-a283-47c4-a1ed-7b7fa11ea60b | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,023 | supabase-export-v2 | 05a3e4cfd6972f40 | of data and client socket, and since there is no connection the client address must be given explicitly when sending data back via sendto(). """
def handle(self):
data = self.request[0].strip()
socket = self.request[1]
print(f"{self.client_address[0]} wrote:")
print(data)
socket.sendto(data.upper(), self.client_ad... | trusted_official_docs | CPython Docs | of data and client socket, and since there is no connection the client address must be given explicitly when sending data back via sendto(). """
def handle(self):
data = self.request[0].strip()
socket = self.request[1]
print(f"{self.client_address[0]} wrote:")
print(data)
socket.sendto(data.upper(), self.client_ad... | of data and client socket, and since there is no connection the client address must be given explicitly when sending data back via sendto(). """
def handle(self):
data = self.request[0].strip()
socket = self.request[1]
print(f"{self.client_address[0]} wrote:")
print(data)
socket.sendto(data.upper(), self.client_ad... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb2b0350-ea51-4b6a-9278-debc2f6fb233 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,885 | supabase-export-v2 | 34bbcf4d3ab504b3 | .. class:: UDPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses datagrams, which are discrete packets of information that may
arrive out of order or be lost while in transit. The parameters are
the same as for :class:`TCPServer`. | trusted_official_docs | CPython Docs | .. class:: UDPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses datagrams, which are discrete packets of information that may
arrive out of order or be lost while in transit. The parameters are
the same as for :class:`TCPServer`. | .. class:: UDPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses datagrams, which are discrete packets of information that may
arrive out of order or be lost while in transit. The parameters are
the same as for :class:`TCPServer`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb3bc4ea-588b-43d6-a96c-f8fde0ff1c22 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,916 | supabase-export-v2 | a0ab84cecabbf529 | a very long time if a client is slow to receive all the data it has requested. Here a threading or forking server is appropriate.
In some cases, it may be appropriate to process part of a request synchronously,
but to finish processing in a forked child depending on the request data. This
can be implemented by using a ... | trusted_official_docs | CPython Docs | a very long time if a client is slow to receive all the data it has requested. Here a threading or forking server is appropriate.
In some cases, it may be appropriate to process part of a request synchronously,
but to finish processing in a forked child depending on the request data. This
can be implemented by using a ... | a very long time if a client is slow to receive all the data it has requested. Here a threading or forking server is appropriate.
In some cases, it may be appropriate to process part of a request synchronously,
but to finish processing in a forked child depending on the request data. This
can be implemented by using a ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e22139a3-eaa0-4f4d-8df7-8d30edd3f284 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,905 | supabase-export-v2 | f25f11bd909bfaa0 | .. attribute:: max_children
Specify how many child processes will exist to handle requests at a time
for :class:`ForkingMixIn`. If the limit is reached,
new requests will wait until one child process has finished. | trusted_official_docs | CPython Docs | .. attribute:: max_children
Specify how many child processes will exist to handle requests at a time
for :class:`ForkingMixIn`. If the limit is reached,
new requests will wait until one child process has finished. | .. attribute:: max_children
Specify how many child processes will exist to handle requests at a time
for :class:`ForkingMixIn`. If the limit is reached,
new requests will wait until one child process has finished. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e91432fa-0096-4df4-8da5-571ae26dee23 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,882 | supabase-export-v2 | 879ae41793b5c7a5 | .. class:: TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses the internet TCP protocol, which provides for
continuous streams of data between the client and server. If *bind_and_activate* is true, the constructor automatically attempts to
invoke :meth:`~BaseServer.server_bind` and
:met... | trusted_official_docs | CPython Docs | .. class:: TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses the internet TCP protocol, which provides for
continuous streams of data between the client and server. If *bind_and_activate* is true, the constructor automatically attempts to
invoke :meth:`~BaseServer.server_bind` and
:met... | .. class:: TCPServer(server_address, RequestHandlerClass, bind_and_activate=True)
This uses the internet TCP protocol, which provides for
continuous streams of data between the client and server. If *bind_and_activate* is true, the constructor automatically attempts to
invoke :meth:`~BaseServer.server_bind` and
:met... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
edd79c26-625d-49aa-b5ea-91fe65d578e4 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,889 | supabase-export-v2 | 5a50db06732bd1c7 | is to create a separate process or thread to handle each request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` mix-in classes can be used to support asynchronous behaviour.
Creating a server requires several steps. First, you must create a request
handler class by subclassing the :class:`BaseRequestHandler` cl... | trusted_official_docs | CPython Docs | is to create a separate process or thread to handle each request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` mix-in classes can be used to support asynchronous behaviour.
Creating a server requires several steps. First, you must create a request
handler class by subclassing the :class:`BaseRequestHandler` cl... | is to create a separate process or thread to handle each request; the :class:`ForkingMixIn` and :class:`ThreadingMixIn` mix-in classes can be used to support asynchronous behaviour.
Creating a server requires several steps. First, you must create a request
handler class by subclassing the :class:`BaseRequestHandler` cl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5836c73-55fc-499a-a06d-9aa9c0715729 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,887 | supabase-export-v2 | ca5d6f8c7f6f168c | .. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True) UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True)
These more infrequently used classes are similar to the TCP and
UDP classes, but use Unix domain sockets; they're not available on
non-Unix platforms... | trusted_official_docs | CPython Docs | .. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True) UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True)
These more infrequently used classes are similar to the TCP and
UDP classes, but use Unix domain sockets; they're not available on
non-Unix platforms... | .. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True) UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True)
These more infrequently used classes are similar to the TCP and
UDP classes, but use Unix domain sockets; they're not available on
non-Unix platforms... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5981cbf-698d-41c5-a942-923d2701aed0 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,886 | supabase-export-v2 | d2b597b37761412a | are discrete packets of information that may arrive out of order or be lost while in transit. The parameters are the same as for :class:`TCPServer`.
.. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True)
UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True) | trusted_official_docs | CPython Docs | are discrete packets of information that may arrive out of order or be lost while in transit. The parameters are the same as for :class:`TCPServer`.
.. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True)
UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True) | are discrete packets of information that may arrive out of order or be lost while in transit. The parameters are the same as for :class:`TCPServer`.
.. class:: UnixStreamServer(server_address, RequestHandlerClass, bind_and_activate=True)
UnixDatagramServer(server_address, RequestHandlerClass, bind_and_activate=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f737992d-dad2-4771-9030-f31f2cfd78bd | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,002 | supabase-export-v2 | 08bbe2c671ca8845 | It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client. """
def handle(self):
# self.request is the TCP socket connected to the client
pieces = [b'']
total = 0
while b'\n' not in pieces[-1] and total < 10_000:
pieces.append(self.request.... | trusted_official_docs | CPython Docs | It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client. """
def handle(self):
# self.request is the TCP socket connected to the client
pieces = [b'']
total = 0
while b'\n' not in pieces[-1] and total < 10_000:
pieces.append(self.request.... | It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client. """
def handle(self):
# self.request is the TCP socket connected to the client
pieces = [b'']
total = 0
while b'\n' not in pieces[-1] and total < 10_000:
pieces.append(self.request.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f75ca082-767a-48e3-b2b3-19a8195d40f0 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,899 | supabase-export-v2 | f8c371e69bf755fd | class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
The mix-in class comes first, since it overrides a method defined in
:class:`UDPServer`. Setting the various attributes also changes the
behavior of the underlying server mechanism. | trusted_official_docs | CPython Docs | class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
The mix-in class comes first, since it overrides a method defined in
:class:`UDPServer`. Setting the various attributes also changes the
behavior of the underlying server mechanism. | class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
The mix-in class comes first, since it overrides a method defined in
:class:`UDPServer`. Setting the various attributes also changes the
behavior of the underlying server mechanism. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8a66f07-627a-4936-83cc-095f5198d661 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,900 | supabase-export-v2 | 60b803454f7b2490 | mix-in class comes first, since it overrides a method defined in :class:`UDPServer`. Setting the various attributes also changes the behavior of the underlying server mechanism.
:class:`ForkingMixIn` and the Forking classes mentioned below are
only available on POSIX platforms that support :func:`~os.fork`. | trusted_official_docs | CPython Docs | mix-in class comes first, since it overrides a method defined in :class:`UDPServer`. Setting the various attributes also changes the behavior of the underlying server mechanism.
:class:`ForkingMixIn` and the Forking classes mentioned below are
only available on POSIX platforms that support :func:`~os.fork`. | mix-in class comes first, since it overrides a method defined in :class:`UDPServer`. Setting the various attributes also changes the behavior of the underlying server mechanism.
:class:`ForkingMixIn` and the Forking classes mentioned below are
only available on POSIX platforms that support :func:`~os.fork`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f9252c0a-999a-4c9f-b401-a9e85b3b9809 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 41,048 | supabase-export-v2 | 4ef3d81cebcf42a0 | $ python ThreadedTCPServer.py Server loop running in thread: Thread-1 Received: Thread-2: Hello World 1 Received: Thread-3: Hello World 2 Received: Thread-4: Hello World 3
The :class:`ForkingMixIn` class is used in the same way, except that the server
will spawn a new process for each request. Available only on POSIX p... | trusted_official_docs | CPython Docs | $ python ThreadedTCPServer.py Server loop running in thread: Thread-1 Received: Thread-2: Hello World 1 Received: Thread-3: Hello World 2 Received: Thread-4: Hello World 3
The :class:`ForkingMixIn` class is used in the same way, except that the server
will spawn a new process for each request. Available only on POSIX p... | $ python ThreadedTCPServer.py Server loop running in thread: Thread-1 Received: Thread-2: Hello World 1 Received: Thread-3: Hello World 2 Received: Thread-4: Hello World 3
The :class:`ForkingMixIn` class is used in the same way, except that the server
will spawn a new process for each request. Available only on POSIX p... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fde24cc9-bbfd-46dd-b545-1557f0daa833 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,917 | supabase-export-v2 | 3fca0ca618d08174 | on the request data. This can be implemented by using a synchronous server and doing an explicit fork in the request handler class :meth:`~BaseRequestHandler.handle` method.
Another approach to handling multiple simultaneous requests in an environment
that supports neither threads nor :func:`~os.fork` (or where these a... | trusted_official_docs | CPython Docs | on the request data. This can be implemented by using a synchronous server and doing an explicit fork in the request handler class :meth:`~BaseRequestHandler.handle` method.
Another approach to handling multiple simultaneous requests in an environment
that supports neither threads nor :func:`~os.fork` (or where these a... | on the request data. This can be implemented by using a synchronous server and doing an explicit fork in the request handler class :meth:`~BaseRequestHandler.handle` method.
Another approach to handling multiple simultaneous requests in an environment
that supports neither threads nor :func:`~os.fork` (or where these a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fdfabc56-248f-4da5-8659-408704cdba92 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,890 | supabase-export-v2 | 53bf79674f5d1fac | :meth:`~BaseServer.serve_forever` method of the server object to process one or many requests. Finally, call :meth:`~BaseServer.server_close` to close the socket (unless you used a :keyword:`!with` statement).
When inheriting from :class:`ThreadingMixIn` for threaded connection behavior,
you should explicitly declare h... | trusted_official_docs | CPython Docs | :meth:`~BaseServer.serve_forever` method of the server object to process one or many requests. Finally, call :meth:`~BaseServer.server_close` to close the socket (unless you used a :keyword:`!with` statement).
When inheriting from :class:`ThreadingMixIn` for threaded connection behavior,
you should explicitly declare h... | :meth:`~BaseServer.serve_forever` method of the server object to process one or many requests. Finally, call :meth:`~BaseServer.server_close` to close the socket (unless you used a :keyword:`!with` statement).
When inheriting from :class:`ThreadingMixIn` for threaded connection behavior,
you should explicitly declare h... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
febb21f4-2357-473b-ab0f-6c0aabd41ab7 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,963 | supabase-export-v2 | aad81a32121eb55a | .. method:: handle_timeout()
This function is called when the :attr:`timeout` attribute has been set to a
value other than :const:`None` and the timeout period has passed with no
requests being received. The default action for forking servers is
to collect the status of any child processes that have exited, while
i... | trusted_official_docs | CPython Docs | .. method:: handle_timeout()
This function is called when the :attr:`timeout` attribute has been set to a
value other than :const:`None` and the timeout period has passed with no
requests being received. The default action for forking servers is
to collect the status of any child processes that have exited, while
i... | .. method:: handle_timeout()
This function is called when the :attr:`timeout` attribute has been set to a
value other than :const:`None` and the timeout period has passed with no
requests being received. The default action for forking servers is
to collect the status of any child processes that have exited, while
i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff24ec95-bc9e-4bdb-a0c1-2f637413d6d1 | CPython Docs | file://datasets/cpython/Doc/library/socketserver.rst | unknown | 61bd242d-ae29-4e85-ad1b-2532792d26c0 | 40,932 | supabase-export-v2 | 2960054ebf5e313d | .. method:: shutdown()
Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:`shutdown` must be called while :meth:`serve_forever` is running in a
different thread otherwise it will deadlock. | trusted_official_docs | CPython Docs | .. method:: shutdown()
Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:`shutdown` must be called while :meth:`serve_forever` is running in a
different thread otherwise it will deadlock. | .. method:: shutdown()
Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:`shutdown` must be called while :meth:`serve_forever` is running in a
different thread otherwise it will deadlock. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
238a58ff-9f3e-475b-a932-5cada97580e9 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,104 | supabase-export-v2 | a5dd51aa6ee4197c | To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows:
1. :meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler before
any user code is executed and removes it when exiting from the function. 2. The :class:`~asyncio.Runner` creates the main task for the passed coroutine... | trusted_official_docs | CPython Docs | To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows:
1. :meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler before
any user code is executed and removes it when exiting from the function. 2. The :class:`~asyncio.Runner` creates the main task for the passed coroutine... | To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows:
1. :meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler before
any user code is executed and removes it when exiting from the function. 2. The :class:`~asyncio.Runner` creates the main task for the passed coroutine... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24e6916e-7260-4f79-bac5-274f67296b9e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,062 | supabase-export-v2 | f162bcdf18a340a1 | called once. It is recommended to use *loop_factory* to configure the event loop instead of policies. Passing :class:`asyncio.EventLoop` allows running asyncio without the policy system.
The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is... | trusted_official_docs | CPython Docs | called once. It is recommended to use *loop_factory* to configure the event loop instead of policies. Passing :class:`asyncio.EventLoop` allows running asyncio without the policy system.
The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is... | called once. It is recommended to use *loop_factory* to configure the event loop instead of policies. Passing :class:`asyncio.EventLoop` allows running asyncio without the policy system.
The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2612b49f-de2f-4016-a5d5-d9fd15bbf619 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,079 | supabase-export-v2 | e48d54996cef842b | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
*loop_factory* could be used for overriding the loop creation. It is the responsibility of the *loop_factory* to set the created loop as the
curren... | trusted_official_docs | CPython Docs | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
*loop_factory* could be used for overriding the loop creation. It is the responsibility of the *loop_factory* to set the created loop as the
curren... | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
*loop_factory* could be used for overriding the loop creation. It is the responsibility of the *loop_factory* to set the created loop as the
curren... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3821b38d-6ccf-4925-986b-18487b38b499 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,052 | supabase-export-v2 | 2e93c91e2bb78744 | This section outlines high-level asyncio primitives to run asyncio code.
They are built on top of an :ref:`event loop <asyncio-event-loop>` with the aim
to simplify async code usage for common wide-spread scenarios. | trusted_official_docs | CPython Docs | This section outlines high-level asyncio primitives to run asyncio code.
They are built on top of an :ref:`event loop <asyncio-event-loop>` with the aim
to simplify async code usage for common wide-spread scenarios. | This section outlines high-level asyncio primitives to run asyncio code.
They are built on top of an :ref:`event loop <asyncio-event-loop>` with the aim
to simplify async code usage for common wide-spread scenarios. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
54aa94de-3c62-4978-aaaf-e8c9eab80dc0 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,103 | supabase-export-v2 | df79de6f0dbf85a6 | in the main thread by default. However this doesn't work with :mod:`asyncio` because it can interrupt asyncio internals and can hang the program from exiting.
To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows: | trusted_official_docs | CPython Docs | in the main thread by default. However this doesn't work with :mod:`asyncio` because it can interrupt asyncio internals and can hang the program from exiting.
To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows: | in the main thread by default. However this doesn't work with :mod:`asyncio` because it can interrupt asyncio internals and can hang the program from exiting.
To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
726f8578-c914-4699-a0ee-bd1cab88cc6d | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,105 | supabase-export-v2 | cfb3eb30b07f5bbb | the Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be used for resource cleanup. After the main task is cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`. 4.
A user could write a tight loop which cannot be interrupted by
:meth:`asyncio.Task.cancel`, in which case the second f... | trusted_official_docs | CPython Docs | the Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be used for resource cleanup. After the main task is cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`. 4.
A user could write a tight loop which cannot be interrupted by
:meth:`asyncio.Task.cancel`, in which case the second f... | the Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be used for resource cleanup. After the main task is cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`. 4.
A user could write a tight loop which cannot be interrupted by
:meth:`asyncio.Task.cancel`, in which case the second f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80026828-0953-4a8e-b109-a0121353bb58 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,060 | supabase-export-v2 | 8d15d13328c7ab69 | This function cannot be called when another asyncio event loop is running in the same thread.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode` settings. | trusted_official_docs | CPython Docs | This function cannot be called when another asyncio event loop is running in the same thread.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode` settings. | This function cannot be called when another asyncio event loop is running in the same thread.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode` settings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
81aab01e-fdfe-4280-96d3-00536fa02e55 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,059 | supabase-export-v2 | 1bd3fcc7803b504f | This function runs the awaitable, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the executor.
This function cannot be called when another asyncio event loop is
running in the same thread. | trusted_official_docs | CPython Docs | This function runs the awaitable, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the executor.
This function cannot be called when another asyncio event loop is
running in the same thread. | This function runs the awaitable, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the executor.
This function cannot be called when another asyncio event loop is
running in the same thread. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8627a5d7-8c01-4722-8f1a-8ad4c496509e | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,080 | supabase-export-v2 | 12fb543f182e8bbc | set the created loop as the current one. By default :func:`asyncio.new_event_loop` is used and set as current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
Basically, :func:`asyncio.run` example can be rewritten with the runner usage:: | trusted_official_docs | CPython Docs | set the created loop as the current one. By default :func:`asyncio.new_event_loop` is used and set as current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
Basically, :func:`asyncio.run` example can be rewritten with the runner usage:: | set the created loop as the current one. By default :func:`asyncio.new_event_loop` is used and set as current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
Basically, :func:`asyncio.run` example can be rewritten with the runner usage:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2596c57-4620-4c25-900b-7625d6a8744f | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,089 | supabase-export-v2 | 7e0838760787e74a | optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``.
Returns the awaitable's result or raises an exception. | trusted_official_docs | CPython Docs | optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``.
Returns the awaitable's result or raises an exception. | optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``.
Returns the awaitable's result or raises an exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c9d00021-f916-4b14-beb3-2cf7cd756f08 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,088 | supabase-export-v2 | ad84d8dbd3f5c36f | If the argument is a coroutine, it is wrapped in a Task.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``. | trusted_official_docs | CPython Docs | If the argument is a coroutine, it is wrapped in a Task.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``. | If the argument is a coroutine, it is wrapped in a Task.
An optional keyword-only *context* argument allows specifying a
custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d675cec4-9391-4809-9b75-d49fb2ba8f86 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,099 | supabase-export-v2 | 63946d7b158ff3e4 | :class:`Runner` uses the lazy initialization strategy, its constructor doesn't initialize underlying low-level structures.
Embedded *loop* and *context* are created at the :keyword:`with` body entering
or the first call of :meth:`run` or :meth:`get_loop`. | trusted_official_docs | CPython Docs | :class:`Runner` uses the lazy initialization strategy, its constructor doesn't initialize underlying low-level structures.
Embedded *loop* and *context* are created at the :keyword:`with` body entering
or the first call of :meth:`run` or :meth:`get_loop`. | :class:`Runner` uses the lazy initialization strategy, its constructor doesn't initialize underlying low-level structures.
Embedded *loop* and *context* are created at the :keyword:`with` body entering
or the first call of :meth:`run` or :meth:`get_loop`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e412dcf3-3b21-468e-8ad7-f434968b482c | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,078 | supabase-export-v2 | 85dd0654a9f734cb | Sometimes several top-level async functions should be called in the same :ref:`event loop <asyncio-event-loop>` and :class:`contextvars.Context`.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode`... | trusted_official_docs | CPython Docs | Sometimes several top-level async functions should be called in the same :ref:`event loop <asyncio-event-loop>` and :class:`contextvars.Context`.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode`... | Sometimes several top-level async functions should be called in the same :ref:`event loop <asyncio-event-loop>` and :class:`contextvars.Context`.
If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables
debug mode explicitly. ``None`` is used to respect the global
:ref:`asyncio-debug-mode`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef85376e-e66a-4cd7-9d4f-5cc241139686 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,061 | supabase-export-v2 | 3ba2e10ba78c1004 | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
If *loop_factory* is not ``None``, it is used to create a new event loop;
otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at t... | trusted_official_docs | CPython Docs | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
If *loop_factory* is not ``None``, it is used to create a new event loop;
otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at t... | is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings.
If *loop_factory* is not ``None``, it is used to create a new event loop;
otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f02c394c-5c78-4f17-b1b5-6f4b4a358889 | CPython Docs | file://datasets/cpython/Doc/library/asyncio-runner.rst | unknown | ce8ec90d-de95-4f6b-9b3b-d6963359ae92 | 41,102 | supabase-export-v2 | a887e0f8eb49cfac | .. versionadded:: 3.11
When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:`KeyboardInterrupt`
exception is raised in the main thread by default. However this doesn't work with
:mod:`asyncio` because it can interrupt asyncio internals and can hang the program from
exiting. | trusted_official_docs | CPython Docs | .. versionadded:: 3.11
When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:`KeyboardInterrupt`
exception is raised in the main thread by default. However this doesn't work with
:mod:`asyncio` because it can interrupt asyncio internals and can hang the program from
exiting. | .. versionadded:: 3.11
When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:`KeyboardInterrupt`
exception is raised in the main thread by default. However this doesn't work with
:mod:`asyncio` because it can interrupt asyncio internals and can hang the program from
exiting. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
012b1992-832a-4be1-b830-82c3b2f460b6 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,178 | supabase-export-v2 | fc043a55ef70c2e1 | Returns a copy of the compression object. This can be used to efficiently compress a set of data that share a common initial prefix.
.. versionchanged:: 3.8
Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression
objects. | trusted_official_docs | CPython Docs | Returns a copy of the compression object. This can be used to efficiently compress a set of data that share a common initial prefix.
.. versionchanged:: 3.8
Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression
objects. | Returns a copy of the compression object. This can be used to efficiently compress a set of data that share a common initial prefix.
.. versionchanged:: 3.8
Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression
objects. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dfb8325-5d57-41ee-bb97-1017a6f6564e | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,130 | supabase-export-v2 | b531ec4e16252a7f | to −15: Uses the absolute value of *wbits* as the window size logarithm, while producing a raw output stream with no header or trailing checksum.
* +25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the
window size logarithm, while including a basic :program:`gzip` header
and trailing checksum in the ou... | trusted_official_docs | CPython Docs | to −15: Uses the absolute value of *wbits* as the window size logarithm, while producing a raw output stream with no header or trailing checksum.
* +25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the
window size logarithm, while including a basic :program:`gzip` header
and trailing checksum in the ou... | to −15: Uses the absolute value of *wbits* as the window size logarithm, while producing a raw output stream with no header or trailing checksum.
* +25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the
window size logarithm, while including a basic :program:`gzip` header
and trailing checksum in the ou... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13541695-fc5b-467a-8404-4891cf42e3c5 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,170 | supabase-export-v2 | 2babe5c84b152308 | object (such as a :class:`bytearray`), you must not modify its contents between the call to :func:`decompressobj` and the first call to the decompressor's ``decompress()`` method.
.. versionchanged:: 3.3
Added the *zdict* parameter. | trusted_official_docs | CPython Docs | object (such as a :class:`bytearray`), you must not modify its contents between the call to :func:`decompressobj` and the first call to the decompressor's ``decompress()`` method.
.. versionchanged:: 3.3
Added the *zdict* parameter. | object (such as a :class:`bytearray`), you must not modify its contents between the call to :func:`decompressobj` and the first call to the decompressor's ``decompress()`` method.
.. versionchanged:: 3.3
Added the *zdict* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
14095259-2464-40ce-be27-7127ce393a67 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,197 | supabase-export-v2 | dff6243eea26fb12 | .. method:: Decompress.copy()
Returns a copy of the decompression object. This can be used to save the state
of the decompressor midway through the data stream in order to speed up random
seeks into the stream at a future point. | trusted_official_docs | CPython Docs | .. method:: Decompress.copy()
Returns a copy of the decompression object. This can be used to save the state
of the decompressor midway through the data stream in order to speed up random
seeks into the stream at a future point. | .. method:: Decompress.copy()
Returns a copy of the decompression object. This can be used to save the state
of the decompressor midway through the data stream in order to speed up random
seeks into the stream at a future point. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1816ccdd-053e-4213-a84b-32a4e2a73bed | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,138 | supabase-export-v2 | c54fe918ab0c41c6 | *method* is the compression algorithm. Currently, the only supported value is :const:`DEFLATED`.
The *wbits* parameter controls the size of the history buffer (or the
"window size"), and what header and trailer format will be used. It has
the same meaning as `described for compress() <#compress-wbits>`__. | trusted_official_docs | CPython Docs | *method* is the compression algorithm. Currently, the only supported value is :const:`DEFLATED`.
The *wbits* parameter controls the size of the history buffer (or the
"window size"), and what header and trailer format will be used. It has
the same meaning as `described for compress() <#compress-wbits>`__. | *method* is the compression algorithm. Currently, the only supported value is :const:`DEFLATED`.
The *wbits* parameter controls the size of the history buffer (or the
"window size"), and what header and trailer format will be used. It has
the same meaning as `described for compress() <#compress-wbits>`__. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1ae45666-4819-49ee-a9fb-8b9e39e0cfcd | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,191 | supabase-export-v2 | b57ee70239083b78 | to continue. If *max_length* is zero then the whole input is decompressed, and :attr:`unconsumed_tail` is empty. For example, the full content could be read like::
process_output(d.decompress(data, max_length))
while chunk := d.decompress(d.unconsumed_tail, max_length):
process_output(chunk) | trusted_official_docs | CPython Docs | to continue. If *max_length* is zero then the whole input is decompressed, and :attr:`unconsumed_tail` is empty. For example, the full content could be read like::
process_output(d.decompress(data, max_length))
while chunk := d.decompress(d.unconsumed_tail, max_length):
process_output(chunk) | to continue. If *max_length* is zero then the whole input is decompressed, and :attr:`unconsumed_tail` is empty. For example, the full content could be read like::
process_output(d.decompress(data, max_length))
while chunk := d.decompress(d.unconsumed_tail, max_length):
process_output(chunk) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b1df886-53c0-428a-812d-1662b1b4a610 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,118 | supabase-export-v2 | 195dc1636b0018a5 | or digital signatures. Since the algorithm is designed for use as a checksum algorithm, it is not suitable for use as a general hash algorithm.
.. versionchanged:: 3.0
The result is always unsigned. | trusted_official_docs | CPython Docs | or digital signatures. Since the algorithm is designed for use as a checksum algorithm, it is not suitable for use as a general hash algorithm.
.. versionchanged:: 3.0
The result is always unsigned. | or digital signatures. Since the algorithm is designed for use as a checksum algorithm, it is not suitable for use as a general hash algorithm.
.. versionchanged:: 3.0
The result is always unsigned. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b5ed29b-cda3-4ec7-9170-3b780c74ef19 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,145 | supabase-export-v2 | d889aa0dc1ee6a45 | .. index:: single: Cyclic Redundancy Check single: checksum; Cyclic Redundancy Check
Computes a CRC (Cyclic Redundancy Check) checksum of *data*. The
result is an unsigned 32-bit integer. If *value* is present, it is used
as the starting value of the checksum; otherwise, a default value of 0
is used. Passing in *val... | trusted_official_docs | CPython Docs | .. index:: single: Cyclic Redundancy Check single: checksum; Cyclic Redundancy Check
Computes a CRC (Cyclic Redundancy Check) checksum of *data*. The
result is an unsigned 32-bit integer. If *value* is present, it is used
as the starting value of the checksum; otherwise, a default value of 0
is used. Passing in *val... | .. index:: single: Cyclic Redundancy Check single: checksum; Cyclic Redundancy Check
Computes a CRC (Cyclic Redundancy Check) checksum of *data*. The
result is an unsigned 32-bit integer. If *value* is present, it is used
as the starting value of the checksum; otherwise, a default value of 0
is used. Passing in *val... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20c619ed-dd43-4a90-9e69-0617c772eda4 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,160 | supabase-export-v2 | 72b51a3860b5f0b7 | (8 to 15): Uses the low 4 bits of the value as the window size logarithm. The input must include a gzip header and trailer.
* +40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as
the window size logarithm, and automatically accepts either
the zlib or gzip format. | trusted_official_docs | CPython Docs | (8 to 15): Uses the low 4 bits of the value as the window size logarithm. The input must include a gzip header and trailer.
* +40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as
the window size logarithm, and automatically accepts either
the zlib or gzip format. | (8 to 15): Uses the low 4 bits of the value as the window size logarithm. The input must include a gzip header and trailer.
* +40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as
the window size logarithm, and automatically accepts either
the zlib or gzip format. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2c893010-7241-4037-901a-0209557e7f84 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,251 | supabase-export-v2 | b811d2e0da217b4c | .. data:: ZLIBNG_VERSION
The version string of the zlib-ng library that was used for building the
module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and
:data:`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API
provided by zlib-ng. | trusted_official_docs | CPython Docs | .. data:: ZLIBNG_VERSION
The version string of the zlib-ng library that was used for building the
module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and
:data:`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API
provided by zlib-ng. | .. data:: ZLIBNG_VERSION
The version string of the zlib-ng library that was used for building the
module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and
:data:`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API
provided by zlib-ng. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e2fab5e-f63b-4829-a760-eb8653165224 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,155 | supabase-export-v2 | b38e563d45812334 | .. _decompress-wbits:
The *wbits* parameter controls the size of the history buffer
(or "window size"), and what header and trailer format is expected. It is similar to the parameter for :func:`compressobj`, but accepts
more ranges of values: | trusted_official_docs | CPython Docs | .. _decompress-wbits:
The *wbits* parameter controls the size of the history buffer
(or "window size"), and what header and trailer format is expected. It is similar to the parameter for :func:`compressobj`, but accepts
more ranges of values: | .. _decompress-wbits:
The *wbits* parameter controls the size of the history buffer
(or "window size"), and what header and trailer format is expected. It is similar to the parameter for :func:`compressobj`, but accepts
more ranges of values: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
474e1a55-32b0-46ea-9102-1bbd9f7186c6 | CPython Docs | file://datasets/cpython/Doc/library/zlib.rst | unknown | 19c6c17f-ec30-4c71-aacb-32bd7c8be8ed | 41,111 | supabase-export-v2 | 3b85c099e17f066a | .. include:: ../includes/optional-module.rst
zlib's functions have many options and often need to be used in a particular
order. This documentation doesn't attempt to cover all of the permutations;
consult the `zlib manual <https://www.zlib.net/manual.html>`_ for authoritative
information. | trusted_official_docs | CPython Docs | .. include:: ../includes/optional-module.rst
zlib's functions have many options and often need to be used in a particular
order. This documentation doesn't attempt to cover all of the permutations;
consult the `zlib manual <https://www.zlib.net/manual.html>`_ for authoritative
information. | .. include:: ../includes/optional-module.rst
zlib's functions have many options and often need to be used in a particular
order. This documentation doesn't attempt to cover all of the permutations;
consult the `zlib manual <https://www.zlib.net/manual.html>`_ for authoritative
information. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.