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

Fix failing CI #3676

Merged
merged 4 commits into from
Apr 21, 2020
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: 1 addition & 1 deletion maintainer/CI/fix_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if ! git diff-index --quiet HEAD -- && [ "${1}" != "-f" ]; then
exit 1
fi

maintainer/lint/pre_commit.sh run --all-files || exit 1
maintainer/lint/pre_commit.sh run --all-files

if [ "${CI}" != "" ]; then
git --no-pager diff > style.patch
Expand Down
10 changes: 5 additions & 5 deletions maintainer/gh_post_style_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
MESSAGE = '''Your pull request does not meet our code formatting \
rules. {header}, please do one of the following:

- You can download a patch with my suggested changes
[here]({url}/artifacts/raw/style.patch), inspect it and make
- You can download a patch with my suggested changes \
[here]({url}/artifacts/raw/style.patch), inspect it and make \
changes manually.
- You can directly apply it to your repository by running
- You can directly apply it to your repository by running \
`curl {url}/artifacts/raw/style.patch | git apply -`.
- You can run `maintainer/CI/fix_style.sh` to automatically fix your coding
style. This is the same command that I have executed to generate the patch
- You can run `maintainer/CI/fix_style.sh` to automatically fix your coding \
style. This is the same command that I have executed to generate the patch \
above, but it requires certain tools to be installed on your computer.

You can run `gitlab-runner exec docker style` afterwards to check if your \
Expand Down
44 changes: 21 additions & 23 deletions src/python/espressomd/electrostatics.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ IF SCAFACOS == 1:
from .scafacos import ScafacosConnector
from . cimport scafacos
from .utils cimport handle_errors
from .utils import is_valid_type, to_str
from .utils import is_valid_type, check_type_or_throw_except, to_str
from . cimport checks
from .analyze cimport partCfg, PartCfg
from .particle_data cimport particle
Expand Down Expand Up @@ -240,13 +240,13 @@ IF P3M == 1:
or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")

if not (is_valid_type(self._params["mesh"], int)
or len(self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")

if (isinstance(self._params["mesh"], basestring) and len(
self._params["mesh"]) == 3):
if is_valid_type(self._params["mesh"], int):
if self._params["mesh"] % 2 != 0 and self._params["mesh"] != -1:
raise ValueError(
"P3M requires an even number of mesh points in all directions")
else:
check_type_or_throw_except(self._params["mesh"], 3, int,
"P3M mesh has to be an integer or integer list of length 3")
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or \
(self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or \
(self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
Expand All @@ -267,10 +267,9 @@ IF P3M == 1:
or self._params["epsilon"] == "metallic"):
raise ValueError("epsilon should be a double or 'metallic'")

if not (self._params["mesh_off"] == default_params["mesh_off"]
or len(self._params) != 3):
raise ValueError(
"mesh_off should be a list of length 3 and values between 0.0 and 1.0")
if self._params["mesh_off"] != default_params["mesh_off"]:
check_type_or_throw_except(self._params["mesh_off"], 3, float,
"mesh_off should be a (3,) array_like of values between 0.0 and 1.0")

if not (self._params["alpha"] == default_params["alpha"]
or self._params["alpha"] > 0):
Expand Down Expand Up @@ -382,13 +381,13 @@ IF P3M == 1:
or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")

if not (is_valid_type(self._params["mesh"], int)
or len(self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")

if (isinstance(self._params["mesh"], basestring) and len(
self._params["mesh"]) == 3):
if is_valid_type(self._params["mesh"], int):
if self._params["mesh"] % 2 != 0 and self._params["mesh"] != -1:
raise ValueError(
"P3M requires an even number of mesh points in all directions")
else:
check_type_or_throw_except(self._params["mesh"], 3, int,
"P3M mesh has to be an integer or integer list of length 3")
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or \
(self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or \
(self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
Expand All @@ -411,10 +410,9 @@ IF P3M == 1:
raise ValueError(
"epsilon should be a double or 'metallic'")

if not (self._params["mesh_off"] == default_params["mesh_off"]
or len(self._params) != 3):
raise ValueError(
"mesh_off should be a list of length 3 with values between 0.0 and 1.0")
if self._params["mesh_off"] != default_params["mesh_off"]:
check_type_or_throw_except(self._params["mesh_off"], 3, float,
"mesh_off should be a (3,) array_like of values between 0.0 and 1.0")

def valid_keys(self):
return ["mesh", "cao", "accuracy", "epsilon", "alpha", "r_cut",
Expand Down
25 changes: 12 additions & 13 deletions src/python/espressomd/magnetostatics.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ IF SCAFACOS == 1:
from . cimport scafacos

from .utils cimport handle_errors
from .utils import is_valid_type, to_str
from .utils import is_valid_type, check_type_or_throw_except, to_str

IF DIPOLES == 1:
cdef class MagnetostaticInteraction(Actor):
Expand Down Expand Up @@ -101,13 +101,13 @@ IF DP3M == 1:
or self._params["r_cut"] == default_params["r_cut"]):
raise ValueError("P3M r_cut has to be >=0")

if not (is_valid_type(self._params["mesh"], int) or len(
self._params["mesh"]) == 3):
raise ValueError(
"P3M mesh has to be an integer or integer list of length 3")

if isinstance(self._params["mesh"], basestring) and len(
self._params["mesh"]) == 3:
if is_valid_type(self._params["mesh"], int):
if self._params["mesh"] % 2 != 0 and self._params["mesh"] != -1:
raise ValueError(
"P3M requires an even number of mesh points in all directions")
else:
check_type_or_throw_except(self._params["mesh"], 3, int,
"P3M mesh has to be an integer or integer list of length 3")
if (self._params["mesh"][0] % 2 != 0 and self._params["mesh"][0] != -1) or \
(self._params["mesh"][1] % 2 != 0 and self._params["mesh"][1] != -1) or \
(self._params["mesh"][2] % 2 != 0 and self._params["mesh"][2] != -1):
Expand All @@ -132,10 +132,9 @@ IF DP3M == 1:
or self._params["inter"] > 0):
raise ValueError("inter should be a positive integer")

if not (self._params["mesh_off"] == default_params["mesh_off"]
or len(self._params["mesh_off"]) == 3):
raise ValueError(
"mesh_off should be a (3,) array_like of values between 0.0 and 1.0")
if self._params["mesh_off"] != default_params["mesh_off"]:
check_type_or_throw_except(self._params["mesh_off"], 3, float,
"mesh_off should be a (3,) array_like of values between 0.0 and 1.0")

def valid_keys(self):
return ["prefactor", "alpha_L", "r_cut_iL", "mesh", "mesh_off",
Expand Down Expand Up @@ -205,7 +204,7 @@ IF DP3M == 1:
def python_dp3m_adaptive_tune(self):
cdef char * log = NULL
cdef int response
response = dp3m_adaptive_tune( & log)
response = dp3m_adaptive_tune(& log)
handle_errors(
"dipolar P3M_init: k-space cutoff is larger than half of box dimension")
return response, log
Expand Down
2 changes: 1 addition & 1 deletion testsuite/scripts/samples/test_lb_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import numpy as np

sample, skipIfMissingFeatures = importlib_wrapper.configure_and_import(
"@SAMPLES_DIR@/lb_profile.py")
"@SAMPLES_DIR@/lb_profile.py", gpu=True)


@skipIfMissingFeatures
Expand Down