Skip to content

First modification for pep237 with pydocstringformatter #1792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 9, 2023

Conversation

Pierre-Sassoulas
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas commented Sep 18, 2022

Description

Type of Changes

Type
📜 Docs

Related Issue

Some results are not correct, this is the occasion to make pydocstringformatter better and to add astroid to its primer. We will handle the incorrect one in #1796

@Pierre-Sassoulas Pierre-Sassoulas added Work in progress Documentation 📗 Maintenance Discussion or action around maintaining astroid or the dev workflow labels Sep 18, 2022
@coveralls
Copy link

coveralls commented Sep 18, 2022

Pull Request Test Coverage Report for Build 3082403333

  • 34 of 34 (100.0%) changed or added relevant lines in 23 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.424%

Totals Coverage Status
Change from base Build 3076284340: 0.0%
Covered Lines: 9796
Relevant Lines: 10599

💛 - Coveralls

@@ -971,7 +972,8 @@ def _do_compare(
) -> bool | type[util.Uninferable]:
"""
If all possible combinations are either True or False, return that:
>>> _do_compare([1, 2], '<=', [3, 4])
>>> _do_compare([1, 2], '<=', [3, 4]).
Copy link
Member Author

Choose a reason for hiding this comment

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

@DanielNoord
Copy link
Collaborator

@Pierre-Sassoulas Will you open issues about stuff that is broken?

@Pierre-Sassoulas
Copy link
Member Author

Will you open issues about stuff that is broken?

Yes, if you think it's necessary : #1792 (comment) for example would be hard to fix imo ?

I think the only clear cut one would be : #1792 (comment) (only typing information without text)

@DanielNoord
Copy link
Collaborator

Yes, if you think it's necessary : #1792 (comment) for example would be hard to fix imo ?

DanielNoord/pydocstringformatter#127

I think the only clear cut one would be : #1792 (comment) (only typing information without text)

I think this can also be fixed. We just need to wrap>split>period instead of split>wrap>period.
Perhaps even wrap>split>wrap>period.

Something to investigate at least!

@Pierre-Sassoulas
Copy link
Member Author

I created DanielNoord/pydocstringformatter#175

I think we can"t add pydocstringformatter right now, but we might want to integrate the change that make sense right now, what do you think ?

@DanielNoord
Copy link
Collaborator

I think we can"t add pydocstringformatter right now, but we might want to integrate the change that make sense right now, what do you think ?

Agreed! Is this reviewable?

@Pierre-Sassoulas
Copy link
Member Author

Agreed! Is this reviewable?

Not yet, I'll clean this up in the coming week

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the add-pydocstring-formatter branch from 186df95 to 90c4e43 Compare September 19, 2022 12:30
@Pierre-Sassoulas Pierre-Sassoulas changed the title Work in progress: Add pydocstringformatter First modification for pep237 with pydocstringformatter Sep 19, 2022
@Pierre-Sassoulas
Copy link
Member Author

This is reviewable now :)

@@ -1,5 +1,7 @@
"""
This file contain the global astroid MANAGER, to prevent circular import that happened
This file contain the global astroid MANAGER, to prevent circular import that
happened.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence is now broken.

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed so much of those that I'll need to redo the commit entirely. I'll get to it. There's a lot of change to review.

@@ -39,7 +38,8 @@ def is_decorated_with_st_composite(node):

def remove_draw_parameter_from_composite_strategy(node):
"""Given that the FunctionDef is decorated with @st.composite, remove the
first argument (`draw`) - it's always supplied by Hypothesis so we don't
first argument (`draw`) - it's always supplied by Hypothesis so we don't.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is broken.

"""Raised when a call to node.statement() does not return a node. This is because
"""Raised when a call to node.statement() does not return a node.

This is because
Copy link
Collaborator

Choose a reason for hiding this comment

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

L406 should probably be appended here.

possible by providing a class responsible to get astroid representation
"""Astroid manager: avoid multiple astroid build of a same module when
possible by providing a class responsible to get astroid representation.

from various source and using a cache of built modules)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is broken. Also note there is a single ) without a (

if self._should_wrap(node, child, is_left):
return f"({child.accept(self)})"

return child.accept(self)

def _should_wrap(self, node, child, is_left):
"""Wrap child if:
- it has lower precedence
- it has lower precedence.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be done differently.

"""Module for some node classes. More nodes in scoped_nodes.py"""
"""Module for some node classes.

More nodes in scoped_nodes.py
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nog longer true. It is now a package.

"""this class provides locals handling common to Module, FunctionDef
and ClassDef nodes, including a dict like interface for direct access
"""This class provides locals handling common to Module, FunctionDef
and ClassDef nodes, including a dict like interface for direct access.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is broken.

@@ -691,6 +692,7 @@ def __init__(
):
"""
:param lineno: The line that this node appears on in the source code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this breaks valid Sphinx documentation

"""build astroid from a living module (i.e. using inspect)
this is used when there is no python source code available (either
"""Build astroid from a living module (i.e. using inspect)
this is used when there is no python source code available (either.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is broken

@Pierre-Sassoulas
Copy link
Member Author

Arg, and there's also conflicts now. Damn.

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the add-pydocstring-formatter branch from 90c4e43 to 45ed29b Compare January 3, 2023 21:24
@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Merging #1792 (d00070a) into main (b717e99) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1792   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files          94       94           
  Lines       10869    10869           
=======================================
  Hits        10069    10069           
  Misses        800      800           
Flag Coverage Δ
linux 92.40% <100.00%> (ø)
pypy 88.54% <100.00%> (ø)
windows 92.31% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
astroid/astroid_manager.py 100.00% <ø> (ø)
astroid/brain/brain_collections.py 100.00% <ø> (ø)
astroid/brain/brain_ctypes.py 100.00% <ø> (ø)
astroid/brain/brain_numpy_core_einsumfunc.py 100.00% <ø> (ø)
astroid/brain/brain_numpy_utils.py 100.00% <ø> (ø)
astroid/exceptions.py 97.56% <ø> (ø)
astroid/modutils.py 86.79% <ø> (ø)
astroid/objects.py 94.01% <ø> (ø)
astroid/test_utils.py 85.41% <ø> (ø)
astroid/transforms.py 100.00% <ø> (ø)
... and 3 more

@Pierre-Sassoulas Pierre-Sassoulas marked this pull request as draft January 3, 2023 21:48
@Pierre-Sassoulas Pierre-Sassoulas force-pushed the add-pydocstring-formatter branch from 45ed29b to 850fa7c Compare January 8, 2023 13:26
@DanielNoord DanielNoord marked this pull request as ready for review January 9, 2023 11:41
@DanielNoord DanielNoord enabled auto-merge (squash) January 9, 2023 11:50
@DanielNoord DanielNoord merged commit e355324 into main Jan 9, 2023
@DanielNoord DanielNoord deleted the add-pydocstring-formatter branch January 9, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📗 Maintenance Discussion or action around maintaining astroid or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants