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

Black formatted 15 files #4113

Merged
merged 2 commits into from
Sep 18, 2020
Merged

Conversation

Sayam753
Copy link
Member

Black formatted last 15 files listed in #4109. This is fun to do. I think in PyMC4, we do have tests for formatting as well.

@codecov
Copy link

codecov bot commented Sep 18, 2020

Codecov Report

Merging #4113 into master will increase coverage by 0.00%.
The diff coverage is 78.96%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4113   +/-   ##
=======================================
  Coverage   88.74%   88.75%           
=======================================
  Files          89       89           
  Lines       14040    14040           
=======================================
+ Hits        12460    12461    +1     
+ Misses       1580     1579    -1     
Impacted Files Coverage Δ
pymc3/variational/opvi.py 85.32% <61.60%> (ø)
pymc3/variational/approximations.py 80.25% <79.62%> (ø)
pymc3/variational/flows.py 93.60% <87.75%> (ø)
pymc3/variational/updates.py 92.11% <93.18%> (ø)
pymc3/variational/inference.py 78.65% <100.00%> (ø)
pymc3/variational/stein.py 100.00% <100.00%> (ø)
pymc3/variational/test_functions.py 100.00% <100.00%> (ø)
pymc3/vartypes.py 100.00% <100.00%> (ø)
pymc3/distributions/continuous.py 92.93% <0.00%> (+0.11%) ⬆️

@MarcoGorelli
Copy link
Contributor

MarcoGorelli commented Sep 18, 2020

Thanks @Sayam753 !

This is interesting - once you apply black to

                raise ParametrizationError('Discrete variables are not supported by VI: {}'
                                           .format(var))

then pyupgrade can change it to

                  raise ParametrizationError(
                      f"Discrete variables are not supported by VI: {var}"
                 )

Can you either run pyupgrade on pymc3/variational/opvi.py or install pre-commit and then run

pre-commit run pyupgrade --all

?

@Sayam753
Copy link
Member Author

This is indeed interesting. I did nothing apart from running black and then why did pyupgrade fail?

Copy link
Member

@michaelosthege michaelosthege left a comment

Choose a reason for hiding this comment

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

Took a while to compare all the lines but 👍

@MarcoGorelli
Copy link
Contributor

This is indeed interesting. I did nothing apart from running black and then why did pyupgrade fail?

because, once black splits the error message for ParametrizationError so .format is on the same line as a string, then pyupgrade realises it can upgrade it to be an f-string

@AlexAndorra AlexAndorra merged commit c85f7fc into pymc-devs:master Sep 18, 2020
@Sayam753
Copy link
Member Author

because, once black splits the error message for ParametrizationError so .format is on the same line as a string, then pyupgrade realises it can upgrade it to be an f-string

Wow. pyupgrade is so powerful. Now I am curious to add pyupgrade to VSCode as an auto formatter.

@Sayam753 Sayam753 deleted the black_15_files branch September 23, 2020 04:12
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.

4 participants