nocarryr / python-dispatch

Lightweight event handling for Python
https://python-dispatch.readthedocs.io
MIT License
39 stars 3 forks source link

Added AliasProperty and tests #10

Open leonwilly opened 3 years ago

leonwilly commented 3 years ago

Added an AliasProperty similar to Kivy but without the kv language specific attributes. This required refactoring the __new__ method of the Dispatcher class. The bind argument to AliasProperty requires properties to _add_instance in declaration order. The builtin dir() method doesn't list attributes in declaration order. Now the __dict__ property of the class is used for detecting properties. I also changed the iteration of base classes to use the __mro__ since that is the correct inheritance order already unraveled.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-3.6%) to 94.298% when pulling ca0a48d6853640a893ec3d35ce17574b65cc4645 on gabewillen:master into 030941b5cee9b8bf7549597cb49b891dac6b676f on nocarryr:master.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-2.3%) to 95.63% when pulling ca0a48d6853640a893ec3d35ce17574b65cc4645 on gabewillen:master into 030941b5cee9b8bf7549597cb49b891dac6b676f on nocarryr:master.

nocarryr commented 3 years ago

I like the concept, and the updated introspection in __new__. Definitely worth having.

Do you mind removing the unrelated changes from this PR though? Your code editor included quite a bit of PEP8 corrections and while I don't disagree with a little linting, I'd rather it be separate from this change (makes it less clear what you've actually altered).

leonwilly commented 3 years ago

I like the concept, and the updated introspection in __new__. Definitely worth having.

Do you mind removing the unrelated changes from this PR though? Your code editor included quite a bit of PEP8 corrections and while I don't disagree with a little linting, I'd rather it be separate from this change (makes it less clear what you've actually altered).

About the linting I apologize I even read your contributing guide and was trying to keep things styled the same. PyCharm automatically refactors the code and I forgot to disable that. I'll remove the linting applied by PyCharm and update the pull request.

nocarryr commented 3 years ago

About the linting I apologize I even read your contributing guide and was trying to keep things styled the same. PyCharm automatically refactors the code and I forgot to disable that. I'll remove the linting applied by PyCharm and update the pull request.

No worries. I also noticed you're working off of the master branch of your fork. This will cause headaches for you later on if you try to keep things in sync with this repo (I made the same mistake for my first PR).

Not sure if you want to deal with that now (would be easier for you, but it'd be a separate PR) or later (would require some git rebase and force push magic).