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

invert the logic from "skip" to "keep" - trying to improve readablility #215

Closed
wants to merge 3 commits into from

Conversation

dneise
Copy link
Member

@dneise dneise commented Oct 14, 2020

@maxnoe maybe this improves readability .. maybe not .. was just a try

@dneise dneise mentioned this pull request Oct 14, 2020
@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

Ok so this broke a test related to allowed_tels .. which I do not understand .. my changes should not have an effect there ... interresting

@maxnoe
Copy link
Member

maxnoe commented Oct 14, 2020

Yes, it does, you did not invert the logic in the skip check, so now it get's the wrong number of events I think

@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

I think I did invert it ... no? the new function check_keep says True when we want to keep the event.
And in line 171 where it is used, it says:

while not keep(event):
    read_next_event

@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

Lunch time 👍

@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

Ha, passed now ... I made a mistake before and replaced event.get('telescope_data') with "telescope_data" in event .. that was BS.

if event['type'] == 'data':
return self.skip_non_triggered and not event.get('telescope_events')
return self.keep_non_triggered or event.get('telescope_events')
Copy link
Member

Choose a reason for hiding this comment

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

This might now return the telescope events instead of a bool. It might not be important, but could be strange.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh!

Copy link
Member Author

@dneise dneise Oct 14, 2020

Choose a reason for hiding this comment

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

I've added is_event_triggered = bool(event.get('telescope_events')) ... since I must admit in the beginning I did not immediately understand why we get the telescope events there. :D

I think that fixes the issue you found and might even improve readability... what do you think?

@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

So @maxnoe do you think this conversion from "skip" to "keep" did improve anything with respect to readability? Or is it just in my brain and we should leave #214 as it is?

@maxnoe
Copy link
Member

maxnoe commented Oct 14, 2020

I would at least like to keep skip_integration, since that was already there before.

Then we have to ask if having two keyword arguments named skip_ with one having a double negative is better than one skip and one keep with no double negative.

I have the feeling that this will be very subjective.

@dneise
Copy link
Member Author

dneise commented Oct 14, 2020

Ah this is API changing? ... sorry I missed that.

Ok let's keep the skip_xxx and let's stick skip_xxx everywhere.

@dneise dneise closed this Oct 14, 2020
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