Skip to content

Commit

Permalink
Merge pull request #60 from Quantco/update-pre-commit-hooks-2020-02
Browse files Browse the repository at this point in the history
Update pre-commit hook versions
  • Loading branch information
xhochy committed Feb 24, 2021
2 parents 5b030d5 + b17aa2a commit 1d035a7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
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()],
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

0 comments on commit 1d035a7

Please sign in to comment.