Jelle Zijlstra
afa2a8e3dd
mailbox: improve bytes handling ( #9083 )
...
- The _MessageData alias refers to objects handled in the
_dump_message method: 016c7d37b6/Lib/mailbox.py (L210)
- The path passed to __init__ should be a str path because there are
many places in the file (search for self._path) where we join it
with a str, which won't work with a bytes path.
2022-11-08 21:50:51 +00:00
Kevin Murphy
0884fe13d4
PyYAML: Permit width: float for pure-Python dump(...) ( #8973 )
...
* PyYAML: Permit `width: float` for pure-Python `dump(...)`
To prevent `PyYAML` from wrapping *any* lines, it's possible to pass
`width=float("inf")`, but the current type hints don't like that. This
works at runtime:
>>> s = yaml.dump({"foo": "bar" * 1000}, width=float("inf"))
>>> print(s)
foo: barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar...
but `mypy` says
floatwidth.py:2: error: No overload variant of "dump" matches argument types "Dict[str, str]", "float"
floatwidth.py:2: note: Possible overload variants:
floatwidth.py:2: note: def dump(data: Any, stream: _WriteStream[Any], Dumper: Any = ..., *, default_style: Optional[str] = ..., default_flow_style: Optional[bool] = ..., canonical: Optional[bool] = ..., indent: Optional[int] = ..., width: Optional[int] = ..., allow_unicode: Optional[bool] = ..., line_break: Optional[str] = ..., encoding: Optional[str] = ..., explicit_start: Optional[bool] = ..., explicit_end: Optional[bool] = ..., version: Optional[Tuple[int, int]] = ..., tags: Optional[Mapping[str, str]] = ..., sort_keys: bool = ...) -> None
floatwidth.py:2: note: def dump(data: Any, stream: None = ..., Dumper: Any = ..., *, default_style: Optional[str] = ..., default_flow_style: Optional[bool] = ..., canonical: Optional[bool] = ..., indent: Optional[int] = ..., width: Optional[int] = ..., allow_unicode: Optional[bool] = ..., line_break: Optional[str] = ..., encoding: Optional[str] = ..., explicit_start: Optional[bool] = ..., explicit_end: Optional[bool] = ..., version: Optional[Tuple[int, int]] = ..., tags: Optional[Mapping[str, str]] = ..., sort_keys: bool = ...) -> Any
Found 1 error in 1 file (checked 1 source file)
Poking through the `PyYAML` source, it looks the `width` parameter
could probably be anything "comparable", as it's only compared via
the `<` operator[1].
For the LibYAML implementation, however, we have to use `int`s:
>>> stream = StringIO()
>>> dumper = yaml.CDumper(stream, width=float("inf"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/yaml/cyaml.py", line 81, in __init__
version=version, tags=tags)
File "ext/_yaml.pyx", line 973, in _yaml.CEmitter.__init__ (ext/_yaml.c:14797)
OverflowError: cannot convert float infinity to integer
2022-11-08 21:23:47 +00:00
Nikita Sobolev
62a6c3d616
Annotate known magic-method return types ( #9131 )
2022-11-08 18:28:42 +00:00
Nikita Sobolev
c0e9038f0d
Fix and allow classes with missing metaclasses ( #9136 )
2022-11-08 18:13:59 +00:00
anthony sottile
b13f8e37a3
add default for simplejson.JSONEncoder.iterencode ( #9135 )
...
4364525222/simplejson/encoder.py (L304)
2022-11-08 17:30:05 +00:00
Alex Waygood
739460291b
Use recursive type aliases in builtins and _typeshed ( #9134 )
2022-11-08 17:04:09 +00:00
Alex Waygood
efa1048d42
stubsabot: warn if stubtest is skipped in CI (for real this time) ( #9133 )
...
Fixes a bug in #8681 . The logic currently is broken; there should have been a warning message in the PR body for #9118 , but there wasn't.
2022-11-08 08:33:17 -08:00
Alex Waygood
4f381af4c5
Upgrade mypy to 0.990 ( #9123 )
2022-11-07 11:20:47 -08:00
Nikita Sobolev
94dc53ee90
Mark typed_ast as completed ( #9121 )
2022-11-07 18:34:23 +00:00
Nikita Sobolev
11be6effd3
Mark vobject as complete ( #9120 )
2022-11-07 14:24:18 +00:00
Jelle Zijlstra
68924e00e5
os: improve bytes handling ( #9072 )
2022-11-06 21:32:46 -08:00
Jelle Zijlstra
340eb1264b
unicodedata: accepts ReadOnlyBuffer ( #9106 )
2022-11-06 21:17:06 -08:00
Jelle Zijlstra
1d4eed1c9d
zipfile: improve bytes handling ( #9109 )
...
Technically some uses of `pwd` accept more types, but others
use `isinstance()` to enforce only `bytes`. It seems better to
keep the same type throughout the module.
2022-11-06 21:16:27 -08:00
Jelle Zijlstra
6639e2e14c
sqlite3: Blob.write accepts buffer ( #9097 )
2022-11-06 21:06:55 -08:00
Jonah Lawrence
157d818106
Added types for babel.core and babel.numbers ( #9111 )
2022-11-06 15:03:28 -08:00
Alex Waygood
658b6e7de0
PyInstaller: Fix DeprecationWarning when parsing the stub using ast.parse() (#9112 )
...
```python
>>> import ast, warnings
>>> warnings.filterwarnings("always")
>>> with open("typeshed/stubs/pyinstaller/pyi_splash/__init__.pyi", encoding="utf-8") as file:
... source = file.read()
...
>>> ast.parse(source)
<unknown>:11: DeprecationWarning: invalid escape sequence '\u'
<ast.Module object at 0x0000027EAF6D3AF0>
```
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-11-06 14:50:38 -08:00
Nikita Sobolev
5751b467e0
Remove ssl_match_hostname from pyright exclude ( #9116 )
2022-11-06 14:02:24 -08:00
Nikita Sobolev
4bff3e240b
Remove annoy from pyright excludelist ( #9114 )
2022-11-06 19:45:25 +00:00
Nikita Sobolev
449d8254d6
Remove aiofiles/aiofiles/threadpool/utils.pyi from pyright exclude ( #9113 )
2022-11-06 19:19:10 +00:00
Jelle Zijlstra
1f7648976c
unittest: cannot use bytes regexes ( #9107 )
...
```
>>> from unittest.case import TestCase
>>> c = TestCase()
>>> with c.assertRaisesRegex(Exception, b"x"): 1/0
...
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py", line 274, in __exit__
if not expected_regex.search(str(exc_value)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a bytes pattern on a string-like object
```
2022-11-05 14:14:53 -07:00
Jelle Zijlstra
3d64286f9e
winsound: accepts buffers ( #9108 )
...
b5f711185b/PC/winsound.c (L93)
2022-11-05 13:52:31 -07:00
Nikita Sobolev
10f05d3fb6
Remove aiofiles/tempfile/temptypes.pyi from pyright exclude ( #9104 )
2022-11-05 07:10:50 -07:00
Jelle Zijlstra
0e1ca279a4
struct: add missing pos-only markers ( #9099 )
2022-11-04 23:00:33 -07:00
Jelle Zijlstra
f678fac75a
tokenize: you can tokenize bytearrays too ( #9102 )
2022-11-04 22:59:05 -07:00
Jelle Zijlstra
cff08b674a
isort: Add more to extra_standard_library ( #9098 )
2022-11-04 22:56:40 -07:00
Jelle Zijlstra
7ef7029f88
smtplib: Improve bytes handling ( #9094 )
2022-11-04 20:08:10 -07:00
Nikita Sobolev
9f0d0b9af7
zipimport: improve bytes handling ( #9087 )
2022-11-04 17:58:59 -07:00
Samuel T
98dac4c926
pywin32: Improve some types ( #9089 )
2022-11-04 17:48:53 -07:00
github-actions[bot]
4329404b1c
[stubsabot] Bump SQLAlchemy to 1.4.43 ( #9092 )
...
Release: https://pypi.org/pypi/SQLAlchemy/1.4.43
Homepage: https://www.sqlalchemy.org
2022-11-05 00:40:39 +00:00
Jonah Lawrence
26841a8353
Add new functions for Babel 2.11.0 ( #9091 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-04 23:23:27 +00:00
Jelle Zijlstra
7299b07790
multiprocessing: improve bytes handling ( #9085 )
2022-11-04 10:58:58 +01:00
Nikita Sobolev
3ac147cf67
Mark zxcvbn as completed ( #9088 )
2022-11-04 09:16:59 +00:00
Jelle Zijlstra
2199115822
dateparser: add new parameter ( #9081 )
...
Fixes #9079
2022-11-03 19:53:54 -07:00
Nikita Sobolev
1d37b54441
Remove Send2Trash from pyright's exclude ( #8944 )
2022-11-03 13:41:37 -07:00
Nikita Sobolev
e68567a1b4
tarfile: improve bytes handling ( #9076 )
2022-11-03 10:15:46 -07:00
Nikita Sobolev
86f9d93003
Update pyright to 1.1.278 ( #9077 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-03 15:32:10 +00:00
Jelle Zijlstra
a17fa5001a
pickletools: accepts bytearray, use protocol from _typeshed ( #9073 )
2022-11-03 16:20:03 +01:00
Nikita Sobolev
27caa8f221
Mark hdbcli as complete ( #8904 )
2022-11-03 07:38:51 -07:00
Jelle Zijlstra
2f3f8da90a
msvcrt: improve bytes handling ( #9071 )
2022-11-03 12:11:36 +01:00
Jelle Zijlstra
43631078f0
importlib: improve bytes handling ( #9070 )
2022-11-03 12:00:24 +01:00
Jelle Zijlstra
82bf494534
quopri: improve types ( #9074 )
2022-11-03 11:37:59 +01:00
Alex Waygood
22c5afa2d2
http.server.SimpleHTTPRequestHandler: Fix version branching ( #9075 )
2022-11-03 11:17:50 +01:00
Jelle Zijlstra
6b702452b6
http: improve types ( #9055 )
2022-11-03 09:55:56 +01:00
Jelle Zijlstra
460158fc40
imaplib: _Authenticator also works with bytearray ( #9056 )
2022-11-02 20:55:41 -07:00
Alex Waygood
d1d1afbe3a
Bump flake8-bugbear; ignore flake8-bugbear in stub files ( #9069 )
2022-11-02 12:18:00 -07:00
Alex Waygood
401a7b929e
Bump various test dependencies; pin Python to <3.10 in CI to workaround pytype incompatibility ( #9068 )
2022-11-02 18:44:48 +00:00
Nikita Sobolev
d317458af6
Bump jsonschema to 4.17.* ( #9066 )
2022-11-02 17:41:14 +00:00
Nikita Sobolev
f972bdfd96
io, codecs: improve bytes handling ( #9059 )
2022-11-02 09:32:06 -07:00
Nikita Sobolev
ab9988a5ed
[stubsabot junior] Bump babel to 2.11.* ( #9064 )
2022-11-02 01:15:36 -07:00
Shantanu
a3ce512095
typing: remove metaclass from Sized ( #9058 )
...
as per https://github.com/python/typeshed/pull/8977#issuecomment-1297872394
2022-11-01 18:38:52 -07:00