Axel H.
d634fc2f52
fix(yaml): SafeConstructor.construct_scalar accept MappingNode ( #13340 )
2024-12-29 18:17:02 -08:00
Stephen Morton
097581ea47
Update to mypy 1.14 ( #13272 )
2024-12-20 17:29:38 -08:00
stevenlele
2ccd254b81
PyYAML: correct return type of construct_scalar() ( #12664 )
2024-09-16 09:02:54 +02:00
Sebastian Rittau
92cc568325
[PyYAML] stubtest: Ignore auto-generated methods ( #12497 )
2024-08-07 11:28:37 +02:00
sobolevn
ce9f32db8d
Improve yaml/constructor.pyi types ( #12404 )
2024-07-23 14:08:47 +02:00
Shantanu
88fa182253
Use PEP 570 syntax in third party stubs ( #11554 )
2024-03-10 14:11:43 +01:00
Pascal Corpet
e6fb59c994
[PyYAML] type the whole Emitter class ( #10750 )
2023-09-23 07:07:09 -07:00
Sebastian Rittau
afe18e95a9
Add an upstream_repository field to METADATA.toml ( #10487 )
...
Closes : #10478
2023-07-20 16:45:41 +02:00
Sebastian Rittau
15df17098a
[PyYAML] Improve dump/serialize types ( #10196 )
...
* Add overloads to return `str` or `bytes`, instead of `Any`.
* Mark some arguments as keyword-only.
* Add missing default values.
2023-05-22 16:40:04 +02:00
Alex Waygood
6fd7e36e80
Add default values for third-party stubs beginning with 'P' ( #9957 )
2023-03-27 18:58:53 +01:00
Avasam
ed6748fb32
Stubtest settings: change ignore_missing_stub default to false ( #9779 )
...
If you're reading about this commit from an autogenerated changelog entry, this should have no user-visible impact on how the stubs are interpreted by a type checker; it's just an internal change to how typeshed's tests work.
2023-02-20 22:37:45 +00:00
Avasam
d92332d120
Type Loader parameter in PyYAML/yaml ( #9752 )
2023-02-19 19:22:14 +00:00
Bart van Merriënboer
8aa9b37a97
[PyYAML] Accept all iterables for dump_all functions ( #9725 )
2023-02-13 13:19:16 +01:00
Jelle Zijlstra
e17ee201f5
yaml: allow ReadableBuffer in represent_binary ( #9701 )
2023-02-09 16:03:49 +01:00
Avasam
f1aede7162
Manual changes of Any union to Incomplete in stubs folder ( #9566 )
...
- ClassVar[Any | None]
- Missed previous changes due to alias
- Manual review of leftover Any unions (`| Any` and `Any |`)
2023-02-02 06:48:41 -08:00
Alex Waygood
4fea314594
Replace Any with Incomplete in many places ( #9558 )
2023-01-18 08:48:16 +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
Anton Grübel
84682a1d54
Add a couple of missing type hints in pyyaml.constructor ( #8965 )
2022-10-26 09:15:35 +02:00
Alex Waygood
48e76e8a56
Bump mypy to 0.981 ( #8796 )
2022-09-26 17:14:33 -07:00
Kevin Kirsche
980b1954fd
PyYaml’s Serializer: annotate open, close, serialize (#8383 )
...
As seen here:
https://github.com/yaml/pyyaml/blob/master/lib/yaml/serializer.py#L27-L41
Neither `open` nor `close` methods return, so `None` added as the return type.
Finally, serialize accepts a Node and does not return as seen here:
https://github.com/yaml/pyyaml/blob/master/lib/yaml/serializer.py#L46-L58
2022-07-24 14:51:39 +01:00
Alex Waygood
6348a58b8b
Import Match and Pattern from re, not typing ( #8277 )
2022-07-12 15:32:48 +02:00
Shantanu
98882d3cbe
PyYAML: check missing defs ( #8159 )
2022-06-25 18:05:23 +01:00
Tomoki Nakagawa
461289e181
PyYAML: Add types to add_constructor ( #7989 )
2022-06-01 18:23:20 +01:00
Alex Waygood
b093c90a94
Use TypeAlias for type aliases where possible, part II ( #7667 )
2022-04-20 20:02:47 +01:00
Alex Waygood
740193a8fc
Use TypeAlias where possible for type aliases ( #7630 )
2022-04-15 18:01:00 -07:00
Alex Waygood
3ab250eec8
Use PEP 604 syntax wherever possible ( #7493 )
2022-03-16 16:01:33 +01:00
Sebastian Rittau
cb3c1bb638
Replace IO with protocols ( #7092 )
2022-01-31 11:39:56 +02:00
Alex Waygood
a40d79a4e6
Use lowercase type everywhere ( #6853 )
2022-01-08 16:09:29 +01:00
Steve Dignam
49e5b528dc
Add more type hints for pyyaml ( #6265 )
2021-11-12 12:23:58 +01:00
Sebastian Rittau
4e592ada7b
Upgrade PyYAML to version 6 ( #6183 )
...
* Fix load_all() argument
* Remove Python 2 remnants
+ Replace Text with str
+ Replace alias "_Str" with str
+ Import from collections.abc and re where applicable
+ Remove Python 2 branches
* Fix PyYaml allowlist entries
+ Add yaml._yaml and move CParser and CEmitter there.
+ Add missing functions, classes, and arguments.
* Use relative imports in some modules.
* Add __all__ to yaml.cyaml.
* Remove unnecessary noqa markers.
2021-10-22 20:05:58 +02:00
Akuli
994b69ef8f
Use lowercase tuple where possible ( #6170 )
2021-10-14 17:18:19 -07:00
Sebastian Rittau
9f86972350
Add star to all non-0.1 versions ( #6146 )
2021-10-11 13:41:19 -07:00
Akuli
6307bfd421
Delete yaml.CDangerLoader and yaml.CDangerDumper ( #5990 )
...
These no longer exist in PyYAML 4.2.
2021-09-01 10:50:30 +03:00
Ashley Whetter
026405b014
Add C{Full,Unsafe}Loader and UnsafeConstructor ( #5988 )
2021-09-01 00:50:31 +02:00
JP Sugarbroad
3dbaf34bd5
yaml.cyaml: Switch Optional to new pipe-based union ( #5971 )
2021-08-27 19:21:44 +02:00
JP Sugarbroad
07a58c3266
Add methods to yaml.cyaml.CParser ( #5963 )
2021-08-26 19:28:17 -07:00
Stanislav Schmidt
64903b85d7
PyYAML: fix yaml.add_foo() functions ( #5828 )
...
Added / modified types for the following functions:
- `add_implicit_resolver(...)`
- `add_path_resolver(...)`
- `add_constructor(...)`
- `add_multi_constructor(...)`
- `add_representer(...)`
- `add_multi_representer(...)`
* Remove yaml.add_constructor from allowlist
* Use TypeVars and overloads
2021-08-08 21:49:06 +03:00
Akuli
ce11072dbe
Big diff: use lower-case list and dict ( #5888 )
2021-08-08 09:26:35 -07:00
Akuli
ee487304d7
Big diff: Use new "|" union syntax ( #5872 )
2021-08-08 11:05:21 +02:00
Oleg Höfling
725b5ef71b
Loosen mapping as input type in mapping representer ( #5644 )
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com >
2021-06-16 12:05:43 +02:00
Oleg Höfling
5a1dbf7cee
loosen type restrictions for mapping representer input ( #5640 )
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com >
2021-06-15 15:35:12 +02:00
Oleg Höfling
03809dc604
Add type hints for representer registration functions ( #5636 )
...
bump version to the current major release of PyYAML
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com >
2021-06-14 17:53:59 +02:00
Oleg Höfling
b65fa0ed52
Add stubs for yaml.nodes and yaml.representer (py3) ( #5634 )
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com >
2021-06-14 16:13:45 +02:00
Oleg Höfling
0744d8c30a
Add stubs for yaml.error ( #5627 )
...
* type yaml.error
2021-06-13 15:13:42 +03:00
Shantanu
7244ea1f71
Test third party stubs with stubtest ( #5615 )
2021-06-13 00:17:40 +02:00
Sebastian Rittau
711580722b
Enable pyright for all Python 3 stubs ( #5597 )
...
* pyright: disable reportUnknownParameterType
Unknown parameter types are preferred over Any annotations for
incomplete stubs. Especially larger stubs are expected to be
incomplete for some time and it would be a shame to lose the
other pyright warnings for those stubs.
* Also disable reportUnknownVariableType
Fix problems with tkinter
* Disable reportUnknownMemberType
Fix pyright problems
2021-06-09 07:14:22 -07:00
Kaleb Barrett
2be836bf6d
Add yaml.UnsafeLoader ( #5441 )
2021-05-13 18:24:23 -07:00
Shantanu
fa9d5a5e9f
future first: switch the order of some if statements ( #5206 )
...
Since we're adding this to our contribution guidelines in
https://github.com/python/typeshed/pull/5205
2021-04-11 06:44:18 -07:00
Sorin Sbarnea
2d3bf41b18
Improve type for yaml composer ( #5144 )
2021-04-08 07:29:11 -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