-
Notifications
You must be signed in to change notification settings - Fork 79
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
Fix for issue 1184 #1185
base: master
Are you sure you want to change the base?
Fix for issue 1184 #1185
Conversation
…) are overwritten in subclasses
If I recall correctly, when we started working on ophyd we were using a metaclass for Device and multi-inherentance involving multiple-metaclasses results in Python telling you it is too complicated and refusing to do it. I think you could do it by making a MI meta-class of the meta-classes and then using that as the meta-class on the normally-MI'd class or something like that....so we chose to not use the second meta-class! When the subclass init hook became available we switch to using that (in the spirit of using the simplest language features we needed to get what we wanted) so I think that is why this now works. |
@@ -152,7 +147,8 @@ def low_limit(self): | |||
def high_limit(self): | |||
return self.limits[1] | |||
|
|||
def move(self, position, moved_cb=None, timeout=None): | |||
@abstractmethod | |||
def move(self, position, wait=False, moved_cb=None, timeout=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to do about the argument order here.
Adding wait
as the second positional arguement matches the order of EpicmMotor.move
and PseudoPositioner.move
but doing so is a major API breakage on this method (as if anyone was passing moved_cb
positionally then they would both not get there callback run but wait for the motion to finish!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same dilemma. I thought already implemented move
show how everybody is supposed to have it.
What about adding *
after position
to force use of keyword args ?
I agree it is an API change. On the other hand current situation is not ideal neither.
Another possibility is to move wait
argument at the end...
Following comment by @cappel89 , this MR proposes to define
PositionerBase
as an abstract class.This way, it would not be needed to mention
move()
method needs to be overwritten in a specific way, while stillhaving a default implementation that can be called in subclasses (must be done explicitely). Same with
.egu
property,no need to ask developer to overwrite it -> it would be done automatically by Python...
What do you think ?