Skip to content

Conversation

tristanlatr
Copy link
Contributor

Fixes #813

tristanlatr and others added 30 commits May 20, 2022 02:49
This attribute was used to attach the right docstring node to the right Attribute object. Now it uses AST node navigation (with the .parent attribute) instead for fetching the docstring node for an ast.Assign.

This change might not be worth it, on the one hand it removes a attribute beeing mutated at different palces in the code, but replaces this kind of "unsafe" state tracking (meaning not with pop() and push()) by some more verbose solution that involves adding the .parent attribute on all nodes.

The zopeinferface extension needed to be adjusted as well because it relied on the docstring assigment feature in an implicit way, now it's explicit what we're doing.
…hpinx... Refactor for a better separation of docstring sources. And add a test.
@tristanlatr tristanlatr added the pending This ticket needs code related to another ticket not yet fixed label Sep 22, 2024
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 89.92806% with 14 lines in your changes missing coverage. Please review.

Project coverage is 91.99%. Comparing base (5be6898) to head (ed1fc41).

Files with missing lines Patch % Lines
pydoctor/astutils.py 87.73% 8 Missing and 5 partials ⚠️
pydoctor/astbuilder.py 96.96% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #815      +/-   ##
==========================================
- Coverage   92.03%   91.99%   -0.05%     
==========================================
  Files          47       47              
  Lines        8465     8590     +125     
  Branches     1868     1897      +29     
==========================================
+ Hits         7791     7902     +111     
- Misses        395      403       +8     
- Partials      279      285       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This comment has been minimized.

Comment on lines +3284 to +3323

@systemcls_param
def test_doc_comment_multiple_assigments(systemcls: Type[model.System], capsys: CapSys) -> None:
# TODO: this currently does not support nested tuple assignments.
src = '''
class C:
def __init__(self):
self.x, x = 1, 1 #: x docs
self.y = x = 1 #: y docs
x,y = 1,1 #: x and y docs
v = w = 1 #: v and w docs
'''
mod = fromText(src, systemcls=systemcls)
assert not capsys.readouterr().out
assert mod.contents['x'].docstring == 'x and y docs'
assert mod.contents['y'].docstring == 'x and y docs'
assert mod.contents['v'].docstring == 'v and w docs'
assert mod.contents['w'].docstring == 'v and w docs'
assert mod.contents['C'].contents['x'].docstring == 'x docs'
assert mod.contents['C'].contents['y'].docstring == 'y docs'

@systemcls_param
def test_other_encoding(systemcls: Type[model.System], capsys: CapSys) -> None:
# Test for issue https://github.com/twisted/pydoctor/issues/805
# We're missing support for other kind of encodings.
processPackage('coding_not_utf8',
systemcls=lambda: systemcls(model.Options.from_args(['-q'])))
assert not capsys.readouterr().out

@systemcls_param
def test_alias_resets_attribute_state(systemcls: Type[model.System], capsys:CapSys) -> None:
# from https://github.com/lxml/lxml/blob/a56babb0013dc46baf480f49ebd5cc1ab65bc418/src/lxml/html/builder.py
src = '''
E = True #: Legit docstring
A = E.a #: trash1
ABBR = E.abbr #: trash2
'''
fromText(src, systemcls=systemcls)
assert not capsys.readouterr().out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@systemcls_param
def test_doc_comment_multiple_assigments(systemcls: Type[model.System], capsys: CapSys) -> None:
# TODO: this currently does not support nested tuple assignments.
src = '''
class C:
def __init__(self):
self.x, x = 1, 1 #: x docs
self.y = x = 1 #: y docs
x,y = 1,1 #: x and y docs
v = w = 1 #: v and w docs
'''
mod = fromText(src, systemcls=systemcls)
assert not capsys.readouterr().out
assert mod.contents['x'].docstring == 'x and y docs'
assert mod.contents['y'].docstring == 'x and y docs'
assert mod.contents['v'].docstring == 'v and w docs'
assert mod.contents['w'].docstring == 'v and w docs'
assert mod.contents['C'].contents['x'].docstring == 'x docs'
assert mod.contents['C'].contents['y'].docstring == 'y docs'
@systemcls_param
def test_other_encoding(systemcls: Type[model.System], capsys: CapSys) -> None:
# Test for issue https://github.com/twisted/pydoctor/issues/805
# We're missing support for other kind of encodings.
processPackage('coding_not_utf8',
systemcls=lambda: systemcls(model.Options.from_args(['-q'])))
assert not capsys.readouterr().out
@systemcls_param
def test_alias_resets_attribute_state(systemcls: Type[model.System], capsys:CapSys) -> None:
# from https://github.com/lxml/lxml/blob/a56babb0013dc46baf480f49ebd5cc1ab65bc418/src/lxml/html/builder.py
src = '''
E = True #: Legit docstring
A = E.a #: trash1
ABBR = E.abbr #: trash2
'''
fromText(src, systemcls=systemcls)
assert not capsys.readouterr().out

