Commit Graph

1081 Commits

Author SHA1 Message Date
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
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
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
10f05d3fb6 Remove aiofiles/tempfile/temptypes.pyi from pyright exclude (#9104) 2022-11-05 07:10:50 -07:00
Jelle Zijlstra
cff08b674a isort: Add more to extra_standard_library (#9098) 2022-11-04 22:56:40 -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
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
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
Nikita Sobolev
27caa8f221 Mark hdbcli as complete (#8904) 2022-11-03 07:38:51 -07:00
Jelle Zijlstra
43631078f0 importlib: improve bytes handling (#9070) 2022-11-03 12:00:24 +01:00
Nikita Sobolev
d317458af6 Bump jsonschema to 4.17.* (#9066) 2022-11-02 17:41:14 +00:00
Nikita Sobolev
ab9988a5ed [stubsabot junior] Bump babel to 2.11.* (#9064) 2022-11-02 01:15:36 -07:00
Nikita Sobolev
a7cf6144de Complete passpy stubs (#8959) 2022-11-01 12:37:21 +01:00
Nikita Sobolev
b91ebd3096 Remove pytz from pyrights exclude (#9041) 2022-10-31 21:08:41 -07:00
github-actions[bot]
7f476e1ddb [stubsabot] Bump pytz to 2022.6 (#9049)
Release: https://pypi.org/pypi/pytz/2022.6
Homepage: http://pythonhosted.org/pytz

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI

Co-authored-by: stubsabot <>
2022-11-01 00:31:32 +00:00
github-actions[bot]
70037c7cc0 [stubsabot] Bump regex to 2022.10.31 (#9050)
Release: https://pypi.org/pypi/regex/2022.10.31
Homepage: https://github.com/mrabarnett/mrab-regex
Diff: https://github.com/mrabarnett/mrab-regex/compare/2022.9.13...2022.10.31

Stubsabot analysis of the diff between the two releases:
 - Total lines of Python code added: 3.
 - Total lines of Python code deleted: 2.

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI

Co-authored-by: stubsabot <>
2022-11-01 00:27:58 +00:00
github-actions[bot]
4b11801b2c [stubsabot] Mark emoji as obsolete since 2.2.0 (#9051)
Release: https://pypi.org/pypi/emoji/2.2.0
Homepage: https://github.com/carpedm20/emoji/
Diff: https://github.com/carpedm20/emoji/compare/v2.1.0...v2.2.0

Co-authored-by: stubsabot <>
2022-11-01 00:26:33 +00:00
Sebastian Rittau
ac563c6641 Update caldav stubs to 0.10 (#9044) 2022-10-31 07:04:31 -07:00
Steve Dignam
1f191a6c13 stripe: test clocks resource (#9026)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-10-30 16:23:07 -07:00
Samuel T
a46c48136b pywin32 stubs update (#9040)
boolean methods
win32gui_struct
MonitorFromRect, FindWindow, FindWindowEx, GetWindowPlacement, GetMenuItemRect
2022-10-30 16:04:37 -07:00
github-actions[bot]
ded1090337 [stubsabot] Bump httplib2 to 0.21.* (#9038)
Release: https://pypi.org/pypi/httplib2/0.21.0
Homepage: https://github.com/httplib2/httplib2
Diff: https://github.com/httplib2/httplib2/compare/v0.20.4...v0.21.0

Stubsabot analysis of the diff between the two releases:
 - Total lines of Python code added: 77.
 - Total lines of Python code deleted: 21.

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI

Co-authored-by: stubsabot <>
2022-10-30 09:48:23 +00:00
github-actions[bot]
ef788b899d [stubsabot] Bump Pillow to 9.3.* (#9039)
Release: https://pypi.org/pypi/Pillow/9.3.0
Homepage: https://python-pillow.org
Changelog: https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst
Diff: https://github.com/python-pillow/Pillow/compare/9.2.0...9.3.0

Stubsabot analysis of the diff between the two releases:
 - Total lines of Python code added: 4163.
 - Total lines of Python code deleted: 3435.

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI

Co-authored-by: stubsabot <>
2022-10-30 01:29:38 +01:00
github-actions[bot]
921ddae863 [stubsabot] Mark prettytable as obsolete since 3.5.0 (#9023)
Release: https://pypi.org/pypi/prettytable/3.5.0
Homepage: https://github.com/jazzband/prettytable
Diff: https://github.com/jazzband/prettytable/compare/3.4.1...3.5.0

Co-authored-by: stubsabot <>
2022-10-28 17:30:44 -07:00
Shantanu
c5fe795c91 xmltodict: improve parse input types (#9018) 2022-10-28 21:46:46 +02:00
Shantanu
7edad955a2 typed-ast: fix get_docstring, allow buffer (#9019) 2022-10-28 11:05:16 -07:00
github-actions[bot]
f66da87c84 [stubsabot] Bump flake8-bugbear to 22.10.27 (#8992)
Release: https://pypi.org/pypi/flake8-bugbear/22.10.27
Homepage: https://github.com/PyCQA/flake8-bugbear
Changelog: https://github.com/PyCQA/flake8-bugbear#change-log
Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.10.25...22.10.27

Stubsabot analysis of the diff between the two releases:
 - 0 public Python files have been added.
 - 0 files included in typeshed's stubs have been deleted.
 - 1 file included in typeshed's stubs has been modified or renamed: `bugbear.py`.
 - Total lines of Python code added: 193.
 - Total lines of Python code deleted: 28.
2022-10-27 01:29:19 +01:00
Anton Grübel
84682a1d54 Add a couple of missing type hints in pyyaml.constructor (#8965) 2022-10-26 09:15:35 +02:00
Shantanu
7ba0479d75 colorama: fixes for latest version (#8987)
Fixes #8986
2022-10-25 17:57:01 -07:00
Brendan Graham
f4ef058169 google.protobuf: Add an __init__ stub to fix type checking (#8982) 2022-10-25 13:20:43 -07:00
Samuel T
8ca0394ead Bump pyinstaller to 5.6.* (#8981) 2022-10-25 06:39:32 -07:00
github-actions[bot]
e15e007d75 [stubsabot] Bump flake8-bugbear to 22.10.25 (#8980)
Release: https://pypi.org/pypi/flake8-bugbear/22.10.25
Homepage: https://github.com/PyCQA/flake8-bugbear
Changelog: https://github.com/PyCQA/flake8-bugbear#change-log
Diff: https://github.com/PyCQA/flake8-bugbear/compare/22.9.23...22.10.25

Stubsabot analysis of the diff between the two releases:
 - 1 public Python file has been added: `tests/b027.py`.
 - 0 files included in typeshed's stubs have been deleted.
 - 1 file included in typeshed's stubs has been modified or renamed: `bugbear.py`.
 - Total lines of Python code added: 194.
 - Total lines of Python code deleted: 35.
2022-10-25 01:35:20 +01:00
github-actions[bot]
ec39d71e61 [stubsabot] Bump flake8-typing-imports to 1.14.* (#8978)
Release: https://pypi.org/pypi/flake8-typing-imports/1.14.0
Homepage: https://github.com/asottile/flake8-typing-imports
Diff: https://github.com/asottile/flake8-typing-imports/compare/v1.13.0...v1.14.0

Stubsabot analysis of the diff between the two releases:
 - 0 public Python files have been added.
 - 0 files included in typeshed's stubs have been deleted.
 - 1 file included in typeshed's stubs has been modified or renamed: `flake8_typing_imports.py`.
 - Total lines of Python code added: 487.
 - Total lines of Python code deleted: 0.

If stubtest fails for this PR:
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
- Fix stubtest failures in another PR, then close this PR

Note that you will need to close and re-open the PR in order to trigger CI

Co-authored-by: stubsabot <>
2022-10-25 01:34:52 +01:00
Kyle Benesch
6aae57783a Fix pkg_resources.split_sections (#8975)
This function is currently documented as returning a list of lines as
the 2nd pair value.  It does not return plain str here.
2022-10-24 12:58:31 -07:00
Nikita Sobolev
45ccfbc9f3 Remove tree-sitter from pyright's exclude (#8946)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-10-24 09:48:54 -07:00
Shantanu
19f57a6e57 Remove tzlocal from pyright's exclude (#8969) 2022-10-23 14:30:57 +02:00
Alex Waygood
dc7fdc6f5d Fix invoke regression (#8950)
* Fix `invoke` regression
2022-10-21 18:04:22 +01:00
Peter Schutt
25810e1b11 Fixes redis.asyncio.client: AsyncIterator cannot be async def in stubs. (#8961)
Without the `yield` statement in the method body, these are interpreted by mypy as coroutines that return an `AsyncIterator`.

Closes #8960
2022-10-21 09:44:51 -07:00
Sebastian Rittau
fb2eb406a7 dateparser: add negative argument to get_date_from_timestamp (#8954)
Closes #8952
2022-10-21 00:45:53 -07:00
Nipunn Koorapati
f43ee406f1 Bump mypy-protobuf to 3.4.0 (#8951) 2022-10-21 01:26:57 +01:00