MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / with_raises

Method with_raises

tools/codestyle/docstring_checker.py:259–283  ·  view source on GitHub ↗

with_raises checks if one line doc end-with '.' . Args: node (astroid.node): the node is visiting. doc (Docstring): Docstring object. Returns: True if successful otherwise False.

(self, node, doc)

Source from the content-addressed store, hash-verified

257 return True
258
259 def with_raises(self, node, doc):
260 """with_raises checks if one line doc end-with '.' .
261 Args:
262 node (astroid.node): the node is visiting.
263 doc (Docstring): Docstring object.
264 Returns:
265 True if successful otherwise False.
266 """
267
268 find = False
269 for t in node.body:
270 if not isinstance(t, astroid.Raise):
271 continue
272
273 find = True
274 break
275
276 if not find:
277 return True
278
279 if len(doc.get_raises()) == 0:
280 self.add_message('W9008', node=node, line=node.fromlineno)
281 return False
282
283 return True
284
285 def with_returns(self, node, doc):
286 """with_returns checks if docstring comments what are returned .

Callers 1

visit_functiondefMethod · 0.95

Calls 1

get_raisesMethod · 0.80

Tested by

no test coverage detected