Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion optype/_core/_do.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def do_setitem(obj: _c.CanSetitem[_KT, _VT], key: _KT, value: _VT, /) -> None:
def do_delitem(obj: _c.CanDelitem[_KT], key: _KT, /) -> None:
"""Same as `del obj[key]`."""
# https://github.com/astral-sh/ty/issues/1799
del obj[key] # ty:ignore[non-subscriptable]
del obj[key]


def do_missing(obj: _c.CanMissing[_KT, _DT], key: _KT, /) -> _DT:
Expand Down
2 changes: 1 addition & 1 deletion optype/_core/_has.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __dir__() -> list[str]:
_QualNameT = TypeVar(
"_QualNameT",
bound=str,
default=_NameT, # pyrefly: ignore[invalid-type-var]
default=_NameT,
)
_StrT_co = TypeVar("_StrT_co", bound=str, default=str, covariant=True)

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extra = [
"optype[numpy]",
]
lint = [
"dprint-py>=0.50.2.0",
"dprint-py>=0.51.1.0",
"ruff>=0.14.10",
"sp-repo-review[cli]>=2025.11.21",
]
Expand All @@ -82,8 +82,8 @@ type = [
{ include-group = "test" },
"basedpyright>=1.36.2",
"mypy[faster-cache]>=1.19.1",
"pyrefly==0.46.0",
"ty==0.0.6",
"pyrefly==0.46.2",
"ty==0.0.8",
]
dev = [
{ include-group = "extra" },
Expand Down
20 changes: 10 additions & 10 deletions tests/core/test_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def test_can_add_same_int() -> None:
r1: op.CanAddSame[object] = x # type: ignore[assignment] # pyright: ignore[reportAssignmentType]

# https://github.com/facebook/pyrefly/issues/1783
assert isinstance(x, op.CanAddSame) # pyrefly:ignore[invalid-argument]
assert issubclass(int, op.CanAddSame) # pyrefly:ignore[invalid-argument]
assert isinstance(x, op.CanAddSame)
assert issubclass(int, op.CanAddSame)


def test_iadd() -> None:
Expand Down Expand Up @@ -189,8 +189,8 @@ def test_can_iadd_same_list_accept() -> None:
a3: op.CanIAddSame[bytes] = x

# https://github.com/facebook/pyrefly/issues/1783
assert isinstance(x, op.CanIAddSame) # pyrefly:ignore[invalid-argument]
assert issubclass(list, op.CanIAddSame) # pyrefly:ignore[invalid-argument]
assert isinstance(x, op.CanIAddSame)
assert issubclass(list, op.CanIAddSame)


def test_can_iadd_same_list_reject() -> None:
Expand Down Expand Up @@ -230,8 +230,7 @@ def test_can_iter_collection_str(
value: (str | tuple[str, ...] | list[str] | set[str] | dict[str, object]),
) -> None:
# (in)sanity checks
# https://github.com/facebook/pyrefly/issues/1784
assert isinstance(value, Collection) # pyrefly:ignore[invalid-argument]
assert isinstance(value, Collection) # pyrefly: ignore[unsafe-overlap]
assert not isinstance(value, Iterator)

value_iter_next: op.CanIter[op.CanNext[str]] = value
Expand All @@ -247,7 +246,7 @@ def test_can_iter_collection_str(

assert isinstance(value, op.CanIter)
assert not isinstance(value, op.CanNext)
assert not isinstance(value, op.CanIterSelf)
assert not isinstance(value, op.CanIterSelf) # pyrefly: ignore[unsafe-overlap]

ivalue = iter(value)
ivalue_iter_next: op.CanIter[op.CanNext[str]] = ivalue
Expand All @@ -274,9 +273,10 @@ def test_unsliceable_sequence() -> None:
seq_int_str: op.CanSequence[int, str] = UnsliceableSequence()
seq_wrong_str: op.CanSequence[slice, str] = UnsliceableSequence() # type: ignore[assignment] # pyright: ignore[reportAssignmentType]

# https://github.com/facebook/pyrefly/issues/1783
# pyrefly:ignore[invalid-argument]
assert isinstance(UnsliceableSequence, op.CanSequence)
assert isinstance(
UnsliceableSequence,
op.CanSequence, # pyrefly: ignore[unsafe-overlap]
)


@pytest.mark.parametrize(
Expand Down
3 changes: 1 addition & 2 deletions tests/numpy/test_ufunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_anyufunc_ufunc_type() -> None:
# purposefully wrong
tp_4_str: type[UFunc[Any, Any, Any, LiteralString]] = np.ufunc # type: ignore[assignment] # pyright: ignore[reportAssignmentType]

# https://github.com/facebook/pyrefly/issues/1783
assert isinstance(tp, UFunc) # pyrefly: ignore[invalid-argument]
assert isinstance(tp, UFunc) # pyrefly: ignore[unsafe-overlap]


def test_anyufunc_ufunc_11() -> None:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def test_can_replace_date() -> None:
# pyrefly: ignore[bad-assignment]
d_copy_self: op.copy.CanReplaceSelf = d

# https://github.com/facebook/pyrefly/issues/1783
assert isinstance(d, op.copy.CanReplace) # pyrefly: ignore[invalid-argument]
assert isinstance(d, op.copy.CanReplace) # pyrefly: ignore[unsafe-overlap]
assert isinstance(d, op.copy.CanReplaceSelf)


Expand All @@ -107,6 +106,5 @@ def __replace__(self, /, *, val: int) -> Self:
# pyrefly: ignore[bad-assignment]
d_copy_self: op.copy.CanReplaceSelf = obj

# https://github.com/facebook/pyrefly/issues/1783
assert isinstance(obj, op.copy.CanReplace) # pyrefly: ignore[invalid-argument]
assert isinstance(obj, op.copy.CanReplace) # pyrefly: ignore[unsafe-overlap]
assert isinstance(obj, op.copy.CanReplaceSelf)
Loading