Skip to content

Commit 6ff3184

Browse files
committed
fix: resolve all pre-commit checks
- Fix UP038: update isinstance calls to use X | Y syntax (Python 3.10+) - Fix trailing whitespace in README.md - Fix end-of-file issues in dataset and config files - Re-add UP038 to ignore list in pyproject.toml for compatibility
1 parent 32a49ac commit 6ff3184

7 files changed

Lines changed: 7 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ GenRL is built upon the excellent work of the open-source community. We would li
452452

453453
## 📄 License
454454

455-
GenRL is licensed under the **Apache License 2.0**.
455+
GenRL is licensed under the **Apache License 2.0**.
456456
See `LICENSE.txt` for the full license text.
457457

458458
---

datasets/ocr/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,4 +1015,4 @@ A detailed, vintage-style alien abduction pamphlet titled "Probing FAQs", featur
10151015
A realistic classroom scene with a large clock on the wall, its face reading "Time for Lunch", surrounded by desks and chairs, with sunlight streaming through windows, creating a warm, inviting atmosphere.
10161016
In a dimly lit sci-fi prison cell, the cold metal walls are marked with graffiti scrawling "Escape Pod 9 Works" in bold, glowing letters, casting eerie shadows in the narrow, futuristic corridor.
10171017
A futuristic spaceship cockpit with a digital screen displaying "Fuel Low" warning, set against the backdrop of a star-studded galaxy, with control panels and futuristic interfaces around.
1018-
A futuristic spaceship with sleek, metallic exterior hull markings that boldly spell "Mars Colony One" under the glow of distant stars, set against the dark vastness of space.
1018+
A futuristic spaceship with sleek, metallic exterior hull markings that boldly spell "Mars Colony One" under the glow of distant stars, set against the dark vastness of space.

datasets/ocr/train.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19650,4 +19650,4 @@ A skyscraper window cleaner's bucket, labeled "Fearless Cleaner", dangles precar
1965019650
A dimly lit prison cell with worn, gray stone walls. In the center, a single flickering bulb casts shadows. On the wall, deeply scratched in bold letters, reads "Innocent 423", illuminated by the faint light.
1965119651
An ice rink rental counter with a sign that reads "Skate Size 8 Available", surrounded by neatly arranged ice skates and happy skaters in the background, captured in a crisp, realistic photograph.
1965219652
A close-up of an elevator inspection certificate, prominently displaying "Last Check 2023", attached to a modern elevator door with a sleek, metallic finish. The certificate is slightly weathered, with a faint watermark, enhancing its authenticity.
19653-
A close-up of a wizard's hat with a tag that reads "Sorting Hat Model 20", set against a magical, dimly lit backdrop with floating candles and mystical smoke swirling around it.
19653+
A close-up of a wizard's hat with a tag that reads "Sorting Hat Model 20", set against a magical, dimly lit backdrop with floating candles and mystical smoke swirling around it.

genrl/diffusers_patch/wan_pipeline_with_logprob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def wan_pipeline_with_logprob(
191191
):
192192
if callback_on_step_end_tensor_inputs is None:
193193
callback_on_step_end_tensor_inputs = ["latents"]
194-
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
194+
if isinstance(callback_on_step_end, PipelineCallback | MultiPipelineCallbacks):
195195
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs
196196

197197
self.check_inputs(

genrl/reward/hpsv3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def set_hpsv3_device(device) -> None:
4141

4242

4343
def _extract_reward_scalar(reward) -> float:
44-
if isinstance(reward, (list, tuple)) and len(reward) > 0:
44+
if isinstance(reward, list | tuple) and len(reward) > 0:
4545
return float(reward[0])
4646
if isinstance(reward, torch.Tensor):
4747
if reward.numel() == 0:

genrl/trainer/base_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def log_metrics(
260260
# Handle Python native types (int, float)
261261
# Note: numpy.float64 is a subclass of float, but has dtype attribute
262262
# numpy.int64 is NOT a subclass of int, and has dtype attribute
263-
elif isinstance(value, (int, float)) and not hasattr(value, "dtype"):
263+
elif isinstance(value, int | float) and not hasattr(value, "dtype"):
264264
scalar_items[key] = float(value)
265265
# Handle numpy scalars (numpy.int64, numpy.float64, etc.)
266266
# numpy scalars have .item() method and .dtype attribute

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extend-exclude = ["genrl/reward/VideoAlign", "genrl/reward/HPSv3"]
66
[tool.ruff.lint]
77
select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "DTZ", "T10", "EM", "ISC", "ICN", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET", "SIM", "ARG", "PTH", "ERA", "PD", "PGH", "PL", "TRY", "NPY", "RUF"]
88
ignore = [
9+
"UP038", # isinstance doesn't support X | Y syntax in older versions
910
"PTH", # Prefer pathlib over os.path (too many changes needed)
1011
"PLR0913", # Too many arguments (acceptable for complex functions)
1112
"PLR0912", # Too many branches (acceptable for complex logic)

0 commit comments

Comments
 (0)