Skip to content

require_protpardelle decorator does not support bare @decorator usage #284

Description

@coderabbitai

Summary

In src/sampleworks/utils/imports.py, the require_protpardelle decorator factory (added around lines 187-230) only supports the parenthesized form @require_protpardelle("message"). When used as a bare decorator, @require_protpardelle, the decorated function object is passed in as the message argument instead of being wrapped, so the function is never actually wrapped/protected. The docstring's first example (@require_protpardelle) is therefore misleading and does not work as documented.

Rationale

The same pattern is used for the other require_* decorators (require_boltz, require_protenix, require_rf3) in the same file, so they likely share this issue, but this report focuses on require_protpardelle per the originating review comment.

Affected area

  • File: src/sampleworks/utils/imports.py
  • Function: require_protpardelle (and docstring examples)

Suggested fix

Either:

  1. Update require_protpardelle to detect when the first positional argument is a callable (bare decorator usage) vs. a string message, and branch accordingly to support both @require_protpardelle and @require_protpardelle("message"), or
  2. Remove/correct the bare-decorator example in the docstring so only the parenthesized form @require_protpardelle() is documented/supported.

Acceptance criteria

  • require_protpardelle works correctly when used as @require_protpardelle (bare) or docstring is updated to remove that example.
  • require_protpardelle("custom message") continues to work as before.
  • Docstring examples accurately reflect supported usage.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions