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

Method one_line

tools/codestyle/docstring_checker.py:218–238  ·  view source on GitHub ↗

one_line checks if docstring (len < 40) is on one line. Args: node (astroid.node): The node visiting. Returns: True if successful otherwise False.

(self, node)

Source from the content-addressed store, hash-verified

216 return True
217
218 def one_line(self, node):
219 """one_line checks if docstring (len < 40) is on one line.
220 Args:
221 node (astroid.node): The node visiting.
222 Returns:
223 True if successful otherwise False.
224 """
225
226 doc = node.doc
227 if doc is None:
228 return True
229
230 if len(doc) > 40:
231 return True
232 elif sum(doc.find(nl) for nl in ('\n', '\r', '\n\r')) == -3:
233 return True
234 else:
235 self.add_message('W9001', node=node, line=node.fromlineno)
236 return False
237
238 return True
239
240 def has_period(self, node):
241 """has_period checks if one line doc end-with '.' .

Callers 1

check_doc_stringMethod · 0.95

Calls 1

findMethod · 0.80

Tested by

no test coverage detected