Commit Graph

20 Commits

Author SHA1 Message Date
Kaushal Rohit
53367ae18e Fixed return type for get_request (#4649)
Fixes #4647
2020-10-12 14:41:11 +02:00
Jelle Zijlstra
5d553c9584 apply black and isort (#4287)
* apply black and isort

* move some type ignores
2020-06-28 13:31:00 -07:00
Rune Tynan
fcdfacf944 Fix stubtest failures for socketserver on windows (#4103) 2020-05-27 19:34:35 +02:00
Philipp Hahn
84147ec9cb sockeserver: Add undocumented internals (#3924)
the `rfile` and `wfile` members are already implemented by
StreamRequestHandler. In addition to them several (undocumented)
class and instance variables exist according to
<https://github.com/python/cpython/blob/master/Lib/socketserver.py#L742>:
- `rbufsize`
- `wbufsize`
- `timeout`
- `disable_nagle_algorithm`
- `packet` and `socket` for datagrams

The already exist with Python 2.7
<https://github.com/python/cpython/blob/2.7/Lib/SocketServer.py#L677>

```mermaid
classDiagram
BaseRequestHandler <|-- DatagramRequestHandler
BaseRequestHandler <|-- StreamRequestHandler
StreamRequestHandler <|-- BaseHTTPRequestHandler
```
2020-04-14 13:22:40 -07:00
Wolf Honore
211aec7b22 socketserver: Add missing attributes and methods for ForkingMixIn and ThreadingMixin (#3672)
* Add missing attributes and methods for ForkingMixIn and ThreadingMixin

* Copy socketserver.py to SocketServer.py

* Fix type of timeout
2020-02-01 09:30:43 -08:00
Faidon Liambotis
d87a4ffe0b socketserver.BaseRequestHandler: add missing hint (#3524)
Add hint for __init__().

Fixes #3523.
2020-01-03 08:48:49 -08:00
Benjamin Peterson
23c531df5a Type socketserver's RequestHandlerClass as a callable. (#3422)
It's not uncommon to pass functions rather than actual types into the servers.
2019-11-25 20:18:17 -08:00
Michael Lee
b294782183 Make most contextmanager __exit__ signatures return Optional[bool] (#3179)
This pull request is a follow-up to https://github.com/python/mypy/issues/7214.

In short, within that mypy issue, we found it would be helpful to
determine between contextmanagers that can "swallow" exceptions vs ones
that can't. This helps prevent some false positive when using flags that
analyze control flow such as `--warn-unreachable`. To do this,
Jelle proposed assuming that only contextmanagers where the `__exit__`
returns `bool` are assumed to swallow exceptions.

This unfortunately required the following typeshed changes:

1. The typing.IO, threading.Lock, and concurrent.futures.Executor
   were all modified so `__exit__` returns `Optional[None]` instead
   of None -- along with all of their subclasses.

   I believe these three types are meant to be subclassed, so I felt
   picking the more general type was correct.

2. There were also a few concrete types (e.g. see socketserver,
   subprocess, ftplib...) that I modified to return `None` -- I checked
   the source code, and these all seem to return None (and don't appear
   to be meant to be subclassable).

3. contextlib.suppress was changed to return bool. I also double-checked
   the unittest modules and modified a subset of those contextmanagers,
   leaving ones like `_AssertRaisesContext` alone.
2019-08-16 16:13:33 -07:00
Niels Buwen
5638d29203 Fix #3187 : Wrong Signatures in socketserver (#3189)
Fixes #3187
2019-08-16 17:08:23 +02:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Yusuke Miyazaki
6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Ethan Smith
e9600db2ec Remove symlinks! (#2132) 2018-05-15 15:18:59 -04:00
Jelle Zijlstra
37aba00fe8 fix using ZipFile as a ContextManager (#2043) 2018-04-12 12:29:22 -07:00
Masayuki Yamamoto
39eefa544c Fix parameters of socketserver.BaseServer.finish_request() (#1754)
See also: python/cpython#4445
2017-11-21 16:42:05 -08:00
Jelle Zijlstra
a25b449ee0 add some missing classes and platform checks to socketserver (#1354)
These checks were already in SocketServer.pyi for Python 2.
2017-05-25 19:34:27 -07:00
Jakub Stasiak
b91b932d4f Add BaseRequestHandler instance attributes (#384)
From the BaseRequestHandler documentation:

    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 self.request; the
    client address as self.client_address; and the server instance as
    self.server, in case it needs access to per-server information.

    The type of self.request is different for datagram or stream
    services. For stream services, self.request is a socket object;
    for datagram services, self.request is a pair of string and
    socket.
2016-07-26 09:57:08 -07:00
Valérian Rousset
4c42061c95 add types to socketserver for py2 (#250) 2016-06-06 08:37:17 -07:00
Valérian Rousset
20d875dc75 complete socketserver (#238) 2016-06-02 10:06:41 -07:00
Matthias Kramm
94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Matthias Kramm
337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00