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

Enabled pylint generator checks #1588

Merged
merged 5 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ disable=missing-docstring,
ungrouped-imports,
not-an-iterable,
no-member,
use-a-generator,
consider-using-generator,
#TODO: Remove this once todos are done
fixme

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Integrate `index_origin` with all the library ([1201](https://github.com/arviz-devs/arviz/pull/1201))
* Fix pareto k threshold typo in reloo function ([1580](https://github.com/arviz-devs/arviz/pull/1580))
* Preserve shape from Stan code in `from_cmdstanpy` ([1579](https://github.com/arviz-devs/arviz/pull/1579))
* Used generator instead of list wherever possible ([1588](https://github.com/arviz-devs/arviz/pull/1588))
* Correctly use chain index when constructing PyMC3 `DefaultTrace` in `from_pymc3` ([1590](https://github.com/arviz-devs/arviz/pull/1590))

### Deprecation
Expand Down
2 changes: 1 addition & 1 deletion arviz/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def wrapped(cls: RequiresArgTypeT) -> Optional[RequiresReturnTypeT]:
"""Return None if not all props are available."""
for prop in self.props:
prop = [prop] if isinstance(prop, str) else prop
if all([getattr(cls, prop_i) is None for prop_i in prop]):
if all((getattr(cls, prop_i) is None for prop_i in prop)):
return None
return func(cls)

Expand Down
2 changes: 1 addition & 1 deletion arviz/data/io_pymc3.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def fixed_eq(self, other):
"""Use object identity for MultiObservedRV equality."""
return self is other

if tuple([int(x) for x in pm.__version__.split(".")]) < (3, 9): # type: ignore
if tuple((int(x) for x in pm.__version__.split("."))) < (3, 9): # type: ignore
pm.model.MultiObservedRV.__eq__ = fixed_eq # type: ignore


Expand Down
2 changes: 1 addition & 1 deletion arviz/plots/backends/bokeh/energyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def plot_energy(
if (fill_color[0].startswith("C") and len(fill_color[0]) == 2) and (
fill_color[1].startswith("C") and len(fill_color[1]) == 2
):
fill_color = tuple([_colors[int(color[1:]) % 10] for color in fill_color])
fill_color = tuple((_colors[int(color[1:]) % 10] for color in fill_color))
elif fill_color[0].startswith("C") and len(fill_color[0]) == 2:
fill_color = tuple([_colors[int(fill_color[0][1:]) % 10]] + list(fill_color[1:]))
elif fill_color[1].startswith("C") and len(fill_color[1]) == 2:
Expand Down
2 changes: 1 addition & 1 deletion arviz/plots/backends/matplotlib/energyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def plot_energy(
if (fill_color[0].startswith("C") and len(fill_color[0]) == 2) and (
fill_color[1].startswith("C") and len(fill_color[1]) == 2
):
fill_color = tuple([_colors[int(color[1:]) % 10] for color in fill_color])
fill_color = tuple((_colors[int(color[1:]) % 10] for color in fill_color))
elif fill_color[0].startswith("C") and len(fill_color[0]) == 2:
fill_color = tuple([_colors[int(fill_color[0][1:]) % 10]] + list(fill_color[1:]))
elif fill_color[1].startswith("C") and len(fill_color[1]) == 2:
Expand Down
2 changes: 1 addition & 1 deletion arviz/plots/backends/matplotlib/ppcplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def plot_ppc(
)
if animated:
fig = axes[0].get_figure()
if not all([ax.get_figure() is fig for ax in axes]):
if not all((ax.get_figure() is fig for ax in axes)):
raise ValueError("All axes must be on the same figure for animation to work")

for i, ax_i in enumerate(np.ravel(axes)[:length_plotters]):
Expand Down
2 changes: 1 addition & 1 deletion arviz/tests/base_tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def test_del(self, use):
assert not fails
# assert _groups attribute contains all groups
groups = getattr(idata, "_groups")
assert all([group in groups for group in test_dict])
assert all((group in groups for group in test_dict))

# Use del method
if use == "del":
Expand Down
6 changes: 3 additions & 3 deletions arviz/tests/base_tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ def test_rcparams_repr_str():
str_str = rcParams.__str__()
assert repr_str.startswith("RcParams")
for string in (repr_str, str_str):
assert all([key in string for key in rcParams.keys()])
assert all((key in string for key in rcParams.keys()))


### Test arvizrc.template file is up to date ###
def test_rctemplate_updated():
fname = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../arvizrc.template")
rc_pars_template = read_rcfile(fname)
rc_defaults = rc_params(ignore_files=True)
assert all([key in rc_pars_template.keys() for key in rc_defaults.keys()]), [
assert all((key in rc_pars_template.keys() for key in rc_defaults.keys())), [
key for key in rc_defaults.keys() if key not in rc_pars_template
]
assert all([value == rc_pars_template[key] for key, value in rc_defaults.items()]), [
assert all((value == rc_pars_template[key] for key, value in rc_defaults.items())), [
key for key, value in rc_defaults.items() if value != rc_pars_template[key]
]

Expand Down