prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  ChunkedEncodingError is not retried when fetching data with list_rows()
  Original issue: https://github.com/googleapis/python-bigquery-storage/issues/242
  
  A user reported that they saw an error in production when fetching table data with `Client.list_rows()`. That method uses the [default retry object](https://github.com/googleapis/python-bigquery/blob/7e0e2bafc4c3f98a4246100f504fd78a01a28e7d/google/cloud/bigquery/retry.py#L49), which currently does not consider `requests.exceptions.ChunkedEncodingError` retryable.
  
  (it does retry `requests.exceptions.ConnectionError`, but `ChunkedEncodingError` is not a subclass of that.
  
  </issue>
  <code>
  [start of google/cloud/bigquery/retry.py]
  1 # Copyright 2018 Google LLC
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 from google.api_core import exceptions
  16 from google.api_core import retry
  17 from google.auth import exceptions as auth_exceptions
  18 import requests.exceptions
  19 
  20 
  21 _RETRYABLE_REASONS = frozenset(
  22     ["rateLimitExceeded", "backendError", "internalError", "badGateway"]
  23 )
  24 
  25 _UNSTRUCTURED_RETRYABLE_TYPES = (
  26     ConnectionError,
  27     exceptions.TooManyRequests,
  28     exceptions.InternalServerError,
  29     exceptions.BadGateway,
  30     requests.exceptions.ConnectionError,
  31     auth_exceptions.TransportError,
  32 )
  33 
  34 
  35 def _should_retry(exc):
  36     """Predicate for determining when to retry.
  37 
  38     We retry if and only if the 'reason' is 'backendError'
  39     or 'rateLimitExceeded'.
  40     """
  41     if not hasattr(exc, "errors") or len(exc.errors) == 0:
  42         # Check for unstructured error returns, e.g. from GFE
  43         return isinstance(exc, _UNSTRUCTURED_RETRYABLE_TYPES)
  44 
  45     reason = exc.errors[0]["reason"]
  46     return reason in _RETRYABLE_REASONS
  47 
  48 
  49 DEFAULT_RETRY = retry.Retry(predicate=_should_retry)
  50 """The default retry object.
  51 
  52 Any method with a ``retry`` parameter will be retried automatically,
  53 with reasonable defaults. To disable retry, pass ``retry=None``.
  54 To modify the default retry behavior, call a ``with_XXX`` method
  55 on ``DEFAULT_RETRY``. For example, to change the deadline to 30 seconds,
  56 pass ``retry=bigquery.DEFAULT_RETRY.with_deadline(30)``.
  57 """
  58
  [end of google/cloud/bigquery/retry.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/google/cloud/bigquery/retry.py b/google/cloud/bigquery/retry.py
  --- a/google/cloud/bigquery/retry.py
  +++ b/google/cloud/bigquery/retry.py
  @@ -27,6 +27,7 @@
       exceptions.TooManyRequests,
       exceptions.InternalServerError,
       exceptions.BadGateway,
  +    requests.exceptions.ChunkedEncodingError,
       requests.exceptions.ConnectionError,
       auth_exceptions.TransportError,
   )
  
verification_info: {"golden_diff": "diff --git a/google/cloud/bigquery/retry.py b/google/cloud/bigquery/retry.py\n--- a/google/cloud/bigquery/retry.py\n+++ b/google/cloud/bigquery/retry.py\n@@ -27,6 +27,7 @@\n     exceptions.TooManyRequests,\n     exceptions.InternalServerError,\n     exceptions.BadGateway,\n+    requests.exceptions.ChunkedEncodingError,\n     requests.exceptions.ConnectionError,\n     auth_exceptions.TransportError,\n )\n", "issue": "ChunkedEncodingError is not retried when fetching data with list_rows()\nOriginal issue: https://github.com/googleapis/python-bigquery-storage/issues/242\r\n\r\nA user reported that they saw an error in production when fetching table data with `Client.list_rows()`. That method uses the [default retry object](https://github.com/googleapis/python-bigquery/blob/7e0e2bafc4c3f98a4246100f504fd78a01a28e7d/google/cloud/bigquery/retry.py#L49), which currently does not consider `requests.exceptions.ChunkedEncodingError` retryable.\r\n\r\n(it does retry `requests.exceptions.ConnectionError`, but `ChunkedEncodingError` is not a subclass of that.\n", "before_files": [{"content": "# Copyright 2018 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom google.api_core import exceptions\nfrom google.api_core import retry\nfrom google.auth import exceptions as auth_exceptions\nimport requests.exceptions\n\n\n_RETRYABLE_REASONS = frozenset(\n    [\"rateLimitExceeded\", \"backendError\", \"internalError\", \"badGateway\"]\n)\n\n_UNSTRUCTURED_RETRYABLE_TYPES = (\n    ConnectionError,\n    exceptions.TooManyRequests,\n    exceptions.InternalServerError,\n    exceptions.BadGateway,\n    requests.exceptions.ConnectionError,\n    auth_exceptions.TransportError,\n)\n\n\ndef _should_retry(exc):\n    \"\"\"Predicate for determining when to retry.\n\n    We retry if and only if the 'reason' is 'backendError'\n    or 'rateLimitExceeded'.\n    \"\"\"\n    if not hasattr(exc, \"errors\") or len(exc.errors) == 0:\n        # Check for unstructured error returns, e.g. from GFE\n        return isinstance(exc, _UNSTRUCTURED_RETRYABLE_TYPES)\n\n    reason = exc.errors[0][\"reason\"]\n    return reason in _RETRYABLE_REASONS\n\n\nDEFAULT_RETRY = retry.Retry(predicate=_should_retry)\n\"\"\"The default retry object.\n\nAny method with a ``retry`` parameter will be retried automatically,\nwith reasonable defaults. To disable retry, pass ``retry=None``.\nTo modify the default retry behavior, call a ``with_XXX`` method\non ``DEFAULT_RETRY``. For example, to change the deadline to 30 seconds,\npass ``retry=bigquery.DEFAULT_RETRY.with_deadline(30)``.\n\"\"\"\n", "path": "google/cloud/bigquery/retry.py"}]}