Skip to content
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

Add space around "->" to make source pep8 friendly #170

Merged
merged 3 commits into from Jan 8, 2020

Conversation

rvprasad
Copy link
Contributor

Corresponding test also checks type annotation for parameters and assignment are pep8 friendly.

@rvprasad rvprasad force-pushed the master branch 2 times, most recently from 3f021f6 to 60f149c Compare December 24, 2019 05:19
Corresponding test also checks type annotation for parameters and
assignment are pep8 friendly
Copy link
Owner

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! We are already doing some random PEP 8 formatting in the code generator, so I think this is a reasonable PR. Could you please add a changelog entry in docs/changelog.rst? You can add a new 0.9.0 section. Example format:

0.9.0 - in development
----------------------

Bug fixes
~~~~~~~~~

* Description of your PR.
  (Contributed by Venkatesh-Prasad Ranganath in <PR number and link here>.)

@isidentical
Copy link
Contributor

@berkerpeksag We already started a 0.9 section in #160 though it still waits your review.

@rvprasad rvprasad force-pushed the master branch 3 times, most recently from e18f7b8 to a08be12 Compare December 24, 2019 17:59
@rvprasad
Copy link
Contributor Author

@berkerpeksag I have added a new section to the docs/changelog.rst describing the fix/change.

Copy link
Owner

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

Thanks for the updated PR! I usually make the last round of tweaks before merge myself, but since I couldn't edit the files ("edit file" links are disabled), I left them as review comments.

@@ -2,6 +2,18 @@
Release Notes
=============

0.9.0 - in development
--------------------
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: Add two missing - here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0.9.0 - in development
--------------------

Bug Fixes
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: Fixes -> fixes

Copy link
Contributor Author

@rvprasad rvprasad Dec 27, 2019

Choose a reason for hiding this comment

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

Fixed in rvprasad/astor@78e7c60a0. BTW, since "bug fix" is a compound noun, I think "Bug Fixes" is the correct usage.

~~~~~~~~~

* Change formatting of function and assignment type annotations to be more
PEP8 friendly.
Copy link
Owner

Choose a reason for hiding this comment

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

PEP8 -> :pep:`8`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -611,6 +611,24 @@ def test_annassign(self):
"""
self.assertAstRoundtripsGtVer(source, (3, 6))

@unittest.skipUnless(sys.version_info >= (3, 6),
"typing and ann assignment was introduced in "
Copy link
Owner

Choose a reason for hiding this comment

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

Is "ann" short for "annotation" here? If so, it would be nice to use the longer version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it is named after the AnnAssign node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"ann" was short for "annotated". Fixed in rvprasad/astor@78e7c60a0.

i: str = '3'
return i
"""
trgtxt = canonical(target)
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: We can reuse target here:

target = canonical(target)

Copy link
Contributor Author

@rvprasad rvprasad Dec 27, 2019

Choose a reason for hiding this comment

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

Fixed in rvprasad/astor@78e7c60a0 by apply canonical to the literal before initializing target.

i : str = '3'
return i
"""
srctxt = canonical(source)
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: We can reuse source here:

source = canonical(source)

Copy link
Contributor Author

@rvprasad rvprasad Dec 27, 2019

Choose a reason for hiding this comment

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

Fixed in rvprasad/astor@78e7c60a0 by apply canonical to the literal before initializing source.

return i
"""
trgtxt = canonical(target)
self.assertEqual(self.to_source(ast.parse(srctxt)).rstrip(), trgtxt)
Copy link
Owner

Choose a reason for hiding this comment

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

More importantly, can't we directly use assertAstEqualsSource here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have used assertAstEqualSource in rvprasad/astor@78e7c60a0.

@berkerpeksag
Copy link
Owner

@berkerpeksag We already started a 0.9 section in #160 though it still waits your review.

Yes, it's on my TODO list. I still need to read the PEP first and am planning to work on it next month.

@rvprasad
Copy link
Contributor Author

Thanks for the updated PR! I usually make the last round of tweaks before merge myself, but since I couldn't edit the files ("edit file" links are disabled), I left them as review comments.

To help the review process, I have enabled the "edits from maintainers".

@berkerpeksag berkerpeksag merged commit cff734f into berkerpeksag:master Jan 8, 2020
@berkerpeksag
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants