|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -"""Classes representing each of the types of responses returned from |
16 | | -the Natural Language API. |
17 | | -""" |
| 15 | +"""Response types from the Natural Language API.""" |
18 | 16 |
|
19 | 17 | from google.cloud.language.entity import Entity |
20 | 18 | from google.cloud.language.sentence import Sentence |
@@ -76,7 +74,7 @@ def from_api_repr(cls, payload): |
76 | 74 | """ |
77 | 75 | return cls( |
78 | 76 | language=payload.get('language', None), |
79 | | - sentences=[Sentence.from_api_repr(i) for i |
| 77 | + sentences=[Sentence.from_api_repr(sentence) for sentence |
80 | 78 | in payload.get('sentences', ())], |
81 | 79 | sentiment=Sentiment.from_api_repr(payload['documentSentiment']), |
82 | 80 | ) |
@@ -109,8 +107,8 @@ def from_api_repr(cls, payload): |
109 | 107 | """ |
110 | 108 | return cls( |
111 | 109 | language=payload.get('language', None), |
112 | | - sentences=[Sentence.from_api_repr(i) for i in |
| 110 | + sentences=[Sentence.from_api_repr(sentence) for sentence in |
113 | 111 | payload.get('sentences', ())], |
114 | | - tokens=[Token.from_api_repr(i) for i in |
| 112 | + tokens=[Token.from_api_repr(token) for token in |
115 | 113 | payload.get('tokens', ())] |
116 | 114 | ) |
0 commit comments