Skip to content
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

feat: allow varargs callback for signals #22

Merged
merged 2 commits into from
Sep 19, 2022
Merged

Conversation

mdegat01
Copy link
Collaborator

The high level client currently does not support callbacks for signals with a varargs parameter. This adds support for that.

@mdegat01 mdegat01 added the enhancement New feature or request label Sep 15, 2022
@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Base: 80.42% // Head: 80.77% // Increases project coverage by +0.35% 🎉

Coverage data is based on head (eeb6a2d) compared to base (f4d173e).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   80.42%   80.77%   +0.35%     
==========================================
  Files          24       24              
  Lines        2799     2799              
  Branches      602      602              
==========================================
+ Hits         2251     2261      +10     
+ Misses        340      334       -6     
+ Partials      208      204       -4     
Impacted Files Coverage Δ
src/dbus_fast/proxy_object.py 76.51% <100.00%> (+4.54%) ⬆️
src/dbus_fast/message_bus.py 72.77% <0.00%> (+0.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -118,8 +118,10 @@ def _message_handler(self, msg):
def _add_signal(self, intr_signal, interface):
def on_signal_fn(fn):
fn_signature = inspect.signature(fn)
if not callable(fn) or len(fn_signature.parameters) != len(
Copy link
Collaborator Author

@mdegat01 mdegat01 Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to note that remove of not callable(fn) from here was intentional and is backwards compatible. That was never called. If fn was not callable then inspect.signature already raised a TypeError. I added a test confirm this behavior below.

@mdegat01 mdegat01 force-pushed the varargs-signal-callback branch from eced049 to eeb6a2d Compare September 15, 2022 19:43
@bdraco bdraco merged commit a3379c7 into main Sep 19, 2022
@bdraco bdraco deleted the varargs-signal-callback branch September 19, 2022 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants