Erlend E. Aasland
42c6300d4f
gh-104050: Argument Clinic: Annotate CLanguage.render_option_group_parsing() ( #106929 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-20 21:33:33 +00:00
Erlend E. Aasland
00e52acebd
gh-104683: Argument Clinic: Modernise parse_special_symbol() ( #106837 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-17 22:37:11 +00:00
Erlend E. Aasland
036bb73656
gh-104050: Improve Argument Clinic type annotation coverage ( #106810 )
...
Add various missing annotations in the following classes:
- BlockPrinter
- CConverter
- CLanguage
- FormatCounterFormatter
- Language
- _TextAccumulator
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-17 13:47:08 +02:00
Erlend E. Aasland
383dcbebcd
gh-104050: Argument Clinic: Annotate Clinic.parse() ( #106760 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-17 00:04:10 +00:00
Erlend E. Aasland
bbf6297985
gh-104050: Argument Clinic: Annotate BlockParser ( #106750 )
2023-07-15 10:11:32 +00:00
Erlend E. Aasland
7c95345e4f
gh-104050: Argument Clinic: Annotate `output_templates()` ( #106732 )
...
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-07-14 12:20:58 +00:00
Alex Waygood
128a6c1d88
gh-104683: Argument clinic: use an enum to describe the different kinds of functions ( #106721 )
...
Argument clinic: use an enum to describe the different kinds of functions
2023-07-13 22:54:05 +00:00
Erlend E. Aasland
2d43beec22
gh-104050: Argument Clinic: Annotate nested function parser_body() in the CLanguage class ( #106699 )
2023-07-12 22:49:30 +00:00
Alex Waygood
8aa4beaad0
gh-104683: Argument clinic: modernise `cpp.Monitor` ( #106698 )
2023-07-12 22:48:36 +00:00
Alex Waygood
a180e7a0df
gh-104050: Argument clinic: Annotate the `Destination` class ( #106655 )
...
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-12 22:33:47 +01:00
Alex Waygood
7ce3ea4906
gh-104683: Argument clinic: Minor readability improvements for `Destination.__init__` ( #106652 )
2023-07-11 23:08:28 +00:00
Alex Waygood
d0972c77aa
gh-104050: Argument Clinic: Annotate the `Block` class ( #106519 )
2023-07-11 21:21:14 +00:00
Alex Waygood
363f4f99c5
gh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses ( #106477 )
2023-07-07 13:10:07 +00:00
Alex Waygood
5548097925
gh-104683: clinic.py: refactor four simple classes as dataclasses ( #106476 )
2023-07-06 22:17:12 +01:00
Alex Waygood
d0c6ba956f
gh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` ( #106478 )
...
clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout`
2023-07-06 14:23:02 +01:00
Erlend E. Aasland
9d1d4f9c73
gh-64595: Fix regression in file write logic in Argument Clinic ( #106449 )
...
Revert the two commits that introduced the regressions:
- gh-104152
- gh-104507
2023-07-05 13:23:22 +02:00
Erlend E. Aasland
7bb9fa5ae4
gh-104050: Partially annotate Argument Clinic CLanguage class ( #106437 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 23:07:57 +00:00
Erlend E. Aasland
22087516bc
gh-104050: Annotate Argument Clinic parameter permutation helpers ( #106431 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 22:15:10 +00:00
Erlend E. Aasland
110b97c94c
gh-104050: Annotate toplevel functions in clinic.py ( #106435 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-04 22:13:30 +00:00
Erlend E. Aasland
8f6df5e9cb
gh-106368: Add tests for permutation helpers in Argument Clinic ( #106407 )
...
Added new test class PermutationTests()
2023-07-04 11:36:40 +00:00
Erlend E. Aasland
b24479dcba
gh-104050: Annotate more Argument Clinic DSLParser state methods ( #106376 )
...
Annotate the following methods:
- state_parameter()
- state_parameter_docstring_start()
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 22:10:46 +00:00
Erlend E. Aasland
71b40443fe
gh-104683: Modernise Argument Clinic parameter state machine ( #106362 )
...
Use enums and pattern matching to make the code more readable.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 21:16:21 +00:00
Erlend E. Aasland
2e2daac2f1
gh-104050: Add more type hints to Argument Clinic DSLParser() ( #106354 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 14:03:31 +00:00
Erlend E. Aasland
0da4c883cf
gh-106359: Fix corner case bugs in Argument Clinic converter parser ( #106361 )
...
DSLParser.parse_converter() could return unusable kwdicts in some rare cases
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-07-03 13:14:59 +00:00
Erlend E. Aasland
60e41a0cbb
gh-104146: Remove unused attr 'parameter_indent' from clinic.DLParser ( #106358 )
2023-07-03 11:00:35 +00:00
Erlend E. Aasland
18fedd04a7
gh-104050: Annotate Argument Clinic DSLParser attributes ( #106357 )
2023-07-03 10:06:54 +00:00
Erlend E. Aasland
569887aa9d
gh-104050: Add more type hints to Argument Clinic DSLParser() ( #106343 )
...
Annotate the following method signatures:
- state_dsl_start()
- state_parameter_docstring_start()
- state_parameters_start()
Inverting ignore_line() logic, add type hints (including type guard) to
it, and rename to valid_line().
2023-07-02 23:42:38 +00:00
dependabot[bot]
c336b4c14f
build(deps-dev): bump mypy from 1.3.0 to 1.4.1 in /Tools/clinic ( #106305 )
...
Bumps [mypy](https://github.com/python/mypy ) from 1.3.0 to 1.4.1.
- [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.1 )
---
updated-dependencies:
- dependency-name: mypy
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-01 09:54:32 +00:00
Victor Stinner
cbb9ba844f
gh-92536: Argument Clinic no longer emits PyUnicode_READY() ( #105208 )
...
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.
Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
2023-06-02 01:31:58 +02:00
Victor Stinner
dd29ae26f8
gh-105156: Argument Clinic avoids Py_UNICODE type ( #105161 )
...
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
2023-05-31 17:52:33 +00:00
Alex Waygood
4b107d86f3
gh-104683: clinic.py: Modernise `parse_converter()` using pattern-matching ( #104696 )
2023-05-21 23:29:43 +00:00
Erlend E. Aasland
6ba8406cb6
gh-104050: Add more type annotations to Argument Clinic ( #104631 )
...
Annotate methods of the following classes:
- class Function
- class Parameter
- class LandMine
2023-05-21 21:24:26 +00:00
Erlend E. Aasland
bf6dd8f5fd
gh-104050: Add basic type hints to Argument Clinic clinic class ( #104705 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-21 20:49:34 +00:00
Erlend E. Aasland
c482e9a4e6
gh-104050: Annotate Argument Clinic return converters ( #104706 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-21 20:23:14 +00:00
Erlend E. Aasland
27a68be77f
gh-104050: Add basic type hints to Argument Clinic DSL parser ( #104704 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-20 21:55:02 +00:00
Alex Waygood
19dd5aa89a
gh-104683: Modernise Tools/clinic/ ( #104684 )
...
- Make some string interpolations more readable using f-strings or
explicit parametrisation
- Remove unneeded open() mode specifiers
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-20 20:16:49 +00:00
Alex Waygood
663c049ff7
gh-104683: Modernise `clinic.py` using `str.removeprefix` and `str.removesuffix` ( #104685 )
...
Both methods were new in Python 3.9.
2023-05-20 11:08:28 +00:00
Erlend E. Aasland
ae147d01a0
gh-104146: Purge dead code from Argument Clinic ( #104680 )
...
The following local variables were assigned but never used:
- line 551: result
- line 1341: groups
- line 1431: default_return_converter
- line 1529: ignore_self
- line 1809: input_checksum
- line 4224: new'
---
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-20 10:52:32 +00:00
Alex Waygood
02b60035ce
gh-104683: Argument clinic: use `dict` over `OrderedDict` ( #104647 )
...
For code readability. Instances of `builtins.dict` have been ordered since 3.6, and have been guaranteed by the language to be ordered since Python 3.7. Argument Clinic now requires Python 3.10+.
2023-05-20 11:24:00 +01:00
Erlend E. Aasland
94c8edabd3
gh-104050: Add more type annotations to Argument Clinic ( #104628 )
...
Annotate the following:
- methods of class Class
- methods of class Module
- methods of class PythonParser
- function compute_checksum()
- function parse_file()
- global variable unsupported_special_methods
2023-05-18 22:57:26 +00:00
Alex Waygood
1c55e8d007
gh-104050: Improve some typing around `default`s and sentinel values ( #104626 )
...
- Convert `unspecified` and `unknown` to be members of a `Sentinels` enum, rather than instances of bespoke classes.
- An enum feels more idiomatic here, and works better with type checkers.
- Convert some `==` and `!=` checks for these values to identity checks, which are more idiomatic with sentinels.
- _Don't_ do the same for `Null`, as this needs to be a distinct type due to its usage in `clinic.py`.
- Use `object` as the annotation for `default` across `clinic.py`. `default` can be literally any object, so `object` is the correct annotation here.
---
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-18 21:58:42 +00:00
Erlend E. Aasland
61027c0211
gh-104146: Remove unused vars from Argument Clinic ( #104627 )
...
Remove 'in_classes' and 'so_far' from DSLParser.directive_module()
2023-05-18 21:52:59 +00:00
Erlend E. Aasland
2f369cafee
gh-104050: Add type hints to Argument Clinic converter keywords ( #104588 )
...
Introduce TypeSet, and use it to annotate the 'accept' keyword of
various C converters. Also add some missing return annotations for
converter init functions.
2023-05-17 21:05:22 +00:00
Erlend E. Aasland
0afc473f50
gh-104050: Add typing to Argument Clinic converters ( #104547 )
2023-05-16 22:32:11 +00:00
Nikita Sobolev
a454a6651b
gh-104050: Add more annotations to `Tools/clinic.py` ( #104544 )
2023-05-16 17:18:28 +00:00
Erlend E. Aasland
c22fced96c
gh-104050: Don't star-import 'types' in Argument Clinic ( #104543 )
2023-05-16 12:02:18 +00:00
Erlend E. Aasland
505e2954a9
gh-104050: Add basic typing to CConverter in clinic.py ( #104538 )
2023-05-16 11:47:35 +00:00
Erlend E. Aasland
cca90b6906
gh-64595: Fix write file logic in Argument Clinic ( #104507 )
...
Check if any clinic output actually changes any of the output files
before deciding if we should touch the source file.
2023-05-16 12:25:43 +02:00
dependabot[bot]
35bf0916d9
Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic ( #104501 )
...
build(deps-dev): bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic
Bumps [mypy](https://github.com/python/mypy ) from 1.2.0 to 1.3.0.
- [Commits](https://github.com/python/mypy/compare/v1.2.0...v1.3.0 )
---
updated-dependencies:
- dependency-name: mypy
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 09:17:48 +00:00
Alex Waygood
9d41f83c58
gh-104050: Run mypy on `clinic.py` in CI ( #104421 )
...
* Add basic mypy workflow to CI
* Make the type check pass
---------
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-15 08:49:28 +00:00