[QA] Add more pre commit checks
This commit is contained in:
parent
2c908a8361
commit
d0ae94f2af
@ -8,3 +8,28 @@ repos:
|
|||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
|
- id: check-ast
|
||||||
|
- id: check-byte-order-marker
|
||||||
|
- id: check-case-conflict
|
||||||
|
#- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
|
# rev: 'v0.902'
|
||||||
|
# hooks:
|
||||||
|
# - id: mypy
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-yapf
|
||||||
|
rev: 'v0.31.0' # Use the sha / tag you want to point at
|
||||||
|
hooks:
|
||||||
|
- id: yapf
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||||
|
rev: v1.9.0 # Use the ref you want to point at
|
||||||
|
hooks:
|
||||||
|
- id: python-use-type-annotations
|
||||||
|
- id: python-no-log-warn
|
||||||
|
- id: python-check-blanket-noqa
|
||||||
|
|
||||||
|
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.19.4
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
@ -181,7 +181,7 @@ class LabeledComponents(Components):
|
|||||||
|
|
||||||
|
|
||||||
class ReasoningComponents(Components):
|
class ReasoningComponents(Components):
|
||||||
"""ReasoningComponents generate a set of components and a set of reasoning matrices.
|
r"""ReasoningComponents generate a set of components and a set of reasoning matrices.
|
||||||
|
|
||||||
Every Component has a reasoning matrix assigned.
|
Every Component has a reasoning matrix assigned.
|
||||||
|
|
||||||
|
@ -89,6 +89,6 @@ def _check_shapes(signal_int_shape, proto_int_shape):
|
|||||||
|
|
||||||
def _int_and_mixed_shape(tensor):
|
def _int_and_mixed_shape(tensor):
|
||||||
shape = mixed_shape(tensor)
|
shape = mixed_shape(tensor)
|
||||||
int_shape = tuple([i if isinstance(i, int) else None for i in shape])
|
int_shape = tuple(i if isinstance(i, int) else None for i in shape)
|
||||||
|
|
||||||
return shape, int_shape
|
return shape, int_shape
|
||||||
|
@ -10,7 +10,6 @@ class WTAC(torch.nn.Module):
|
|||||||
Thin wrapper over the `wtac` function.
|
Thin wrapper over the `wtac` function.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def forward(self, distances, labels):
|
def forward(self, distances, labels):
|
||||||
return wtac(distances, labels)
|
return wtac(distances, labels)
|
||||||
|
|
||||||
@ -21,7 +20,6 @@ class LTAC(torch.nn.Module):
|
|||||||
Thin wrapper over the `wtac` function.
|
Thin wrapper over the `wtac` function.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def forward(self, probs, labels):
|
def forward(self, probs, labels):
|
||||||
return wtac(-1.0 * probs, labels)
|
return wtac(-1.0 * probs, labels)
|
||||||
|
|
||||||
@ -32,7 +30,6 @@ class KNNC(torch.nn.Module):
|
|||||||
Thin wrapper over the `knnc` function.
|
Thin wrapper over the `knnc` function.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, k=1, **kwargs):
|
def __init__(self, k=1, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.k = k
|
self.k = k
|
||||||
|
14
setup.py
14
setup.py
@ -1,10 +1,12 @@
|
|||||||
"""
|
"""
|
||||||
_____ _ _______ _
|
|
||||||
| __ \ | | |__ __| | |
|
######
|
||||||
| |__) | __ ___ | |_ ___ | | ___ _ __ ___| |__
|
# # ##### #### ##### #### ##### #### ##### #### # #
|
||||||
| ___/ '__/ _ \| __/ _ \| |/ _ \| '__/ __| '_ \
|
# # # # # # # # # # # # # # # # # #
|
||||||
| | | | | (_) | || (_) | | (_) | | | (__| | | |
|
###### # # # # # # # # # # # # # ######
|
||||||
|_| |_| \___/ \__\___/|_|\___/|_| \___|_| |_|
|
# ##### # # # # # # # # ##### # # #
|
||||||
|
# # # # # # # # # # # # # # # # #
|
||||||
|
# # # #### # #### # #### # # #### # #
|
||||||
|
|
||||||
ProtoTorch Core Package
|
ProtoTorch Core Package
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user