Reverted logic on if not any() which is not the same as if all()

这个提交包含在:
Craig Warren
2023-06-27 16:58:34 +01:00
父节点 438785ad25
当前提交 515351bbfb
共有 3 个文件被更改,包括 4 次插入4 次删除

查看文件

@@ -235,7 +235,7 @@ class AddGrass(UserObjectGeometry):
surface.grass.append(g)
# Check to see if grass has been already defined as a material
if all(x.ID == "grass" for x in grid.materials):
if not any(x.ID == "grass" for x in grid.materials):
create_grass(grid)
# Check if time step for model is suitable for using grass

查看文件

@@ -156,7 +156,7 @@ class AddSurfaceWater(UserObjectGeometry):
raise ValueError
# Check to see if water has been already defined as a material
if all(x.ID != "water" for x in grid.materials):
if not any(x.ID != "water" for x in grid.materials):
create_water(grid)
# Check if time step for model is suitable for using water

查看文件

@@ -385,7 +385,7 @@ class HertzianDipole(UserObjectMulti):
p2 = uip.round_to_grid_static_point(p1)
# Check if there is a waveformID in the waveforms list
if all(x.ID == waveform_id for x in grid.waveforms):
if not any(x.ID == waveform_id for x in grid.waveforms):
logger.exception(f"{self.params_str()} there is no waveform " + f"with the identifier {waveform_id}.")
raise ValueError
@@ -526,7 +526,7 @@ class MagneticDipole(UserObjectMulti):
p2 = uip.round_to_grid_static_point(p1)
# Check if there is a waveformID in the waveforms list
if all(x.ID == waveform_id for x in grid.waveforms):
if not any(x.ID == waveform_id for x in grid.waveforms):
logger.exception(f"{self.params_str()} there is no waveform " + f"with the identifier {waveform_id}.")
raise ValueError