Commit Graph

49 Commits

Author SHA1 Message Date
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex Waygood
1aa5663f9e Add __setattr__ to logging.LogRecord (#8064) 2022-06-12 12:04:22 -07:00
Alex Waygood
e88a182573 Simplify __all__ definitions in modules beginning with 'a' to 'l' (#8026) 2022-06-07 15:40:48 +02:00
Alex Waygood
43a9ab08d7 Always use TypeAlias when assigning to Any (#8021) 2022-06-05 18:16:20 -07:00
Alex Waygood
acc0167dc1 Fix several new-in-3.11 stubtest errors (#7973) 2022-06-02 18:07:38 -07:00
Alex Waygood
171ea08f0d Add __class_getitem__ to classes in logging and csv (#7830)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-17 14:12:42 +01:00
Jelle Zijlstra
9effb643b3 logging.LoggerAdapter: Use a bound TypeVar (#7763) 2022-05-02 08:56:32 +02:00
Alex Waygood
b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Steven Troxler
2d1d4b982f logging/handlers.pyi: atTime is datetime.time (#7566)
It is marked as having type `datetime.datetime` but `atTime`
refers to a time of day; only the fields on `datetime.time`
are used. The [docs](https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler)
clearly state that it is a `time`.
2022-03-30 19:17:36 +01:00
Alex Waygood
1acc8f3bd6 Use PEP 604 syntax wherever possible, part II (#7514)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 14:27:35 +00:00
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Jukka Lehtosalo
12f45c5efb Replace some literal types in logging with int (#7354)
See #7258 for an extended discussion. In summary, for mypy these
would be better written as follows, but this would not work with
other type checkers:
```
CRITICAL: Final = 50
```
2022-02-22 16:24:10 +01:00
Alex Waygood
3ead05f277 Add __all__ to modules beginning with 'j', 'k' and 'l' (#7328) 2022-02-20 15:06:54 -08:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Jelle Zijlstra
de5ec6a0d1 fix incorrect tuple[T] (#6996)
Found from PyCQA/flake8-pyi#135.
2022-01-22 09:37:14 -08:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Alex Waygood
505ea72641 Never explicitly inherit from object in Python 3-only stubs (#6777) 2022-01-02 07:24:48 +01:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Jelle Zijlstra
e3ea71c018 Add comment to LogRecord.message (#6654) 2021-12-22 08:49:35 +01:00
DevilXD
c51438e132 Use Literal instead of int for logging levels (#6610) 2021-12-20 18:29:04 -08:00
Randolf Scholz
4f9b45ff4c Logger.getChild subclass compatible typehint (#6609)
Co-authored-by: Randolf Scholz <rscholz@ismll.de>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-12-20 18:11:42 -08:00
Jukka Lehtosalo
8a5d91ca37 Relax signature of logging.config.loadConfig (#6577)
I did a a cursory investigation using GitHub search and also looked at
a big internal codebase, and a significant fraction of callsites used
a dict type instead of a TypedDict or a dict literal.

It seems that it's a common use case to store the config within an
attribute. For example, something like this:

```
CONFIG = {
   ...
}

...
logging.config.dictConfig(CONFIG)
```

Another use case that was not properly supported is reading the
config from a file, and the config is given `dict[str, Any]` as
the type.

Mypy can still do some type checking of the argument if called
with a dict literal, so I feel this is a reasonable compromise
between type checking strictness and usability.
2021-12-13 07:31:15 -08:00
Shantanu
d453b74ceb logging: fix various __init__ methods (#6417)
Co-authored-by: hauntsaninja <>
2021-11-30 23:18:35 -08:00
Akuli
a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
EXPLOSION
41591f2fcd Use TypedDicts for logging.config.dictConfig (#6193)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-27 10:48:51 +03:00
Đỗ Quốc Vương
3c58736d01 Change type of backupCount from str to int (#6128) 2021-10-07 15:31:53 +02:00
SupImDos
e4c2c0f302 Add SysLogHandler.address attribute (#6037) 2021-09-14 13:58:02 +02:00
Sander
7bfdacb4c4 stdlib/logging use object over Any for parameter types (#6025) 2021-09-10 16:04:32 +02:00
Oleg Höfling
a74624d31b Introduce generic logger type in loggeradapter (#5954) 2021-08-25 05:45:56 -07:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Henry Schreiner
ae51d5264b fix: standalone logger functions do not accept arbitrary keywords (#5862) 2021-08-06 23:58:24 +02:00
Henry Schreiner
4965e95f84 fix: arbitrary keyword arguments are not accepted in logging functions (#5849)
While the implementation uses `**kwargs`, this is just forwarded to `_log()`, which accepts a fixed set of arguments.
2021-08-06 10:59:43 +02:00
Luis Marsano
c6b78354e6 stdlib logging: specify style type as literal choice (#5716)
documented for style parameter: https://docs.python.org/3/library/logging.html#logging.Formatter
2021-06-30 14:50:21 -07:00
kasium
2c97c3cab9 Flag LogRecord.args as optional (#5714)
Resolves #5710
2021-06-30 14:51:32 +02:00
Sebastian Rittau
dd441645ad Make logging.StreamHandler generic over stream (#5681)
Closes #5680
2021-06-23 17:03:18 +03:00
Sebastian Rittau
3ec061022a Improve logging.StreamHandler and FileHandler (#5663)
* Use PEP 604, instead of Optional.
* Override FileHandler.stream and setStream to require a TextIOWrapper
  instead of a SupportsWrite object.
* FileHandler._open() now returns a TextIOWrapper instead of IO. Using
  anything but a file opened in text mode would not work.
2021-06-21 22:50:49 +02:00
joooeey
3072046430 Add Python 3.9 support in logging.basicConfig (#5639) 2021-06-15 11:33:38 +02:00
Aymeric Augustin
dd229f80be Support wrapping LoggerAdapter in LoggerAdapter (#5562)
Fixes #5561
2021-06-01 10:06:34 +02:00
Sebastian Rittau
6ee67483a3 Rework socket (#5545)
* Extract _socket.pyi from socket.pyi.
* Extract _socket.socket from socket.socket.
* Fix socket.family annotation.
* Annotate SocketIO properly.
* SocketType is an alias of _socket.socket.
* Sort items in socket.pyi in the same order as in socket.py.
* Remove socket.EINTR.
* Use _typeshed.WriteableBuffer instead of custom alias.
* Add errorTab (Windows only).
* Add _socket.dup().
* Mark positional-only argments.
* Remove constructors from socket exceptions.
* socket.timeout is an alias for TimeoutError, starting with Python 3.10.
* Use PEP 604 in changed lines.
* Add alias for fileno arguments.
* getaddrinfo() port can be bytes.
* Explicitly override some SSLSocket methods.
* Allow ReadableBuffer in _CMSG arguments.
2021-05-30 20:17:33 +02:00
Sebastian Rittau
f0bf6eebbd AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
2021-05-17 20:45:48 +02:00
spaghEddieDoyle
4c72f7f268 Add some missing logging features (#5388) 2021-05-11 10:52:40 +02:00
Sebastian Rittau
4ac3ccad45 black: enable skip_magic_trailing_comma (#5252)
* black: enable skip_magic_trailing_comma

* Remove spurious commas
2021-04-27 08:32:32 -07:00
hatal175
a98e3e3ff9 Replace some type with Type[] (#5254)
* Replace some type with Type[]

* Change aggregate_class to be Callable
2021-04-26 07:31:16 -07:00
dod-wdwilcox
059ab3868f add stubs for Manager, Logger.root, Logger.manager (#5160)
* add stubs for Manager, Logger.root, Logger.manager
2021-03-31 20:58:51 +03:00
Sebastian Rittau
5f52e38fdd Use SupportsWrite instead of IO (#5069) 2021-03-22 19:46:45 -07:00
Sebastian Rittau
0cea325bc7 Modernize logging (#5068) 2021-03-22 19:26:43 -07:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

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