[QA] Add more pre commit checks

This commit is contained in:
Alexander Engelsberger 2021-06-16 13:12:28 +02:00 committed by Alexander Engelsberger
parent 2c908a8361
commit d0ae94f2af
5 changed files with 35 additions and 11 deletions

View File

@ -8,3 +8,28 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- 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

View File

@ -181,7 +181,7 @@ class LabeledComponents(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.

View File

@ -89,6 +89,6 @@ def _check_shapes(signal_int_shape, proto_int_shape):
def _int_and_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

View File

@ -10,7 +10,6 @@ class WTAC(torch.nn.Module):
Thin wrapper over the `wtac` function.
"""
def forward(self, distances, labels):
return wtac(distances, labels)
@ -21,7 +20,6 @@ class LTAC(torch.nn.Module):
Thin wrapper over the `wtac` function.
"""
def forward(self, probs, labels):
return wtac(-1.0 * probs, labels)
@ -32,7 +30,6 @@ class KNNC(torch.nn.Module):
Thin wrapper over the `knnc` function.
"""
def __init__(self, k=1, **kwargs):
super().__init__(**kwargs)
self.k = k

View File

@ -1,10 +1,12 @@
"""
_____ _ _______ _
| __ \ | | |__ __| | |
| |__) | __ ___ | |_ ___ | | ___ _ __ ___| |__
| ___/ '__/ _ \| __/ _ \| |/ _ \| '__/ __| '_ \
| | | | | (_) | || (_) | | (_) | | | (__| | | |
|_| |_| \___/ \__\___/|_|\___/|_| \___|_| |_|
######
# # ##### #### ##### #### ##### #### ##### #### # #
# # # # # # # # # # # # # # # # # #
###### # # # # # # # # # # # # # ######
# ##### # # # # # # # # ##### # # #
# # # # # # # # # # # # # # # # #
# # # #### # #### # #### # # #### # #
ProtoTorch Core Package
"""