Sbozzolo / kuibit

Consider iterating dictionary PYL-C0201
Anti-pattern
Major
4 occurrences in this check
Consider iterating the dictionary directly instead of calling .keys()
1194        "yz": (0, None, None),
1195    }
1196
1197    if plane not in cut.keys():1198        raise ValueError(f"Plane has to be one of {list(cut.keys())}")
1199
1200    if plot_type == "iteration":
Consider iterating the dictionary directly instead of calling .keys()
1672
1673    def __getattr__(self, attr):
1674        # This allows to call self.x, self.xy and so on
1675        if attr in self._dim_indices.keys():1676            # We retrieve the data with __getitem__
1677            return self[attr]
1678
Consider iterating the dictionary directly instead of calling .keys()
1655            return dimension
1656
1657        # If the input is a recognized string, return the corresponding tuple
1658        if dimension in self._dim_indices.keys():1659            return self._dim_indices[dimension]
1660
1661        raise ValueError(f"{dimension} is not a recognized dimension")
Consider iterating the dictionary directly instead of calling .keys()
242    # This function is here, but it could be anywhere, it doesn't really
243    # apply only to ASCII files, nor only to Cactus files...
244    units = {"B": 1, "KB": 1024, "MB": 1024 ** 2, "GB": 1024 ** 3}
245    if unit not in units.keys():246        raise ValueError(f"Invalid unit: expected one of {list(units.keys())}")
247    return sum(os.path.getsize(path) for path in set(allfiles)) / units[unit]