def py__doc__(self, include_call_signature=False): try: self.tree_node.get_doc_node except AttributeError: return '' else: if include_call_signature: return get_doc_with_call_signature(self.tree_node) else: return clean_scope_docstring(self.tree_node) return None
def test_hex_values_in_docstring(): source = r''' def foo(object): """ \xff """ return 1 ''' doc = parser_utils.clean_scope_docstring( next(parse(source).iter_funcdefs())) assert doc == '\xff'
def py__doc__(self, include_signatures=False): if self.api_type in ('function', 'class'): return clean_scope_docstring(self.tree_name.get_definition()) if self.api_type == 'statement' and self.tree_name.is_definition(): return find_statement_documentation( self.tree_name.get_definition()) if self.api_type == 'module': names = self.goto() if self not in names: return _merge_name_docs(names) return super(TreeNameDefinition, self).py__doc__(include_signatures)
def test_hex_values_in_docstring(): source = r''' def foo(object): """ \xff """ return 1 ''' doc = parser_utils.clean_scope_docstring(next(parse(source).iter_funcdefs())) if is_py3: assert doc == '\xff' else: assert doc == u'�'
def py__doc__(self): api_type = self.api_type if api_type in ('function', 'class'): # Make sure the names are not TreeNameDefinitions anymore. return clean_scope_docstring(self.tree_name.get_definition()) if api_type == 'module': names = self.goto() if self not in names: return _merge_name_docs(names) if api_type == 'statement' and self.tree_name.is_definition(): return find_statement_documentation(self.tree_name.get_definition()) return ''
def test_hex_values_in_docstring(): source = r''' def foo(object): """ \xff """ return 1 ''' doc = clean_scope_docstring(next(parse(source).iter_funcdefs())) if is_py3: assert doc == '\xff' else: assert doc == u('�')
def py__doc__(self): api_type = self.api_type if api_type in ('function', 'class', 'property'): if self.parent_context.get_root_context().is_stub(): from jedi.inference.gradual.conversion import convert_names names = convert_names([self], prefer_stub_to_compiled=False) if self not in names: return _merge_name_docs(names) # Make sure the names are not TreeNameDefinitions anymore. return clean_scope_docstring(self.tree_name.get_definition()) if api_type == 'module': names = self.goto() if self not in names: return _merge_name_docs(names) if api_type == 'statement' and self.tree_name.is_definition(): return find_statement_documentation(self.tree_name.get_definition()) return ''
def test_fake_docstr(): node = compiled.create(_evaluator(), next).tree_node assert clean_scope_docstring(node) == next.__doc__