Skip to content

Apply black to the Scripts/ directory - #2366

Merged
peterjc merged 4 commits into
biopython:masterfrom
peterjc:black_scripts
Dec 2, 2019
Merged

peterjc merged 4 commits into
biopython:masterfrom
peterjc:black_scripts

Conversation

@peterjc

@peterjc peterjc commented Nov 29, 2019

Copy link
Copy Markdown
Member

This pull request addresses issue #2008.

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run flake8 locally, and
    understand that AppVeyor and TravisCI will be used to confirm the Biopython unit
    tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

@svalqui would you like to review this?

@peterjc

peterjc commented Nov 29, 2019

Copy link
Copy Markdown
Member Author

Grr. I need to switch back to Python 2 locally to work out what I broke under flake8...

@codecov

codecov Bot commented Nov 29, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #2366 into master will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2366      +/-   ##
==========================================
+ Coverage   84.95%   85.08%   +0.12%     
==========================================
  Files         323      323              
  Lines       52690    53051     +361     
==========================================
+ Hits        44764    45137     +373     
+ Misses       7926     7914      -12
Impacted Files Coverage Δ
Bio/Phylo/PAML/_parse_yn00.py 100% <0%> (ø) ⬆️
Bio/Phylo/PAML/__init__.py 100% <0%> (ø) ⬆️
Bio/Phylo/PAML/codeml.py 90.57% <0%> (+0.86%) ⬆️
Bio/Phylo/PAML/_parse_codeml.py 96.99% <0%> (+0.99%) ⬆️
Bio/Phylo/PAML/_parse_baseml.py 96.66% <0%> (+1.42%) ⬆️
Bio/Phylo/PAML/yn00.py 89.32% <0%> (+2.14%) ⬆️
Bio/Phylo/PAML/baseml.py 88.54% <0%> (+2.27%) ⬆️
Bio/Phylo/PAML/chi2.py 94.5% <0%> (+5.75%) ⬆️
Bio/Crystal/__init__.py 84.69% <0%> (+8.09%) ⬆️
Bio/Phylo/PAML/_paml.py 92.22% <0%> (+8.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c6e29a...930bb7e. Read the comment docs.

@peterjc

peterjc commented Nov 29, 2019

Copy link
Copy Markdown
Member Author

My attempts to modernise this line failed, flake8 under Python 2 was not happy (unsure why, perhaps a plugin fails):

https://github.com/biopython/biopython/blob/biopython-175/Scripts/Restriction/ranacompiler.py#L440

-o <testfile> is a BLAST output file.

""" % sys.argv[0]
"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This closing triple quote doesn't align with the opening one. not sure if we want them aligned as for instance the parentheses do not align either, black style does that; I have mostly aligned DocStrings but assignments I might have left them like this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I haven't explored the rules of the syntax to properly understand how Python interprets the indentation vs which leading spaces are part of the string values. However, this does look like a style judgement - in which case do whatever black does is the easy solution. This is worth discussing for #2008 as a whole.

Comment thread Scripts/xbbtools/nextorf.py Resolved
peterjc added a commit that referenced this pull request Dec 2, 2019
These were originally hash, indentation, commented code.
Black produced odd output, since it likely assumed would
have indentation, hash, commented code.

Spotted by Sergio in review of pull request #2366.
@peterjc

peterjc commented Dec 2, 2019

Copy link
Copy Markdown
Member Author

Thank you @svalqui for looking at this 👍

@peterjc
peterjc merged commit 6ffaf6a into biopython:master Dec 2, 2019
@peterjc
peterjc deleted the black_scripts branch December 2, 2019 10:08
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.

2 participants