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

[fmt] Format analysis module and tests #4848

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
54 changes: 27 additions & 27 deletions package/MDAnalysis/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@
#

__all__ = [
'align',
'backends',
'base',
'contacts',
'density',
'distances',
'diffusionmap',
'dihedrals',
'distances',
'dielectric',
'gnm',
'hbonds',
'helix_analysis',
'hole2',
'hydrogenbonds',
'leaflet',
'lineardensity',
'msd',
'nuclinfo',
'nucleicacids',
'polymer',
'pca',
'psa',
'rdf',
'results',
'rms',
'waterdynamics',
"align",
"backends",
"base",
"contacts",
"density",
"distances",
"diffusionmap",
"dihedrals",
"distances",
"dielectric",
"gnm",
"hbonds",
"helix_analysis",
"hole2",
"hydrogenbonds",
"leaflet",
"lineardensity",
"msd",
"nuclinfo",
"nucleicacids",
"polymer",
"pca",
"psa",
"rdf",
"results",
"rms",
"waterdynamics",
]
27 changes: 16 additions & 11 deletions package/MDAnalysis/analysis/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
-------

"""

import warnings
from typing import Callable
from MDAnalysis.lib.util import is_installed
Expand Down Expand Up @@ -102,8 +103,9 @@ def _get_checks(self):
checked during ``_validate()`` run
"""
return {
isinstance(self.n_workers, int) and self.n_workers > 0:
f"n_workers should be positive integer, got {self.n_workers=}",
isinstance(self.n_workers, int)
and self.n_workers
> 0: f"n_workers should be positive integer, got {self.n_workers=}",
}

def _get_warnings(self):
Expand Down Expand Up @@ -183,8 +185,8 @@ def _get_warnings(self):
checked during ``_validate()`` run
"""
return {
self.n_workers == 1:
"n_workers is ignored when executing with backend='serial'"
self.n_workers
== 1: "n_workers is ignored when executing with backend='serial'"
}

def apply(self, func: Callable, computations: list) -> list:
Expand Down Expand Up @@ -307,10 +309,12 @@ def apply(self, func: Callable, computations: list) -> list:
import dask

computations = [delayed(func)(task) for task in computations]
results = dask.compute(computations,
scheduler="processes",
chunksize=1,
num_workers=self.n_workers)[0]
results = dask.compute(
computations,
scheduler="processes",
chunksize=1,
num_workers=self.n_workers,
)[0]
return results

def _get_checks(self):
Expand All @@ -326,8 +330,9 @@ def _get_checks(self):
"""
base_checks = super()._get_checks()
checks = {
is_installed("dask"):
("module 'dask' is missing. Please install 'dask': "
"https://docs.dask.org/en/stable/install.html")
is_installed("dask"): (
"module 'dask' is missing. Please install 'dask': "
"https://docs.dask.org/en/stable/install.html"
)
}
return base_checks | checks
Loading
Loading