Skip to content

Commit 8adf710

Browse files
committed
remove unmatched -1 protcols
1 parent 604b541 commit 8adf710

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

stdlib/@tests/test_cases/sqlite3/check_aggregations.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -75,48 +75,6 @@ def finalize(self) -> int:
7575
con.create_aggregate("sumint", 1, WindowSumIntMultiArgs)
7676
con.create_aggregate("sumint", 2, WindowSumIntMultiArgs)
7777

78-
# n_arg=-1 requires *args to handle any number of arguments
79-
if sys.version_info >= (3, 11):
80-
con.create_window_function("sumint_varargs", -1, WindowSumIntMultiArgs)
81-
82-
con.create_aggregate("sumint_varargs", -1, WindowSumIntMultiArgs)
83-
84-
85-
# n_arg=-1 should reject fixed-arity methods
86-
class FixedArityAggregate:
87-
def __init__(self) -> None:
88-
self.total = 0
89-
90-
def step(self, a: int, b: int) -> None:
91-
self.total += a + b
92-
93-
def finalize(self) -> int:
94-
return self.total
95-
96-
97-
con.create_aggregate("bad_varargs", -1, FixedArityAggregate) # type: ignore[arg-type]
98-
99-
100-
class FixedArityWindowAggregate:
101-
def __init__(self) -> None:
102-
self.total = 0
103-
104-
def step(self, a: int, b: int) -> None:
105-
self.total += a + b
106-
107-
def inverse(self, a: int, b: int) -> None:
108-
self.total -= a + b
109-
110-
def value(self) -> int:
111-
return self.total
112-
113-
def finalize(self) -> int:
114-
return self.total
115-
116-
117-
if sys.version_info >= (3, 11):
118-
con.create_window_function("bad_varargs", -1, FixedArityWindowAggregate) # type: ignore[arg-type]
119-
12078

12179
# Test case: Fixed parameter aggregates (the common case in practice)
12280
class FixedTwoParamAggregate:

stdlib/sqlite3/__init__.pyi

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,6 @@ class _AnyParamAggregateProtocol(Protocol):
237237
def step(self) -> Callable[..., object]: ...
238238
def finalize(self) -> _SqliteData: ...
239239

240-
@type_check_only
241-
class _AnyArgsAggregateProtocol(Protocol):
242-
def step(self, *args: _SqliteData) -> object: ...
243-
def finalize(self) -> _SqliteData: ...
244-
245240
@type_check_only
246241
class _SingleParamWindowAggregateClass(Protocol[_SQLType_contra]):
247242
def step(self, param: _SQLType_contra, /) -> object: ...
@@ -258,13 +253,6 @@ class _AnyParamWindowAggregateClass(Protocol):
258253
def value(self) -> _SqliteData: ...
259254
def finalize(self) -> _SqliteData: ...
260255

261-
@type_check_only
262-
class _AnyArgsWindowAggregateClass(Protocol):
263-
def step(self, *args: _SqliteData) -> object: ...
264-
def inverse(self, *args: _SqliteData) -> object: ...
265-
def value(self) -> _SqliteData: ...
266-
def finalize(self) -> _SqliteData: ...
267-
268256
# These classes are implemented in the C module _sqlite3. At runtime, they're imported
269257
# from there into sqlite3.dbapi2 and from that module to here. However, they
270258
# consider themselves to live in the sqlite3.* namespace, so we'll define them here.
@@ -354,10 +342,6 @@ class Connection:
354342
self, name: str, n_arg: Literal[1], aggregate_class: Callable[[], _SingleParamAggregateProtocol]
355343
) -> None: ...
356344
@overload
357-
def create_aggregate(
358-
self, name: str, n_arg: Literal[-1], aggregate_class: Callable[[], _AnyArgsAggregateProtocol]
359-
) -> None: ...
360-
@overload
361345
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AnyParamAggregateProtocol]) -> None: ...
362346

363347
if sys.version_info >= (3, 11):
@@ -372,14 +356,6 @@ class Connection:
372356
/,
373357
) -> None: ...
374358
@overload
375-
def create_window_function(
376-
self,
377-
name: str,
378-
num_params: Literal[-1],
379-
aggregate_class: Callable[[], _AnyArgsWindowAggregateClass] | None,
380-
/,
381-
) -> None: ...
382-
@overload
383359
def create_window_function(
384360
self, name: str, num_params: int, aggregate_class: Callable[[], _AnyParamWindowAggregateClass] | None, /
385361
) -> None: ...

0 commit comments

Comments
 (0)