-
Notifications
You must be signed in to change notification settings - Fork 104
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 flake8-multiline-containers
#290
Conversation
Codecov Report
@@ Coverage Diff @@
## issue-278-base #290 +/- ##
===============================================
Coverage 87.25% 87.25%
===============================================
Files 27 27
Lines 1702 1702
===============================================
Hits 1485 1485
Misses 217 217
Continue to review full report at Codecov.
|
tests/unit/multivariate/test_tree.py
Outdated
@@ -655,18 +655,18 @@ def test_get_likelihood_no_parents(self, bivariate_mock): | |||
|
|||
expected_partial_derivative_call_args = [ | |||
( | |||
(np.array([[ | |||
(np.array([[ # noqa: JS101 |
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.
@csala I'm not sure what to do about these. If I do follow the lint rule, I have to do the following:
(
np.array(
[
[
[0.25, 0.75],
[0.50, 0.50],
]
]
),
), {}
which looks silly.
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.
Yeah it is a bit excessive, but my preference would be to do the formatting over ignoring the rule here.
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 agree, it's a bit excessive, and I also agree that in general it's better to re-format than to ignore the rule. It's also happening in only two places, so it's not that bad to have it fully expanded.
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.
Done. I also created intermediate variables for them because the flake8-expression-complexity
addon complains about these lines in a different PR.
The generator is a function :math:`\psi: [0,1]\times\Theta \rightarrow [0, \infty)` | ||
that given an Archimedian copula fulills: | ||
The generator is a function | ||
:math:`\psi: [0,1]\times\Theta \rightarrow [0, \infty)` # noqa: JS101 |
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.
The reason for this noqa
is that [0, \infty)
is interpreted as an opening [
without closing bracket. I'm not sure how to avoid this misinterpretation, so I just noqa
'd it.
The generator is a function :math:`\psi: [0,1]\times\Theta \rightarrow [0, \infty)` | ||
that given an Archimedian copula fulills: | ||
The generator is a function | ||
:math:`\psi: [0,1]\times\Theta \rightarrow [0, \infty)` # noqa: JS101 |
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.
Same as above.
&= \frac{C(u,v)}{uv} \frac{((-\ln u)^{\theta} + (-\ln v)^{\theta})^{\frac{2} | ||
{\theta} - 2 }}{(\ln u \ln v)^{1 - \theta}} ( 1 + (\theta-1) \big((-\ln u)^\theta | ||
&= \frac{\partial^2 C(u,v)}{\partial v \partial u} | ||
&= \frac{C(u,v)}{uv} \frac{((-\ln u)^{\theta} # noqa: JS101 |
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.
These are multiline fractions. Since I couldn't find a way to write them in one line, I'm using noqa
.
copulas/bivariate/__init__.py
Outdated
@@ -156,7 +156,7 @@ def select_copula(X): | |||
np.concatenate((left, right)) for left, right in zip( | |||
candidate_left_auts, candidate_right_auts | |||
) | |||
] | |||
] # noqa: JS102 |
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 don't know why it complains about this one...
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.
That's strange. Would it help to add commas? e.g.
candidate_auts = [
np.concatenate((left, right)) for left, right in zip(
candidate_left_auts, candidate_right_auts,
),
]
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 think this is because once you add any multi-line in an expression, the plugin expects everything to be multi-line, and also the fact that it is a comprehension messes it a bit.
I suggest to change the splitting to right before the for
, and then the plugin will not complain:
candidate_auts = [
np.concatenate((left, right))
for left, right in zip(candidate_left_auts, candidate_right_auts)
]
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.
* Add working libraries * Add addon * Remove pydocstyle * Fix unrelated error * Make double quotes into single (#289) * Add `flake8-eradicate` (#293) * Add addon * Remove paranthesis because the addon thinks they are code * Add addon * Remove paranthesis because the addon thinks they are code * Add `flake8-builtins` (#296) * Add addon * Update code according to addon * Add addon * Update code according to addon * Add `pandas-vet` (#299) * Add addon * Update code according to addon * Add addon * Update code according to addon * Add absolute import * Add sfs (#305) * Add `flake8-multiline-containers` (#290) * Not sure what to do about these * Add noqa's where necessary * Not sure what to do about these * Add noqa's where necessary * Address feedback * Add `flake8-expression-complexity` (#291) * Add addon * Change the complexity limit to 8 from 7 * Add addon * Change the complexity limit to 8 from 7 * Fix complexity * Rename + remove unnecessary argsort * Add `flake8-print` (#292) * Add addon * Address feedback * Add `flake8-comprehensions` (#295) * Add addon * Fix code according to addon * Add addon * Fix code according to addon * Fix errors * Fix set as literal * Address feedback * Add `pytest-style` (#297) * Add addon * Update code according to addon * Add addon * Update code according to addon * Fix errors * Delete pytest * Address feedback * Add `flake8-docstrings` (#301) * Add addon * Update code according to addon * Add addon * Update code according to addon * Update code according to pydocstyle * Fixes * Fix errors * Update docstrings * Fix typos * Add addon and ignore erros (#304) * Add `flake8-dlint` (#300) * Add addon * Ignore error * Add addon * Ignore error * Add `pep8-naming` (#298) * Add addon * Ignore all the variable names * Add addon * Ignore all the variable names * Move ignores to setup.cfg * Add `flake8-fixme` (#294) * Add addon * Remove fixme * Add addon * Remove fixme * Fix bug * Fix details
As part of #278, add
flake8-multiline-containers
and update the code accordingly.