-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Run pyupgrade #4083
Run pyupgrade #4083
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4083 +/- ##
=======================================
Coverage 88.76% 88.76%
=======================================
Files 89 89
Lines 14015 14015
=======================================
Hits 12440 12440
Misses 1575 1575
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this -- I took a brief look and it seems better than before. Is it possible to hold onto it, and rerun after #4076 gets merged? I think that would be a painful rebase, and if this is just a script, it might be easier for you to do.
@@ -339,8 +339,8 @@ def load(name, model=None): | |||
db.connect() | |||
varnames = _get_table_list(db.cursor) | |||
if len(varnames) == 0: | |||
raise ValueError(('Can not get variable list for database' | |||
'`{}`'.format(name))) | |||
raise ValueError('Can not get variable list for database' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh.
@@ -366,14 +366,14 @@ def _get_table_list(cursor): | |||
|
|||
|
|||
def _get_var_strs(cursor, varname): | |||
cursor.execute('SELECT * FROM [{}]'.format(varname)) | |||
cursor.execute(f'SELECT * FROM [{varname}]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boy howdy we should get rid of this backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes...
pymc3/distributions/simulator.py
Outdated
``gaussian_kernel`` :math: `\sum \left(-0.5 \left(\frac{xo - xs}{\epsilon}\right)^2\right)` | ||
``wasserstein`` :math: `\frac{1}{n} \sum{\left(\frac{|xo - xs|}{\epsilon}\right)}` | ||
``energy`` :math: `\sqrt{2} \sqrt{\frac{1}{n} \sum \left(\frac{|xo - xs|}{\epsilon}\right)^2}` | ||
``gaussian_kernel`` :math: `\\sum \\left(-0.5 \\left(\frac{xo - xs}{\\epsilon}\right)^2\right)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, this is wonderful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a raw string then...
@@ -584,7 +584,7 @@ def update(self, sample, grad, tune): | |||
|
|||
def raise_ok(self, vmap): | |||
if self._chol_error is not None: | |||
raise ValueError("{0}".format(self._chol_error)) | |||
raise ValueError(f"{self._chol_error}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh.
Waiting till after #4076. |
Can this also be added to the CI process to make sure that outdated syntax isn't used in the future? EDITif #4088 is accepted it's probably easiest to add this to the |
+1 to add this to the |
#4088 is now merged, so pyupgrade can be added as a pre-commit hook quite easily now 🎉 |
#4076 is merged so we can revisit this. |
1f76d50
to
f8e3dc3
Compare
4f4e92c
to
a35c0bc
Compare
Thanks Dr Seyboldt! |
pyupgrade upgrades the syntax to make use of more recent python features. In our case those are mostly set literals and format strings. (https://github.com/asottile/pyupgrade)
It is a rather large diff, but I think it makes the source much nicer to read in a lot of places.