Copy link

Diff from pydoctor_primer, showing the effect of this PR on open source code:

ConfigArgParse (https://github.com/bw2/ConfigArgParse)
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'

attrs (https://github.com/python-attrs/attrs)
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 408, in visit_ImportFrom
+     self._importNames(modname, node.names)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 515, in _importNames
+     self.system.getProcessedModule(f'{modname}.{orgname}')
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1642, in getProcessedModule
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 408, in visit_ImportFrom
+     self._importNames(modname, node.names)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 495, in _importNames
+     mod = self.system.getProcessedModule(modname)
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1642, in getProcessedModule
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'
- /projects/attrs/src/attr/_make.py:2408: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_make.py:2408: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_make.py:2419: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_make.py:2419: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_make.py:389: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/_make.py:389: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/filters.py:13: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/_make.py:1349: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_make.py:1349: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: No role entry for "doc" in module "docutils.parsers.rst.languages.en".
- Trying "doc" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: Unknown interpreted text role "doc".
- /projects/attrs/src/attr/_next_gen.py:54: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:54: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:299: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:299: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_next_gen.py:353: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:353: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:500: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:500: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_next_gen.py:557: bad docstring: No role entry for "ref" in module "docutils.parsers.rst.languages.en".
- Trying "ref" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:557: bad docstring: Unknown interpreted text role "ref".
- /projects/attrs/src/attr/_funcs.py:48: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:48: Cannot find link target for "False"
- /projects/attrs/src/attr/_funcs.py:58: Cannot find link target for "list"
- /projects/attrs/src/attr/_funcs.py:59: Cannot find link target for "tuple"
- /projects/attrs/src/attr/_funcs.py:59: Cannot find link target for "set"
- /projects/attrs/src/attr/_funcs.py:59: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:252: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:252: Cannot find link target for "False"
- /projects/attrs/src/attr/_funcs.py:261: Cannot find link target for "list"
- /projects/attrs/src/attr/_funcs.py:261: Cannot find link target for "dict"
- /projects/attrs/src/attr/_funcs.py:262: Cannot find link target for "tuple"

... (truncated 112 lines) ...

twine (https://github.com/pypa/twine)
- /projects/twine/twine/commands/check.py:122: Documented parameter "output_stream" does not exist
- /projects/twine/twine/repository.py:191: Cannot find link target for "~twine.package.PackageFile" (you can link to external docs with --intersphinx)
- /projects/twine/twine/settings.py:38: Cannot find link target for "TypeError"
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'

coco (https://github.com/numbbo/coco): typechecking got 8.83x faster (29.5s -> 3.3s)
(Performance measurements are based on a single noisy sample)
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 406, in visit_ImportFrom
+     self._importAll(modname)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 415, in _importAll
+     mod = self.system.getProcessedModule(modname)
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1642, in getProcessedModule
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 408, in visit_ImportFrom
+     self._importNames(modname, node.names)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 495, in _importNames
+     mod = self.system.getProcessedModule(modname)
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1642, in getProcessedModule
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 408, in visit_ImportFrom
+     self._importNames(modname, node.names)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 515, in _importNames
+     self.system.getProcessedModule(f'{modname}.{orgname}')
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1642, in getProcessedModule
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'
- /projects/coco/code-postprocessing/cocopp/findfiles.py:5: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:5: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/pproc.py:681: bad docstring: Unexpected indentation.
- /projects/coco/code-postprocessing/cocopp/pproc.py:682: bad docstring: Block quote ends without a blank line; unexpected unindent.
- /projects/coco/code-postprocessing/cocopp/ppfigdim.py:31: bad docstring: No directive entry for "plot" in module "docutils.parsers.rst.languages.en".
- Trying "plot" as canonical directive name.
- /projects/coco/code-postprocessing/cocopp/ppfigdim.py:31: bad docstring: Unknown directive type "plot"... plot::
-     :width: 50%
- 
-     import urllib
-     import tarfile
-     import glob
-     from pylab import *
- 
-     import cocopp
- 
-     # Collect and unarchive data (3.4MB)
-     dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
-     filename, headers = urllib.urlretrieve(dataurl)
-     archivefile = tarfile.open(filename)
-     archivefile.extractall()
- 
-     # Scaling figure
-     ds = cocopp.load(glob.glob('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f002_*.pickle'))
-     figure()
-     cocopp.ppfigdim.plot(ds)
-     cocopp.ppfigdim.beautify()
-     cocopp.ppfigdim.plot_previous_algorithms(2, False) # plot BBOB 2009 best algorithm on fun 2
- /projects/coco/code-postprocessing/cocopp/pprldistr.py:19: bad docstring: No directive entry for "plot" in module "docutils.parsers.rst.languages.en".
- Trying "plot" as canonical directive name.
- /projects/coco/code-postprocessing/cocopp/pprldistr.py:19: bad docstring: Unknown directive type "plot"... plot::
-    :width: 75%
- 
-    import urllib
-    import tarfile
-    import glob
-    from pylab import *
-    import cocopp
- 
-    # Collect and unarchive data (3.4MB)
-    dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
-    filename, headers = urllib.urlretrieve(dataurl)
-    archivefile = tarfile.open(filename)
-    archivefile.extractall()
- 
-    # Empirical cumulative distribution function figure
-    ds = cocopp.load(glob.glob('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f0*_20.pickle'))
-    figure()
-    cocopp.pprldistr.plot(ds)
-    cocopp.pprldistr.beautify() # resize the window to view whole figure
- 
- /projects/coco/code-postprocessing/cocopp/compall/pprldmany.py:19: bad docstring: No directive entry for "plot" in module "docutils.parsers.rst.languages.en".
- Trying "plot" as canonical directive name.
- /projects/coco/code-postprocessing/cocopp/compall/pprldmany.py:19: bad docstring: Unknown directive type "plot"... plot::
-     :width: 50%
- 
-     import cocopp
- 
-     # Empirical cumulative distribution function of bootstrapped evaluations figure
-     ds = cocopp.load(cocopp.bbob.get('2009/BIPOP-CMA-ES'))
-     figure()
-     cocopp.compall.pprldmany.plot(ds) # must rather call main instead of plot?
-     cocopp.compall.pprldmany.beautify()

... (truncated 575 lines) ...

pydoctor (https://github.com/twisted/pydoctor): typechecking got 9.32x faster (51.3s -> 5.5s)
(Performance measurements are based on a single noisy sample)
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'

pycma (https://github.com/CMA-ES/pycma): typechecking got 17.55x faster (53.4s -> 3.0s)
(Performance measurements are based on a single noisy sample)
+ Traceback (most recent call last):
+   File "/new_pydoctor/venv/bin/pydoctor", line 8, in <module>
+     sys.exit(main())
+              ^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 165, in main
+     system = get_system(options)
+              ^^^^^^^^^^^^^^^^^^^
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/driver.py", line 78, in get_system
+     builder.buildModules()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1901, in buildModules
+     self.system.process()
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1712, in process
+     self.processModule(mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/model.py", line 1667, in processModule
+     builder.processModuleAST(mod.parsed_ast.root, mod)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 1327, in processModuleAST
+     vis.walkabout(mod_ast)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 159, in walkabout
+     self.walkabout(child)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 152, in walkabout
+     self.visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 112, in visit
+     super().visit(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/visitor.py", line 22, in visit
+     visitor(ob)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 908, in visit_Assign
+     self._handleAssignmentDoc(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 843, in _handleAssignmentDoc
+     self._handleDocComment(node, target)
+   File "/new_pydoctor/venv/lib/python3.12/site-packages/pydoctor/astbuilder.py", line 873, in _handleDocComment
+     lines = self.builder.lines_collection[self.module]
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ AttributeError: 'ASTBuilder' object has no attribute 'lines_collection'
- /projects/pycma/cma/logger.py:2172: Unable to figure out value for __doc__ assignment, maybe too complex
- /projects/pycma/cma/transformations.py:435: Unable to figure out value for __doc__ assignment, maybe too complex
- /projects/pycma/cma/sampler.py:249: Existing docstring at line 244 is overriden
- /projects/pycma/cma/fitness_functions.py:60: Unable to figure out value for __doc__ assignment, maybe too complex
- /projects/pycma/cma/wrapper.py:41: bad docstring: Unexpected indentation.
- /projects/pycma/cma/wrapper.py:42: bad docstring: Block quote ends without a blank line; unexpected unindent.
- /projects/pycma/cma/__init__.py:39: Cannot find link target for "numpy"
- /projects/pycma/cma/__init__.py:39: Cannot find link target for "matplotlib.pyplot" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/__init__.py:82: Unknown field 'license'

... (truncated 1412 lines) ...```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending This ticket needs code related to another ticket not yet fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline docstring is confused if there is a comment
1 participant