prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Error in NL API, 'Sentiment' object has no attribute 'score'
  Upon executing the following code on GCE & locally I'm getting 'score' not found error locally while it works on GCE.
  
  ```
  def analyze_text(text):
      language_client = language.Client()
      document = language_client.document_from_text(text)
      annotations = document.annotate_text(include_sentiment=True)
      print(annotations.sentiment.score)
      print (annotations.sentiment.magnitude)
  ```
  
  Only difference I can find is on GCE, the gcloud version is different than the local
  **GCE gcloud**
  gcloud --version
  Google Cloud SDK 145.0.0
  alpha 2017.02.21
  app-engine-python 1.9.50
  beta 2017.02.21
  bq 2.0.24
  bq-nix 2.0.24
  core 2017.02.21
  core-nix 2017.02.21
  gcloud 
  gcloud-deps 2017.02.21
  gcloud-deps-linux-x86_64 2017.02.21
  gsutil 4.22
  gsutil-nix 4.22
  
  **Local gcloud**
  gcloud --version
  Google Cloud SDK 148.0.1
  bq 2.0.24
  bq-nix 2.0.24
  core 2017.03.24
  core-nix 2016.11.07
  gcloud 
  gcloud-deps 2017.03.17
  gcloud-deps-darwin-x86_64 2017.02.21
  gsutil 4.23
  gsutil-nix 4.19
  
  Debugging locally, the response from NL API consist of polarity property and not score.
  
  <img width="761" alt="image" src="https://cloud.githubusercontent.com/assets/1888535/24331449/62cbdbee-1252-11e7-9d29-8699df078fcf.png">
  
  
  
  </issue>
  <code>
  [start of language/google/cloud/language/sentiment.py]
  1 # Copyright 2016 Google Inc.
  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 """Definition for Google Cloud Natural Language API sentiment.
  16 
  17 Sentiment is the response to an ``analyzeSentiment`` request.
  18 """
  19 
  20 
  21 class Sentiment(object):
  22     """A Google Cloud Natural Language API sentiment object.
  23 
  24     .. _Sentiment message: https://cloud.google.com/natural-language/\
  25                            reference/rest/v1/Sentiment
  26     .. _Sentiment basics: https://cloud.google.com/natural-language/\
  27                           docs/basics#sentiment-analysis-values
  28 
  29     See `Sentiment message`_ and `Sentiment basics`_.
  30 
  31     :type score: float
  32     :param score: Score of the sentiment in the ``[-1.0, 1.0]`` range.
  33                      Larger numbers represent more positive sentiments.
  34 
  35     :type magnitude: float
  36     :param magnitude: A non-negative number in the ``[0, +inf)`` range, which
  37                       represents the absolute magnitude of sentiment
  38                       regardless of score (positive or negative).
  39     """
  40 
  41     def __init__(self, score, magnitude):
  42         self.score = score
  43         self.magnitude = magnitude
  44 
  45     @classmethod
  46     def from_api_repr(cls, payload):
  47         """Convert a Sentiment from the JSON API into a :class:`Sentiment`.
  48 
  49         :param payload: dict
  50         :type payload: The value from the backend.
  51 
  52         :rtype: :class:`Sentiment`
  53         :returns: The sentiment parsed from the API representation.
  54         """
  55         score = payload['score']
  56         magnitude = payload['magnitude']
  57         return cls(score, magnitude)
  58
  [end of language/google/cloud/language/sentiment.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/language/google/cloud/language/sentiment.py b/language/google/cloud/language/sentiment.py
  --- a/language/google/cloud/language/sentiment.py
  +++ b/language/google/cloud/language/sentiment.py
  @@ -52,6 +52,6 @@
           :rtype: :class:`Sentiment`
           :returns: The sentiment parsed from the API representation.
           """
  -        score = payload['score']
  +        score = payload.get('score', None)
           magnitude = payload['magnitude']
           return cls(score, magnitude)
  
verification_info: {"golden_diff": "diff --git a/language/google/cloud/language/sentiment.py b/language/google/cloud/language/sentiment.py\n--- a/language/google/cloud/language/sentiment.py\n+++ b/language/google/cloud/language/sentiment.py\n@@ -52,6 +52,6 @@\n         :rtype: :class:`Sentiment`\n         :returns: The sentiment parsed from the API representation.\n         \"\"\"\n-        score = payload['score']\n+        score = payload.get('score', None)\n         magnitude = payload['magnitude']\n         return cls(score, magnitude)\n", "issue": "Error in NL API, 'Sentiment' object has no attribute 'score'\nUpon executing the following code on GCE & locally I'm getting 'score' not found error locally while it works on GCE.\r\n\r\n```\r\ndef analyze_text(text):\r\n    language_client = language.Client()\r\n    document = language_client.document_from_text(text)\r\n    annotations = document.annotate_text(include_sentiment=True)\r\n    print(annotations.sentiment.score)\r\n    print (annotations.sentiment.magnitude)\r\n```\r\n\r\nOnly difference I can find is on GCE, the gcloud version is different than the local\r\n**GCE gcloud**\r\ngcloud --version\r\nGoogle Cloud SDK 145.0.0\r\nalpha 2017.02.21\r\napp-engine-python 1.9.50\r\nbeta 2017.02.21\r\nbq 2.0.24\r\nbq-nix 2.0.24\r\ncore 2017.02.21\r\ncore-nix 2017.02.21\r\ngcloud \r\ngcloud-deps 2017.02.21\r\ngcloud-deps-linux-x86_64 2017.02.21\r\ngsutil 4.22\r\ngsutil-nix 4.22\r\n\r\n**Local gcloud**\r\ngcloud --version\r\nGoogle Cloud SDK 148.0.1\r\nbq 2.0.24\r\nbq-nix 2.0.24\r\ncore 2017.03.24\r\ncore-nix 2016.11.07\r\ngcloud \r\ngcloud-deps 2017.03.17\r\ngcloud-deps-darwin-x86_64 2017.02.21\r\ngsutil 4.23\r\ngsutil-nix 4.19\r\n\r\nDebugging locally, the response from NL API consist of polarity property and not score.\r\n\r\n<img width=\"761\" alt=\"image\" src=\"https://cloud.githubusercontent.com/assets/1888535/24331449/62cbdbee-1252-11e7-9d29-8699df078fcf.png\">\r\n\r\n\n", "before_files": [{"content": "# Copyright 2016 Google Inc.\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\n\"\"\"Definition for Google Cloud Natural Language API sentiment.\n\nSentiment is the response to an ``analyzeSentiment`` request.\n\"\"\"\n\n\nclass Sentiment(object):\n    \"\"\"A Google Cloud Natural Language API sentiment object.\n\n    .. _Sentiment message: https://cloud.google.com/natural-language/\\\n                           reference/rest/v1/Sentiment\n    .. _Sentiment basics: https://cloud.google.com/natural-language/\\\n                          docs/basics#sentiment-analysis-values\n\n    See `Sentiment message`_ and `Sentiment basics`_.\n\n    :type score: float\n    :param score: Score of the sentiment in the ``[-1.0, 1.0]`` range.\n                     Larger numbers represent more positive sentiments.\n\n    :type magnitude: float\n    :param magnitude: A non-negative number in the ``[0, +inf)`` range, which\n                      represents the absolute magnitude of sentiment\n                      regardless of score (positive or negative).\n    \"\"\"\n\n    def __init__(self, score, magnitude):\n        self.score = score\n        self.magnitude = magnitude\n\n    @classmethod\n    def from_api_repr(cls, payload):\n        \"\"\"Convert a Sentiment from the JSON API into a :class:`Sentiment`.\n\n        :param payload: dict\n        :type payload: The value from the backend.\n\n        :rtype: :class:`Sentiment`\n        :returns: The sentiment parsed from the API representation.\n        \"\"\"\n        score = payload['score']\n        magnitude = payload['magnitude']\n        return cls(score, magnitude)\n", "path": "language/google/cloud/language/sentiment.py"}]}