Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Remove unnecessary comprehension (#1085)

deepsource-autofix[bot]39cb2c3e0d97
diff --git a/kornia/augmentation/container/augment.py b/kornia/augmentation/container/augment.py
index 66da62d7c..3ebe893f3 100644
--- a/kornia/augmentation/container/augment.py
+++ b/kornia/augmentation/container/augment.py
@@ -67,7 +67,7 @@ class AugmentationSequential(ImageSequential):
self.data_keys = [DataKey.get(inp) for inp in data_keys]
assert all(
- [in_type in DataKey for in_type in self.data_keys]
+ in_type in DataKey for in_type in self.data_keys
), f"`data_keys` must be in {DataKey}. Got {data_keys}."
if self.data_keys[0] != DataKey.INPUT:
diff --git a/kornia/constants.py b/kornia/constants.py
index b4f6ddee3..eb80e3884 100644
--- a/kornia/constants.py
+++ b/kornia/constants.py
@@ -25,10 +25,10 @@ class EnumMetaFlags(EnumMeta):
def __contains__(self, other: Union[str, int, T]) -> bool: # type: ignore
if type(other) == str:
other = cast(str, other)
- return any([val.name == other.upper() for val in self]) # type: ignore
+ return any(val.name == other.upper() for val in self) # type: ignore
if type(other) == int:
- return any([val.value == other for val in self]) # type: ignore
- return any([val == other for val in self]) # type: ignore
+ return any(val.value == other for val in self) # type: ignore
+ return any(val == other for val in self) # type: ignore
def __repr__(self):
return ' | '.join(f"{self.__name__}.{val.name}" for val in self)