Skip to content
Snippets Groups Projects

Draft: Make the field parameter optional.

Closed David Schäfer requested to merge optional_field into develop
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

Pipeline #145336 passed

Pipeline passed for 6e912695 on optional_field

Test coverage 77.00% (0.00%) from 1 job
Approval is optional
Test summary results are loading

Closed by David SchäferDavid Schäfer 1 year ago (Sep 5, 2023 6:00pm UTC)

Merge details

  • The changes were not merged into .

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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)`
  • Bert Palm
    Bert Palm @palmb started a thread on the diff
  • 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 Palm
  • Bert Palm marked this merge request as draft

    marked this merge request as draft

  • Bert Palm changed milestone to %Someday

    changed milestone to %Someday

  • Bert Palm mentioned in issue #417

    mentioned in issue #417

  • Bert Palm changed milestone to %2.5.0

    changed milestone to %2.5.0

  • closed

  • Please register or sign in to reply
    Loading