autodiscover opmodes + opmode example (v2) - #301
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a47524d49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| target = next( | ||
| ( | ||
| symbols[(scope, path[0])][1] | ||
| for scope in scope_order | ||
| if (scope, path[0]) in symbols | ||
| ), | ||
| path[0], | ||
| ) | ||
| parent = ".".join((target, *path[1:])) |
There was a problem hiding this comment.
Track rebinding before rejecting a decorated base
When a scanned module imports a decorated class name and then rebinds that name before defining another class (for example, from external import Base; Base = Other; class Child(Base): ...), symbols still resolves Child to external.Base because assignments are not considered. _find_subclass consequently reports a subclass that does not exist at runtime and suppresses registration of the valid decorated OpMode. Only infer this relationship when the imported name has not subsequently been rebound, or account for intervening assignments.
Useful? React with 👍 / 👎.
Alternative to #260, there are aspects of this I like and aspects I don't like. Haven't reviewed yet.