MCPcopy Create free account
hub / github.com/dialect-app/dialect / suggest

Method suggest

dialect/providers/modules/libretrans.py:126–144  ·  view source on GitHub ↗
(self, text, src, dest, suggestion)

Source from the content-addressed store, hash-verified

124 raise UnexpectedError from exc
125
126 async def suggest(self, text, src, dest, suggestion):
127 src, dest = self.denormalize_lang(src, dest)
128
129 # Form data
130 data = {
131 "q": text,
132 "source": src,
133 "target": dest,
134 "s": suggestion,
135 }
136 if self.api_key and ProviderFeature.API_KEY in self.features:
137 data["api_key"] = self.api_key
138
139 # Do request
140 response = await self.post(self.suggest_url, data, form=True)
141 try:
142 return response.get("success", False)
143 except: # noqa
144 return False
145
146 def check_known_errors(self, status, data):
147 if not data:

Callers

nothing calls this directly

Calls 3

denormalize_langMethod · 0.80
postMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected