-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ControllerAPI class to decouple transport from Controller #87
Open
GDYendell
wants to merge
2
commits into
main
Choose a base branch
from
dynamic-methods
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Nov 20, 2024
Closed
|
2 tasks
b34a45a
to
fedfb44
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
+ Coverage 87.84% 89.00% +1.16%
==========================================
Files 33 34 +1
Lines 1456 1519 +63
==========================================
+ Hits 1279 1352 +73
+ Misses 177 167 -10 ☔ View full report in Codecov by Sentry. |
07d6568
to
31e8269
Compare
908f281
to
3af55df
Compare
3af55df
to
973d2bf
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes a few key parts of the internal logic to make the static typing more robust and to improve the driver API.
It is now possible to dynamically create
Method
s as well asAttribute
s. This is shown in the new test here where aCommand
is added to aController
duringinitialise
.The new
Command
,Put
andScan
methods enable decoupling theController
from the transport layer via a newControllerAPI
class, which replaces and extends the oldSingleMapping
class. The differences being:ControllerAPI
doesn't need a reference to theController
- it is entirely self contained because the methods are dynamically bound to the controller instance and can be called outside the context of the class.ControllerAPI
maintains the tree structure from theControllers
whereSingleMapping
flattened itSummary of changes:
Controller.get_controller_mappings
->ControllerAPI.walk_api
SingleMapping.{attributes,command_methods,put_methods,scan_methods}
->ControllerAPI.{attributes,command_methods,put_methods,scan_methods}
SingleMapping.Controller.path
->ControllerAPI.path
{Command,Put,Scan}.fn
is now callable directly. Don't doMethodType(method, controller)
orgetattr(controller, method.__name__)()
.for Controller in SingleMapping.Controller.get_sub_controllers()
->for ControllerAPI in ControllerAPI.sub_apis()
Fixes #74
Fixes #60
Fixes #93
Fixes #62