diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2023-11-06 19:22:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 10:22:29 -0800 |
commit | 1235084c20f1efabbca680c03f9f4dc023b44c5d (patch) | |
tree | 9ffad09e95686a17ca7cc030a5bc4eb1530dd1b5 /NOTICE | |
parent | b5538960c325a849bddc35506e4c219cee40a1d8 (diff) | |
download | spack-1235084c20f1efabbca680c03f9f4dc023b44c5d.tar.gz spack-1235084c20f1efabbca680c03f9f4dc023b44c5d.tar.bz2 spack-1235084c20f1efabbca680c03f9f4dc023b44c5d.tar.xz spack-1235084c20f1efabbca680c03f9f4dc023b44c5d.zip |
Introduce `default_args` context manager (#39964)
This adds a rather trivial context manager that lets you deduplicate repeated
arguments in directives, e.g.
```python
depends_on("py-x@1", when="@1", type=("build", "run"))
depends_on("py-x@2", when="@2", type=("build", "run"))
depends_on("py-x@3", when="@3", type=("build", "run"))
depends_on("py-x@4", when="@4", type=("build", "run"))
```
can be condensed to
```python
with default_args(type=("build", "run")):
depends_on("py-x@1", when="@1")
depends_on("py-x@2", when="@2")
depends_on("py-x@3", when="@3")
depends_on("py-x@4", when="@4")
```
The advantage is it's clear for humans, the downside it's less clear for type checkers due to type erasure.
Diffstat (limited to 'NOTICE')
0 files changed, 0 insertions, 0 deletions