Added support for options in @spina, and prepare for new options.

Review Request #12904 — Created March 21, 2023 and submitted

Information

Spina
master

Reviewers

This updates the @spina decorator to support the kinds of options
available to base classes. Subclasses can now set names and apply
mixins.

A new _prepareSubclass handles the common functionality for the
mixins, and will soon handle new options as well for both base classes
and subclasses.

To support passing in options to the decrator, the bulk of the logic
from spinaSubclass has been moved into an internal
_makeSpinaSubclass function. The existing spinaSubclass now chooses
how to call that and what to return based on whether or not options are
provided. If options are provided, a function is returned that itself
take in the decorated class. This works much like how Python decorators
do.

We declare types for both variations of the decorator.

Tested this (along with upcoming changes) in Review Board, ensuring all
tests run.

Summary ID
Added support for options in @spina, and prepare for new options.
This updates the `@spina` decorator to support the kinds of options available to base classes. Subclasses can now set names and apply mixins. A new `_prepareSubclass` handles the common functionality for the mixins, and will soon handle new options as well for both base classes and subclasses. To support passing in options to the decrator, the bulk of the logic from `spinaSubclass` has been moved into an internal `_makeSpinaSubclass` function. The existing `spinaSubclass` now chooses how to call that and what to return based on whether or not options are provided. If options are provided, a function is returned that itself take in the decorated class. This works much like how Python decorators do. We declare types for both variations of the decorator.
2d2a81f519d87df4b8486f09b7d15a607ed7a61c
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (edbe8ba)
Loading...