Skip to content

Commit 9ad44af

Browse files
committed
fix(ci): satisfy clippy cloned_ref_to_slice_refs and omit Python-version-specific Enum sunder hooks from stubs
1 parent 9b2add0 commit 9ad44af

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

‎crates/oxideon-core/tests/jpeg_decode.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ fn max_diff(a: &[u8], b: &[u8]) -> i32 {
196196
fn grayscale_round_trip_with_and_without_restart_intervals() {
197197
for (w, h) in [(8, 8), (21, 13), (50, 33)] {
198198
let img = pattern(w, h, 0);
199-
let plain = encode(&[img.clone()], w, h, &[(1, 1)], 0, &[1], None);
199+
let plain = encode(std::slice::from_ref(&img), w, h, &[(1, 1)], 0, &[1], None);
200200
let (px, dw, dh, c) = decode_jpeg(&plain).unwrap();
201201
assert_eq!((dw, dh, c), (w, h, 1));
202202
assert!(max_diff(&px, &img) <= 2, "{w}x{h} grayscale round trip");
203203
for ri in [1usize, 2, 3, 5] {
204-
let rst = encode(&[img.clone()], w, h, &[(1, 1)], ri, &[1], None);
204+
let rst = encode(std::slice::from_ref(&img), w, h, &[(1, 1)], ri, &[1], None);
205205
assert_eq!(decode_jpeg(&rst).unwrap().0, px, "{w}x{h} restart interval {ri} must decode identically");
206206
}
207207
}

‎python/oxideon/__init__.pyi‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5628,10 +5628,6 @@ class LocalResponseNorm:
56285628
class LogLevel:
56295629
"""Enum where members are also (and must be) ints"""
56305630
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
5631-
def _generate_next_value_(self, start: Any, count: Any, last_values: Any) -> Any: ...
5632-
def _member_type_(self, *args: Any, **kwargs: Any) -> Any: ...
5633-
def _new_member_(self, *args: Any, **kwargs: Any) -> Any: ...
5634-
def _value_repr_(self, /) -> Any: ...
56355631

56365632
class LogNormal:
56375633
"""Log-normal distribution parameterized by loc and scale."""
@@ -7482,19 +7478,12 @@ class ProdigyOptimizer:
74827478
class ProfilerAction:
74837479
"""Actions performed at each step of the profiling schedule."""
74847480
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
7485-
def _generate_next_value_(self, start: Any, count: Any, last_values: Any) -> Any: ...
7486-
def _member_type_(self) -> Any: ...
7487-
def _new_member_(self, *args: Any, **kwargs: Any) -> Any: ...
74887481

74897482
class ProfilerActivity:
74907483
"""Execution activities monitored during profiling."""
74917484
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
74927485
def __repr__(self) -> str: ...
74937486
def __str__(self) -> str: ...
7494-
def _generate_next_value_(self, start: Any, count: Any, last_values: Any) -> Any: ...
7495-
def _member_type_(self, *args: Any, **kwargs: Any) -> Any: ...
7496-
def _new_member_(self, *args: Any, **kwargs: Any) -> Any: ...
7497-
def _value_repr_(self, /) -> Any: ...
74987487

74997488
class PromptTemplate:
75007489
"""Parametric prompt template with named slot substitutions (respecting escaped {{braces}})."""
@@ -8099,9 +8088,6 @@ class ReduceLROnPlateauCallback:
80998088
class ReduceOp:
81008089
"""Reduction operations for collective communication."""
81018090
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
8102-
def _generate_next_value_(self, start: Any, count: Any, last_values: Any) -> Any: ...
8103-
def _member_type_(self) -> Any: ...
8104-
def _new_member_(self, *args: Any, **kwargs: Any) -> Any: ...
81058091

81068092
class ReflectionPad1d:
81078093
"""Pads the input tensor using the reflection of the input boundary."""

‎tools/gen_stubs.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ def emit_class(name, cls, table, stats):
535535
ignore = " # type: ignore[override]" if name == "Tensor" and member in ("__eq__", "__ne__") else ""
536536
body.append(f" def {member}{sig}: ...{ignore}")
537537
continue
538+
if member.startswith("_") and member.endswith("_"):
539+
continue # CPython Enum/internal sunder hooks vary across Python versions
538540
raw = inspect.getattr_static(cls, member)
539541
ptypes, ret = types_of(member)
540542
if isinstance(raw, staticmethod):

0 commit comments

Comments
 (0)