Repository: PennyLaneAI/pennylane

Issue:
[BUG] Documentation generated does not show the parameters for subclasses of Operation.
### Expected behavior

In docs I expect to see the specified parameters of an Operation.
![image](https://github.com/PennyLaneAI/pennylane/assets/78718539/ffb2ebe1-23f0-4dd7-b92c-16e747464d7e)

### Actual behavior

In docs I see *args, **kwargs  in place of the expected parameters.
![image](https://github.com/PennyLaneAI/pennylane/assets/78718539/b307e6c1-f164-4a87-99f1-060ba8608de2)

### Additional information

I traced this back to #5511, the commit before this #5595 creates the expected doc.
It seems like this is only affecting subclasses of Operation, for example qnode, QNode, DefaultQubit, etc. are unaffected.
There is no warning from sphinx autodoc.

### Source code

```shell
N/A
```


### Tracebacks

```shell
N/A
```


### System information

```shell
# The info here is of the earliest problematic version

Name: PennyLane
Version: 0.37.0.dev0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /home/gabri/anaconda3/envs/docs_5511/lib/python3.9/site-packages
Editable project location: /home/gabri/code/secondary_projects/pennylane_5511
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: PennyLane_Lightning

Platform info:           Linux-6.5.0-35-generic-x86_64-with-glibc2.38
Python version:          3.9.19
Numpy version:           1.26.3
Scipy version:           1.13.0
Installed devices:
- default.clifford (PennyLane-0.37.0.dev0)
- default.gaussian (PennyLane-0.37.0.dev0)
- default.mixed (PennyLane-0.37.0.dev0)
- default.qubit (PennyLane-0.37.0.dev0)
- default.qubit.autograd (PennyLane-0.37.0.dev0)
- default.qubit.jax (PennyLane-0.37.0.dev0)
- default.qubit.legacy (PennyLane-0.37.0.dev0)
- default.qubit.tf (PennyLane-0.37.0.dev0)
- default.qubit.torch (PennyLane-0.37.0.dev0)
- default.qutrit (PennyLane-0.37.0.dev0)
- default.qutrit.mixed (PennyLane-0.37.0.dev0)
- null.qubit (PennyLane-0.37.0.dev0)
- lightning.qubit (PennyLane-Lightning-0.36.0)
```


### Existing GitHub issues

- [X] I have searched existing GitHub issues to make sure the issue does not already exist.


Discussion:
Thanks for catching this @Gabriel-Bottrill .  

I am once again reminded that python black magic is indeed black magic and always has a cost.  Sorry about introducing that.  At least this does seem to have a fairly easy fix. I'll open a PR momentarily for it.

Resolving patch:
diff --git a/pennylane/capture/capture_meta.py b/pennylane/capture/capture_meta.py
--- a/pennylane/capture/capture_meta.py
+++ b/pennylane/capture/capture_meta.py
@@ -16,6 +16,7 @@
 
 See ``explanations.md`` for technical explanations of how this works.
 """
+from inspect import Signature, signature
 
 from .switches import enabled
 
@@ -29,6 +30,12 @@ class CaptureMeta(type):
     works.
     """
 
+    @property
+    def __signature__(cls):
+        sig = signature(cls.__init__)
+        without_self = tuple(sig.parameters.values())[1:]
+        return Signature(without_self)
+
     def _primitive_bind_call(cls, *args, **kwargs):
         raise NotImplementedError(
             "Types using CaptureMeta must implement cls._primitive_bind_call to"
diff --git a/pennylane/ops/qubit/non_parametric_ops.py b/pennylane/ops/qubit/non_parametric_ops.py
--- a/pennylane/ops/qubit/non_parametric_ops.py
+++ b/pennylane/ops/qubit/non_parametric_ops.py
@@ -204,8 +204,8 @@ class PauliX(Observable, Operation):
 
     _queue_category = "_ops"
 
-    def __init__(self, *params, wires=None, id=None):
-        super().__init__(*params, wires=wires, id=id)
+    def __init__(self, wires=None, id=None):
+        super().__init__(wires=wires, id=id)
         self._pauli_rep = qml.pauli.PauliSentence({qml.pauli.PauliWord({self.wires[0]: "X"}): 1.0})
 
     def label(self, decimals=None, base_label=None, cache=None):
@@ -391,8 +391,8 @@ class PauliY(Observable, Operation):
 
     _queue_category = "_ops"
 
-    def __init__(self, *params, wires=None, id=None):
-        super().__init__(*params, wires=wires, id=id)
+    def __init__(self, wires=None, id=None):
+        super().__init__(wires=wires, id=id)
         self._pauli_rep = qml.pauli.PauliSentence({qml.pauli.PauliWord({self.wires[0]: "Y"}): 1.0})
 
     def __repr__(self):
@@ -575,8 +575,8 @@ class PauliZ(Observable, Operation):
 
     _queue_category = "_ops"
 
-    def __init__(self, *params, wires=None, id=None):
-        super().__init__(*params, wires=wires, id=id)
+    def __init__(self, wires=None, id=None):
+        super().__init__(wires=wires, id=id)
         self._pauli_rep = qml.pauli.PauliSentence({qml.pauli.PauliWord({self.wires[0]: "Z"}): 1.0})
 
     def __repr__(self):


Test patch:
diff --git a/tests/capture/test_meta_type.py b/tests/capture/test_meta_type.py
--- a/tests/capture/test_meta_type.py
+++ b/tests/capture/test_meta_type.py
@@ -14,6 +14,8 @@
 """
 Unit tests for the CaptureMeta metaclass.
 """
+from inspect import signature
+
 # pylint: disable=protected-access, undefined-variable
 import pytest
 
@@ -51,11 +53,21 @@ class MyObj(metaclass=CaptureMeta):
         def _primitive_bind_call(cls, *args, **kwargs):
             return p.bind(*args, **kwargs)
 
+        def __init__(self, a: int, b: bool):
+            self.a = a
+            self.b = b
+
+    def f(a: int, b: bool):
+        # similar signature to MyObj but without init
+        return a + b
+
     jaxpr = jax.make_jaxpr(MyObj)(0.5)
 
     assert len(jaxpr.eqns) == 1
     assert jaxpr.eqns[0].primitive == p
 
+    assert signature(MyObj) == signature(f)
+
 
 def test_custom_capture_meta_no_bind_primitive_call():
     """Test that an NotImplementedError is raised if the type does not define _primitive_bind_call."""