Draft: Make the field parameter optional.
3 unresolved threads
3 unresolved threads
With field=None
the given function will be executed on all variables in saqc.data
. Unfortunately the type hints don't reflect this change, because of limitations in python decorator typing (see comment of saqc.core.register.register.outer`).
Solves #385 (closed)
Edited by David Schäfer
Merge request reports
Activity
Filter activity
changed milestone to %2.4.0
requested review from @palmb
assigned to @schaefed
314 320 itself. Mandatory for multivariate functions. 315 321 """ 316 322 323 # NOTE: 324 # def outer(func: Callable[Concatenate[SaQC, str, P], SaQC]) -> Callable[Concatenate[SaQC, str | None, P], SaQC]: 325 # This would in theory change the type of field from `str` to `str | None`. Unfortunately 326 # typing.Concatenate injects Keyword only arguments, which makes the typechecker unhappy 327 # with `flagFoo()` and only stops complaining on `flagRange(None)` 324 335 @functools.wraps(func) 325 336 def inner( 326 337 saqc, 327 field, 328 *args, 338 field: str | Sequence[str] | None = None, 339 *args: P.args, 329 340 regex: bool = False, 330 341 flag: ExternalFlag | OptionalNone = OptionalNone(), 331 **kwargs, 342 **kwargs: P.kwargs, 332 343 ) -> "SaQC": i would like to talk about this MR and the typehints problem
🙏 (via VC or real-world)Edited by Bert Palmchanged milestone to %Someday
mentioned in issue #417
changed milestone to %2.5.0