Skip to content
Snippets Groups Projects

Add support for inference of method arguments

Merged Daniel Williams requested to merge daniel-williams/bilby:master into master
All threads resolved!

This MR closes #409 (closed).

  • A new test has been added to ensure that method arguments are inferred correctly, complementing the same functionality for functions
  • A new function is provided, utils._infer_args_from_function_except_n_args to allow an arbitrary number of arguments to be ignored.
  • utils.infer_parameters_from_function has been updated to infer if a passed argument is a function or a method (or will raise a ValueError if it is neither.

The behaviour of utils.infer_parameters_from_function may not be considered optimal, as it will fail in the case that an object with a __call__() method is passed as an argument. If you're keen for this form to be supported I can add an additional case for it.

Edited by Daniel Williams

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Daniel Williams resolved all threads

    resolved all threads

  • added 1 commit

    Compare with previous version

  • So hopefully ace1c8d5 should resolve any remaining issue with excessive inline comments.

  • Colm Talbot approved this merge request

    approved this merge request

  • Gregory Ashton approved this merge request

    approved this merge request

  • Gregory Ashton mentioned in commit b04498c6

    mentioned in commit b04498c6

  • Please register or sign in to reply
    Loading