Change return typehint of BaseAnalysis.run to 'Self'
Explanation of changes
Changes the type hint of BaseAnalysis.run from BaseAnalysis to Self.
Motivation of changes
According to the docstring of .run, wach analysis class that inherits the BaseAnalysis can overwrite run to accept some configuration arguments:
from quantify_core.analysis.base_analysis import BaseAnalysis
class MyAnalysis(BaseAnalysis):
def run(self, optional_argument_one: float = 3.5e9):
# Save the value to be used in some step of the analysis
self.optional_argument_one = optional_argument_one
# Execute the analysis steps
self.execute_analysis_steps()
# Return the analysis object
return self
As a result, the type returned by .run is more constrained than BaseAnalysis, namely Self (see also PEP673).
Merge checklist
See also merge request guidelines
-
Merge request has been reviewed (in-depth by a knowledgeable contributor), and is approved by a project maintainer. -
New code is covered by unit tests (or N/A). -
New code is documented and docstrings use numpydoc format (or N/A). -
New functionality: considered making private instead of extending public API (or N/A). -
Public API changed: added @deprecated(or N/A). -
Newly added/adjusted documentation and docstrings render properly (or N/A). -
Pipeline fix or dependency update: post in #software-for-developerschannel to mergemainback in or update local packages (or N/A). -
Tested on hardware (or N/A). -
AUTHORS.mdhas been updated (or N/A). -
Windows tests in CI pipeline pass (manually triggered by maintainers before merging). - Maintainers do not hit Auto-merge, we need to actively check as manual tests do not block pipeline
For reference, the issues workflow is described in the contribution guidelines.