[CI][RFC] Replace black-jupyter with ruff-format (#37210)

Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
Alex Nails
2026-09-02 19:46:08 -07:00
committed by GitHub
co-authored by Alison Shao
parent 2641e427be
commit 28262c20df
1411 changed files with 7766 additions and 8176 deletions
@@ -201,7 +201,6 @@ class TestProfileMerger(CustomTestCase):
class TestProfileMergerIntegration(CustomTestCase):
def test_data_structures_merge_profiles(self):
# Test ProfileReq
req = ProfileReq()
@@ -59,9 +59,9 @@ def _assert_entries_close(
"""Compare two streams of (name, should_compare, ComparableWeight)."""
actual_list: List[CheckEntry] = list(actual)
expected_list: List[CheckEntry] = list(expected)
assert len(actual_list) == len(
expected_list
), f"length mismatch: actual={len(actual_list)} expected={len(expected_list)}"
assert len(actual_list) == len(expected_list), (
f"length mismatch: actual={len(actual_list)} expected={len(expected_list)}"
)
for i, ((a_name, a_flag, a_ref), (e_name, e_flag, e_ref)) in enumerate(
zip(actual_list, expected_list)
):
@@ -150,7 +150,6 @@ class _FakeModelRunner:
class TestRandomLike(CustomTestCase):
def test_floating_point_preserves_dtype_shape_device(self):
for dtype in (torch.float32, torch.float16, torch.bfloat16):
t = torch.zeros(8, 4, dtype=dtype)
@@ -209,7 +208,6 @@ class TestRandomLike(CustomTestCase):
class TestPostprocessTensors(CustomTestCase):
# --- non-quant / non-skip ---
def test_no_quant_yields_raw_with_should_compare_true(self):
@@ -312,7 +310,6 @@ class TestPostprocessTensors(CustomTestCase):
class TestCheckTensors(CustomTestCase):
def test_passes_when_all_equal(self):
t = torch.ones(2, 2)
expect = [
@@ -388,7 +385,6 @@ def _quantize_block_fp8(weight: torch.Tensor, scale_margin: float):
class TestCheckTensorsAllowQuantError(CustomTestCase):
def setUp(self):
torch.manual_seed(0)
weight = torch.randn(256, 256, device="cuda") * 0.02
@@ -442,7 +438,6 @@ class TestCheckTensorsAllowQuantError(CustomTestCase):
class TestBuildQuantizedSet(CustomTestCase):
def test_fp8_block_module_pairs_weight_and_scale(self):
from sglang.srt.layers.quantization.fp8 import Fp8LinearMethod
@@ -493,7 +488,6 @@ class _WeightCheckerTestBase(CustomTestCase):
class TestSnapshot(_WeightCheckerTestBase):
def test_captures_params_and_buffers(self):
self.checker._snapshot()
keys = set(self.checker._snapshot_tensors.keys())
@@ -519,7 +513,6 @@ class TestSnapshot(_WeightCheckerTestBase):
class TestResetTensors(_WeightCheckerTestBase):
def test_changes_normal_params_in_place(self):
before_w = self.model.w.clone()
before_w_ptr = self.model.w.data_ptr()
@@ -547,7 +540,6 @@ class TestResetTensors(_WeightCheckerTestBase):
class TestCompare(_WeightCheckerTestBase):
def test_without_snapshot_raises(self):
with self.assertRaises(AssertionError):
self.checker._compare()
@@ -586,7 +578,6 @@ class TestCompare(_WeightCheckerTestBase):
class TestHandle(_WeightCheckerTestBase):
def test_routes_to_actions(self):
with (
patch.object(self.checker, "_snapshot") as m_snap,
@@ -628,7 +619,6 @@ class TestHandle(_WeightCheckerTestBase):
class TestIsNonPersistentBufferName(CustomTestCase):
def test_matches_cos_sin_cache_substring(self):
self.assertTrue(
_is_non_persistent_buffer_name("model.rotary_emb.cos_sin_cache")
@@ -651,7 +641,6 @@ class TestIsNonPersistentBufferName(CustomTestCase):
class TestHashTensor(CustomTestCase):
def test_stable_for_same_input(self):
t = torch.arange(64, dtype=torch.float32).cuda()
self.assertEqual(_hash_tensor(t), _hash_tensor(t.clone()))
@@ -680,7 +669,6 @@ class TestHashTensor(CustomTestCase):
class _ChecksumTestBase(CustomTestCase):
def setUp(self):
torch.manual_seed(0)
self.model = _TinyModel().cuda()
@@ -699,7 +687,6 @@ class _ChecksumTestBase(CustomTestCase):
class TestComputeChecksum(_ChecksumTestBase):
def test_returns_dict_with_expected_top_level_keys(self):
out = self.checker._compute_checksum()
self.assertEqual(
@@ -62,7 +62,6 @@ def _build_fp8_quant_pair(device: str = "cuda"):
class TestQuantUlp(CustomTestCase):
def test_matches_bruteforce_spacing_for_fp8(self):
for dtype in (torch.float8_e4m3fn, torch.float8_e5m2):
all_bits = torch.arange(256, dtype=torch.uint8).view(dtype)
@@ -183,7 +182,6 @@ class TestCompareQuantPair(CustomTestCase):
class TestSelectComparableWeight(CustomTestCase):
def test_returns_none_when_not_a_quant_method(self):
self.assertIsNone(select_comparable_weight(None))