Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit hook versions #60

Merged
merged 1 commit into from Feb 24, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
@@ -1,28 +1,28 @@
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black-conda
additional_dependencies: [flake8-docstrings, flake8-rst-docstrings]
args:
- --safe
- --target-version=py36
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8
rev: v3.7.9
rev: v3.8.4
hooks:
- id: flake8-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-isort
rev: 4.3.21
rev: 5.7.0
hooks:
- id: isort-conda
additional_dependencies: [toml]
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy
rev: "0.770"
rev: "0.812"
hooks:
- id: mypy-conda
additional_dependencies:
- python=3.8
- repo: https://github.com/Quantco/pre-commit-mirrors-pyupgrade
rev: 1.26.0
rev: 2.10.0
hooks:
- id: pyupgrade-conda
3 changes: 2 additions & 1 deletion src/quantcore/matrix/benchmark/main.py
Expand Up @@ -98,7 +98,8 @@ def _to_standardized_mat(mat):

times = pd.DataFrame(
index=pd.MultiIndex.from_product(
[ops_to_run, matrices.keys()], names=["operation", "storage"],
[ops_to_run, matrices.keys()],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh... did this happen because the most recent black version re-implemented support for "magic trailing commas" as an indicator that the arguments should each be on different lines?

I don't think we meant to have those trailing commas there in the first place -- I would prefer no trailing comma and arguments on one line -- but this is totally fine too. I'm happy to defer such responsibilities to the wisdom of black :)

names=["operation", "storage"],
),
columns=["memory", "time"],
).reset_index()
Expand Down
4 changes: 3 additions & 1 deletion src/quantcore/matrix/categorical_matrix.py
Expand Up @@ -58,7 +58,9 @@ def recover_orig(self) -> np.ndarray:
return self.cat.categories[self.cat.codes]

def _matvec_setup(
self, other: Union[List, np.ndarray], cols: np.ndarray = None,
self,
other: Union[List, np.ndarray],
cols: np.ndarray = None,
) -> Tuple[np.ndarray, Optional[np.ndarray]]:
other = np.asarray(other)
if other.ndim > 1:
Expand Down
2 changes: 1 addition & 1 deletion src/quantcore/matrix/dense_matrix.py
Expand Up @@ -59,8 +59,8 @@ def cross_sandwich(
L_cols: Optional[np.ndarray] = None,
R_cols: Optional[np.ndarray] = None,
):
from .sparse_matrix import SparseMatrix
from .categorical_matrix import CategoricalMatrix
from .sparse_matrix import SparseMatrix

if isinstance(other, SparseMatrix) or isinstance(other, CategoricalMatrix):
return other.cross_sandwich(self, d, rows, R_cols, L_cols).T
Expand Down
12 changes: 8 additions & 4 deletions tests/test_matrices.py
Expand Up @@ -198,7 +198,8 @@ def test_to_array_standardized_mat(mat: mx.StandardizedMatrix):

@pytest.mark.parametrize("mat", get_matrices())
@pytest.mark.parametrize(
"other_type", [lambda x: x, np.asarray, mx.DenseMatrix],
"other_type",
[lambda x: x, np.asarray, mx.DenseMatrix],
)
@pytest.mark.parametrize("cols", [None, [], [1], np.array([1])])
@pytest.mark.parametrize("other_shape", [[], [1], [2]])
Expand Down Expand Up @@ -266,7 +267,8 @@ def process_mat_vec_subsets(mat, vec, mat_rows, mat_cols, vec_idxs):

@pytest.mark.parametrize("mat", get_matrices())
@pytest.mark.parametrize(
"other_type", [lambda x: x, np.array, mx.DenseMatrix],
"other_type",
[lambda x: x, np.array, mx.DenseMatrix],
)
@pytest.mark.parametrize("rows", [None, [], [2], np.arange(2)])
@pytest.mark.parametrize("cols", [None, [], [1], np.arange(1)])
Expand Down Expand Up @@ -335,7 +337,8 @@ def test_cross_sandwich(

@pytest.mark.parametrize("mat", get_matrices())
@pytest.mark.parametrize(
"vec_type", [lambda x: x, np.array, mx.DenseMatrix],
"vec_type",
[lambda x: x, np.array, mx.DenseMatrix],
)
@pytest.mark.parametrize("rows", [None, [], [1], np.arange(2)])
@pytest.mark.parametrize("cols", [None, [], [0], np.arange(1)])
Expand Down Expand Up @@ -391,7 +394,8 @@ def test_transpose(mat):

@pytest.mark.parametrize("mat", get_matrices())
@pytest.mark.parametrize(
"vec_type", [lambda x: x, np.array, mx.DenseMatrix],
"vec_type",
[lambda x: x, np.array, mx.DenseMatrix],
)
def test_rmatmul(mat: Union[mx.MatrixBase, mx.StandardizedMatrix], vec_type):
vec_as_list = [3.0, -0.1, 0]
Expand Down
3 changes: 2 additions & 1 deletion tests/test_split_matrix.py
Expand Up @@ -125,7 +125,8 @@ def test_sandwich_sparse_dense(X: np.ndarray, Acols, Bcols):
# TODO: ensure cols are in order
@pytest.mark.parametrize("mat", [split_mat(), split_with_cat(), split_with_cat_64()])
@pytest.mark.parametrize(
"cols", [None, [0], [1, 2, 3], [1, 5]],
"cols",
[None, [0], [1, 2, 3], [1, 5]],
)
def test_sandwich(mat: mx.SplitMatrix, cols):
for i in range(10):
Expand Down