gemini-code-assist[bot] commented on code in PR #39109:
URL: https://github.com/apache/beam/pull/39109#discussion_r3476364145


##########
sdks/python/apache_beam/io/requestresponse.py:
##########
@@ -375,7 +375,8 @@ def process(self, request: RequestT, *args, **kwargs):
       response = self._repeater.repeat(
           self._caller, request, self._timeout, self._metrics_collector)
       self._metrics_collector.responses.inc(1)
-      self._throttler.throttler.successful_request(req_time * MSEC_TO_SEC)
+      if self._throttler:
+        self._throttler.throttler.successful_request(req_time * MSEC_TO_SEC)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   According to PEP 8, comparisons to singletons like `None` should always be 
done with `is` or `is not`, never the equality operators or implicit truthiness 
checks, especially when testing whether an optional variable or argument that 
defaults to `None` was set. Using `is not None` is safer and more explicit.
   
   ```suggestion
         if self._throttler is not None:
           self._throttler.throttler.successful_request(req_time * MSEC_TO_SEC)
   ```
   
   <details>
   <summary>References</summary>
   
   1. PEP 8: Comparisons to singletons like None should always be done with 
'is' or 'is not', never the equality operators. Also, beware of writing 'if x' 
when you really mean 'if x is not None'. 
<sup>([link](https://github.com/apache/beam/blob/master/.gemini/styleguide.md))</sup>
   </details>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to