diff --git a/examples/http/_bench/benchmark.py b/examples/http/_bench/benchmark.py index a38c04b..a015eee 100644 --- a/examples/http/_bench/benchmark.py +++ b/examples/http/_bench/benchmark.py @@ -250,8 +250,7 @@ f"std_ratio: {std_ratio}", ) - if len(m) >= TARGET_MEASUREMENTS and std_ratio <= MAX_STD_RATIO: - break + if len(m) >= TARGET_MEASUREMENTS and std_ratio <= MAX_STD_RATIO: break m = remove_outliers(measurements, k=IQR_MULTIPLIER) mean_rps = np.mean(m) diff --git a/notebooks/machine_learning/nmf.py b/notebooks/machine_learning/nmf.py index 18ddfcc..f9f4b83 100644 --- a/notebooks/machine_learning/nmf.py +++ b/notebooks/machine_learning/nmf.py @@ -28,11 +28,8 @@ def generate_led_digit( shape: tuple = (11, 6), pad: int = 1, ) -> np.ndarray: - if digit is not None: - segment = segments[digit] - - if segment is None: - return np.zeros(shape) + if digit is not None: segment = segments[digit] + if segment is None: return np.zeros(shape) height, width = shape segment_height = (height - 3) // 2 diff --git a/notebooks/random/simple_benchmarks.py b/notebooks/random/simple_benchmarks.py index a12d917..dbe9f6f 100644 --- a/notebooks/random/simple_benchmarks.py +++ b/notebooks/random/simple_benchmarks.py @@ -6,8 +6,7 @@ # %%timeit total = 0 -for _ in range(1_000_000): - total += 1 # noqa: SIM113 +for _ in range(1_000_000): total += 1 # noqa: SIM113 # %% # %%timeit @@ -23,8 +22,7 @@ def fibonacci(n: int) -> int: a = 0 b = 1 - if n == 0: - return a + if n == 0: return a for _ in range(1, n): c = a + b diff --git a/notebooks/reinforcement_learning/frozen_lake.py b/notebooks/reinforcement_learning/frozen_lake.py index c2992a5..8bafe14 100644 --- a/notebooks/reinforcement_learning/frozen_lake.py +++ b/notebooks/reinforcement_learning/frozen_lake.py @@ -27,8 +27,7 @@ state, reward, terminated, _, _ = env.step(action) images.append(cast("np.ndarray", env.render())) - if terminated: - print("You reached the goal!") + if terminated: print("You reached the goal!") # %% @@ -92,8 +91,7 @@ def compute_state_value( visited_states.append(state) value += reward + gamma * value - if terminate: - break + if terminate: break state = next_state diff --git a/packages/config/ruff.toml b/packages/config/ruff.toml index 8be9674..0ca96c3 100644 --- a/packages/config/ruff.toml +++ b/packages/config/ruff.toml @@ -77,6 +77,7 @@ ignore = [ "E111", # indentation-with-invalid-multiple "E114", # indentation-with-invalid-multiple-comment "E501", # line-too-long + "E701", # multiple-statements-on-one-line-colon "E731", # lambda-assignment "E741", # ambiguous-variable-name "N801", # invalid-class-name