jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

What's the unit of keepalive interval? #170

Closed Urhengulas closed 3 years ago

Urhengulas commented 4 years ago

I couldn't figure out what the unit of the interval in irc.client.set_keepalive(interval) is. I would assume seconds, but don't want to rely on a assumption.

I guess it is a good idea to add this information into the doc-string. (Can take care of that of course)

Thanks for the answer in advance :smiley:

AiyionPrime commented 4 years ago

Hey @Urhengulas, I just skimmed through the code: set_keepalive() calls the reactors schedulers execute_every()s method, which in turn calls (per the default-implementation) the method 'after' of PeriodicCommand imported with the tempora package. In it, PeriodicCommand inherits the said method from DelayedCommand.

'So as one can easily see' :D the parameter delay is expected to be either seconds as you suspected, but may even be a datetime.timedelta object if you feel like it. This is true for all the earlier classes parameters that basically just hand the parameter through from interval.

Good luck with putting any of this in the docstring :)

Urhengulas commented 4 years ago

Thank you @AiyionPrime for your explanation. I just opened a small PR to add it to the docstring :smile: