Skip to content
Closed
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
4 changes: 3 additions & 1 deletion pymongo/socket_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def select(self, sock, read=False, write=False, timeout=0):
try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please update this method's docstring to say:

        """Select for reads or writes with a timeout in seconds (or None).

# poll() timeout is in milliseconds. select()
# timeout is in seconds.
res = self._poller.poll(timeout * 1000)
# socket.getdefaulttimeout() can return None
timeout_ = timeout * 1000 if timeout is not None else None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggest reversing the if/else to shorten the line to <80 chars:

timeout_ = None if timeout is None else timeout * 1000

res = self._poller.poll(timeout_)
# poll returns a possibly-empty list containing
# (fd, event) 2-tuples for the descriptors that have
# events or errors to report. Return True if the list
Expand Down