Skip to content

Commit 9034323

Browse files
committed
.
2 parents e91ba60 + 60294dd commit 9034323

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

stdlib/http/cookies.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from _typeshed import MaybeNone
12
from collections.abc import Iterable, Mapping
23
from types import GenericAlias
34
from typing import Any, Generic, TypeVar, overload
45
from typing_extensions import TypeAlias
5-
from _typeshed import MaybeNone
66

77
__all__ = ["CookieError", "BaseCookie", "SimpleCookie"]
88

stubs/django-import-export/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "4.3.*"
1+
version = "4.4.*"
22
upstream_repository = "https://github.com/django-import-export/django-import-export"
33
requires = ["django-stubs"] # Add tablib when typed, and update _Incomplete aliases in stubs
44

stubs/django-import-export/import_export/widgets.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,19 @@ class ForeignKeyWidget(Widget, Generic[_ModelT]):
6565
self, model: _ModelT, field: str = "pk", use_natural_foreign_keys: bool = False, key_is_id: bool = False, **kwargs: Any
6666
) -> None: ...
6767
def get_queryset(self, value: Any, row: Mapping[str, Any], *args: Any, **kwargs: Any) -> QuerySet[_ModelT]: ...
68+
def get_instance_by_natural_key(self, value: str | bytes | bytearray) -> _ModelT: ...
69+
def get_instance_by_lookup_fields(self, value: Any, row: Mapping[str, Any], **kwargs: Any) -> _ModelT: ...
6870
def get_lookup_kwargs(self, value: Any, row: Mapping[str, Any] | None = None, **kwargs: Any) -> dict[str, Any]: ...
6971

72+
class _CachedQuerySetWrapper(Generic[_ModelT]):
73+
queryset: QuerySet[_ModelT]
74+
model: type[_ModelT]
75+
def __init__(self, queryset: QuerySet[_ModelT]) -> None: ...
76+
def get(self, **lookup_fields: Any) -> _ModelT: ... # instance can have different fields
77+
78+
class CachedForeignKeyWidget(ForeignKeyWidget[_ModelT]):
79+
def get_instance_by_lookup_fields(self, value: Any, row: Mapping[str, Any], **kwargs: Any) -> _ModelT: ...
80+
7081
class ManyToManyWidget(Widget, Generic[_ModelT]):
7182
model: _ModelT
7283
separator: str

stubs/tensorflow/tensorflow/__init__.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ from tensorflow import (
1818
io as io,
1919
keras as keras,
2020
math as math,
21+
nn as nn,
2122
random as random,
2223
types as types,
2324
)
@@ -37,7 +38,7 @@ from tensorflow.core.protobuf import struct_pb2
3738
from tensorflow.dtypes import *
3839
from tensorflow.experimental.dtensor import Layout
3940
from tensorflow.keras import losses as losses
40-
from tensorflow.linalg import eye as eye
41+
from tensorflow.linalg import eye as eye, matmul as matmul
4142

4243
# Most tf.math functions are exported as tf, but sadly not all are.
4344
from tensorflow.math import (
@@ -385,6 +386,13 @@ def squeeze(
385386
) -> Tensor: ...
386387
@overload
387388
def squeeze(input: RaggedTensor, axis: int | tuple[int, ...] | list[int], name: str | None = None) -> RaggedTensor: ...
389+
def split(
390+
value: TensorCompatible,
391+
num_or_size_splits: int | TensorCompatible,
392+
axis: int | Tensor = 0,
393+
num: int | None = None,
394+
name: str | None = "split",
395+
) -> list[Tensor]: ...
388396
def tensor_scatter_nd_update(
389397
tensor: TensorCompatible, indices: TensorCompatible, updates: TensorCompatible, name: str | None = None
390398
) -> Tensor: ...
@@ -434,4 +442,10 @@ def gather_nd(
434442
name: str | None = None,
435443
bad_indices_policy: Literal["", "DEFAULT", "ERROR", "IGNORE"] = "",
436444
) -> Tensor: ...
445+
def transpose(
446+
a: Tensor, perm: Sequence[int] | IntArray | None = None, conjugate: _bool = False, name: str = "transpose"
447+
) -> Tensor: ...
448+
def clip_by_value(
449+
t: Tensor | IndexedSlices, clip_value_min: TensorCompatible, clip_value_max: TensorCompatible, name: str | None = None
450+
) -> Tensor: ...
437451
def __getattr__(name: str): ... # incomplete module

stubs/tensorflow/tensorflow/keras/metrics.pyi

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from _typeshed import Incomplete
12
from abc import ABCMeta, abstractmethod
23
from collections.abc import Callable, Iterable, Sequence
3-
from typing import Any, Literal
4+
from enum import Enum
5+
from typing import Any, Literal, type_check_only
46
from typing_extensions import Self, TypeAlias
57

68
import tensorflow as tf
@@ -107,6 +109,25 @@ class SparseTopKCategoricalAccuracy(MeanMetricWrapper):
107109
self, k: int = 5, name: str | None = "sparse_top_k_categorical_accuracy", dtype: DTypeLike | None = None
108110
) -> None: ...
109111

112+
# TODO: Actually tensorflow.python.keras.utils.metrics_utils.Reduction, but that module
113+
# is currently missing from the stub.
114+
@type_check_only
115+
class _Reduction(Enum):
116+
SUM = "sum"
117+
SUM_OVER_BATCH_SIZE = "sum_over_batch_size"
118+
WEIGHTED_MEAN = "weighted_mean"
119+
120+
class Reduce(Metric):
121+
reduction: _Reduction
122+
total: Incomplete
123+
count: Incomplete # only defined for some reductions
124+
def __init__(self, reduction: _Reduction, name: str | None, dtype: DTypeLike | None = None) -> None: ...
125+
def update_state(self, values, sample_weight=None): ... # type: ignore[override]
126+
def result(self) -> Tensor: ...
127+
128+
class Mean(Reduce):
129+
def __init__(self, name: str | None = "mean", dtype: DTypeLike | None = None) -> None: ...
130+
110131
def serialize(metric: KerasSerializable) -> dict[str, Any]: ...
111132
def binary_crossentropy(
112133
y_true: TensorCompatible, y_pred: TensorCompatible, from_logits: bool = False, label_smoothing: float = 0.0, axis: int = -1

0 commit comments

Comments
 (0)