Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion canopen/sdo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class SdoClient(SdoBase):
#: Seconds to wait before sending a request, for rate limiting
PAUSE_BEFORE_SEND = 0.0

#: Seconds to wait after sending a request
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc nit:

Suggested change
#: Seconds to wait after sending a request
#: Seconds to wait after sending a request.

Copy link
Member

Choose a reason for hiding this comment

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

Please not. It's inconsistent with the other docs and just one more useless character in the source. Let's not get into such nit-picks :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

There are docstrings both with and without dots; I'm not sure if there is already consistency ;) Nits are nits; it is ok to ignore them :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me clarify: you are right that the docstrings are consistent, but the rendered docs are not consistent, since the docs for attributes and methods include correct punctuation. Up to you to if this needs cleaning up ;)

Copy link
Member

Choose a reason for hiding this comment

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

I think it doesn't need any action on our part. If the Sphinx automatically appends a period, that's fine and expected. Doxygen does likewise IIRC. Some Python style checkers (I'm using flake8) already point out inconsistencies in docstrings. Such as "missing period", "not a single sentence" or "not in imperative mood". There are no analogous conventions for attribute descriptions AFAIK, but it does make sense to not document them with an imperative sentence. Thus also no full-stop required. It's just a descriptive phrase.

PAUSE_AFTER_SEND = 0.1

def __init__(self, rx_cobid, tx_cobid, od):
"""
:param int rx_cobid:
Expand Down Expand Up @@ -56,7 +59,8 @@ def send_request(self, request):
if not retries_left:
raise
logger.info(str(e))
time.sleep(0.1)
Copy link
Member

Choose a reason for hiding this comment

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

You are in fact changing the default behavior here. What are the consequences? I'd hate breaking people's usage of the library because they are not aware of this change. There must be a reason why this delay was added. Although I completely agree it should be configurable.

Copy link
Collaborator Author

@sveinse sveinse May 16, 2024

Choose a reason for hiding this comment

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

That was actually unintentional. I meant it to initalize PAUSE_AFTER_SEND = 0.1 to not modify the behavior. I will update the PR.

Edit:. Fixed.

if self.PAUSE_AFTER_SEND:
time.sleep(self.PAUSE_AFTER_SEND)
else:
break

Expand Down