Skip to content

Conversation

@ddemidov
Copy link
Member

The first commit removes the __exit__ method from Device which has no use without the corresponding __enter__ method anyway (see https://www.python.org/dev/peps/pep-0343/). If this was intended to be a destructor, it should be called __del__, but that is not needed either, since default destructor should delete the file cache and close the file handles automatically.

The second commit exposes methods of the Device class as public, and makes the names compatible with boostc version of python bindings. If you don't like the new method names, we can discuss it, but I think it should be possible for the user to use raw Device class (hence, the methods should definitely be public).

The commit also gets rid of leading double underscores in private member names. See https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables.

See https://www.python.org/dev/peps/pep-0343/

The cached file handles should be closed by the
default destructor anyway.
And make it compatible with boostc version of python bindings.
Also get rid of leading double underscores in private member names.
See https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables
list(string) makes a list of characters contained in the string, and not
a list with single string entry as I thought.

Also, clean up self._path if no device was connected.
@ddemidov
Copy link
Member Author

I also found a bug in my initial implementation of Device._matches(). ef8c019 fixes that.

rhempel added a commit that referenced this pull request Oct 16, 2015
Expose public Device interface
@rhempel rhempel merged commit c2e016a into ev3dev:master Oct 16, 2015
@rhempel
Copy link
Member

rhempel commented Oct 16, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants