Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove deprecatedMatrix.new#380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eriknw merged 2 commits intopython-graphblas:mainfromeriknw:remove_deprecated_new
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes fromall 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
8 changes: 0 additions & 8 deletionsgraphblas/core/matrix.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -761,14 +761,6 @@ def get(self, row, col, default=None):
"Indices should get a single element, which will be extracted as a Python scalar."
)

@classmethod
def new(cls, dtype, nrows=0, ncols=0, *, name=None):
warnings.warn(
"`Matrix.new(...)` is deprecated; please use `Matrix(...)` instead.",
DeprecationWarning,
)
return Matrix(dtype, nrows, ncols, name=name)

@classmethod
def from_values(
cls,
Expand Down
9 changes: 0 additions & 9 deletionsgraphblas/core/scalar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
import itertools
import warnings

import numpy as np

Expand DownExpand Up@@ -480,14 +479,6 @@ def get(self, default=None):
"""
return default if self._is_empty else self.value

@classmethod
def new(cls, dtype, *, is_cscalar=False, name=None):
warnings.warn(
"`Scalar.new(...)` is deprecated; please use `Scalar(...)` instead.",
DeprecationWarning,
)
return Scalar(dtype, is_cscalar=is_cscalar, name=name)

@classmethod
def from_value(cls, value, dtype=None, *, is_cscalar=False, name=None):
"""Create a new Scalar from a value.
Expand Down
8 changes: 0 additions & 8 deletionsgraphblas/core/vector.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -648,14 +648,6 @@ def get(self, index, default=None):
"A single index should be given, and the result will be a Python scalar."
)

@classmethod
def new(cls, dtype, size=0, *, name=None):
warnings.warn(
"`Vector.new(...)` is deprecated; please use `Vector(...)` instead.",
DeprecationWarning,
)
return Vector(dtype, size, name=name)

@classmethod
def from_values(cls, indices, values, dtype=None, *, size=None, dup_op=None, name=None):
"""Create a new Vector from indices and values.
Expand Down
12 changes: 3 additions & 9 deletionsgraphblas/tests/test_matrix.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -557,7 +557,7 @@ def test_extract_input_mask():
expected[[0, 1]].new(input_mask=M.S)
with pytest.raises(TypeError, match="Mask object must be type Vector"):
expected(input_mask=M.S) << expected[[0, 1]]
with pytest.raises(TypeError, match=r"new\(\) got an unexpected keyword argument 'input_mask'"):
with pytest.raises(AttributeError, match="new"):
A.new(input_mask=M.S)
with pytest.raises(TypeError, match="`input_mask` argument may only be used for extract"):
A(input_mask=M.S) << A.apply(unary.ainv)
Expand DownExpand Up@@ -2918,7 +2918,7 @@ def test_expr_is_like_matrix(A):
"_extract_element",
}
# Make sure signatures actually match
skip = {"__init__", "__repr__", "_repr_html_", "new"}
skip = {"__init__", "__repr__", "_repr_html_"}
for expr in [binary.times(B & B), B & B, B.T]:
print(type(expr).__name__)
for attr, val in inspect.getmembers(expr):
Expand DownExpand Up@@ -2971,7 +2971,7 @@ def test_index_expr_is_like_matrix(A):
"methods, then you may need to run `python -m graphblas.core.infixmethods`."
)
# Make sure signatures actually match. `update` has different docstring.
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "new", "update"}
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "update"}
for attr, val in inspect.getmembers(B[[0, 1], [0, 1]]):
if attr in skip or not isinstance(val, types.MethodType) or not hasattr(B, attr):
continue
Expand DownExpand Up@@ -3503,12 +3503,6 @@ def test_deprecated(A):
A.ss.selectk_rowwise("first", 3)
with pytest.warns(DeprecationWarning):
A.ss.selectk_columnwise("first", 3)
with pytest.warns(DeprecationWarning):
Matrix.new(int)
with pytest.warns(DeprecationWarning):
Vector.new(int)
with pytest.warns(DeprecationWarning):
Scalar.new(int)
with pytest.warns(DeprecationWarning):
A.to_values()
with pytest.warns(DeprecationWarning):
Expand Down
4 changes: 2 additions & 2 deletionsgraphblas/tests/test_scalar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -367,7 +367,7 @@ def test_expr_is_like_scalar(s):
assert attrs - infix_attrs == expected
assert attrs - scalar_infix_attrs == expected
# Make sure signatures actually match. `expr.dup` has `**opts`
skip = {"__init__", "__repr__", "_repr_html_", "new", "dup"}
skip = {"__init__", "__repr__", "_repr_html_", "dup"}
for expr in [v.inner(v), v @ v, t & t]:
print(type(expr).__name__)
for attr, val in inspect.getmembers(expr):
Expand DownExpand Up@@ -406,7 +406,7 @@ def test_index_expr_is_like_scalar(s):
"methods, then you may need to run `python -m graphblas.core.infixmethods`."
)
# Make sure signatures actually match. `update` has different docstring.
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "new", "update", "dup"}
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "update", "dup"}
for attr, val in inspect.getmembers(v[0]):
if attr in skip or not isinstance(val, types.MethodType) or not hasattr(s, attr):
continue
Expand Down
4 changes: 2 additions & 2 deletionsgraphblas/tests/test_vector.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1630,7 +1630,7 @@ def test_expr_is_like_vector(v):
)
assert attrs - infix_attrs == expected
# Make sure signatures actually match
skip = {"__init__", "__repr__", "_repr_html_", "new"}
skip = {"__init__", "__repr__", "_repr_html_"}
for expr in [binary.times(w & w), w & w]:
print(type(expr).__name__)
for attr, val in inspect.getmembers(expr):
Expand DownExpand Up@@ -1675,7 +1675,7 @@ def test_index_expr_is_like_vector(v):
"methods, then you may need to run `python -m graphblas.core.infixmethods`."
)
# Make sure signatures actually match. `update` has different docstring.
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "new", "update"}
skip = {"__call__", "__init__", "__repr__", "_repr_html_", "update"}
for attr, val in inspect.getmembers(w[[0, 1]]):
if attr in skip or not isinstance(val, types.MethodType) or not hasattr(w, attr):
continue
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp