Skip to content

Commit

Permalink
pre-commit autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
DiddiZ committed Feb 4, 2024
1 parent ec2d787 commit fd05168
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
18 changes: 11 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: end-of-file-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- "--py38-plus"
- repo: https://github.com/psf/black
rev: 23.1.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-absolute-import
# - flake8-annotations
# - flake8-builtins
- flake8-comprehensions
Expand All @@ -37,7 +41,7 @@ repos:
- flake8-use-fstring
- flake8-use-pathlib
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.1.0
hooks:
- id: prettier
args:
Expand Down
8 changes: 4 additions & 4 deletions donk/costs/cost_function_symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def __init__(self, cost_fun: Callable[[np.ndarray, np.ndarray], np.ndarray], T:
self.T, self.dX, self.dU = T, dX, dU

# Create symbols
X_sym = np.array(symbols(f"x:{(T+1)*dX}")).reshape(T + 1, dX)
U_sym = np.array(symbols(f"u:{T*dU}")).reshape(T, dU)
X_sym = np.array(symbols(f"x:{(T + 1) * dX}")).reshape(T + 1, dX)
U_sym = np.array(symbols(f"u:{T * dU}")).reshape(T, dU)

# Eval costs
costs = cost_fun(X_sym, U_sym)
Expand Down Expand Up @@ -123,8 +123,8 @@ def cost_fun(X: np.ndarray, U: np.ndarray) -> np.ndarray:
super().__init__(cost_fun, T, dX, dU)

# Create symbols
X_sym = np.array(symbols(f"x:{(T+1)*dX}")).reshape(T + 1, dX)
U_sym = np.array(symbols(f"u:{T*dU}")).reshape(T, dU)
X_sym = np.array(symbols(f"x:{(T + 1) * dX}")).reshape(T + 1, dX)
U_sym = np.array(symbols(f"u:{T * dU}")).reshape(T, dU)

# Lambdify and vectorize cost functions
self.cost_funs = [
Expand Down
4 changes: 2 additions & 2 deletions donk/models/tvlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def __init__(
self.T, dY, dX = coefficients.shape

# Check shapes
assert coefficients.shape == (self.T, dY, dX), f"{coefficients.shape} != {(self.T, dY, dX )}"
assert coefficients.shape == (self.T, dY, dX), f"{coefficients.shape} != {(self.T, dY, dX)}"
assert intercept.shape == (self.T, dY), f"{intercept.shape} != {(self.T, dY)}"
if covar is not None:
assert covar.shape == (self.T, dY, dY), f"{covar.shape} != {(self.T, dY, dY)}"
if inv_covar is not None:
assert inv_covar.shape == (self.T, dY, dY), f"{inv_covar.shape} != {(self.T,dY, dY)}"
assert inv_covar.shape == (self.T, dY, dY), f"{inv_covar.shape} != {(self.T, dY, dY)}"

self._coefficients = coefficients
self._intercept = intercept
Expand Down
2 changes: 1 addition & 1 deletion donk/samples/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def add(self, X: np.ndarray, U: np.ndarray) -> None:
"""
# Check shapes
assert X.shape[0] == U.shape[0], f"{X.shape[0]} != {U.shape[0]}"
assert X.shape[1] == U.shape[1] + 1, f"{X.shape[1]} != {U.shape[1]+1}"
assert X.shape[1] == U.shape[1] + 1, f"{X.shape[1]} != {U.shape[1] + 1}"
if self._XUX is None:
# Pool was empty, assume dimensions
self.dX, self.dU = X.shape[-1], U.shape[-1]
Expand Down
2 changes: 1 addition & 1 deletion donk/samples/sampler_gym.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def take_sample(
U[t] = pol.act(X[t], t, noise[t] if rng is not None else None)
obs, _, done, _ = self.env.step(self.convert_action(U[t]))
if done and t < T - 1:
raise Exception(f"Iteration ended prematurely {t+1}/{T}")
raise Exception(f"Iteration ended prematurely {t + 1}/{T}")
X[t + 1] = self.convert_observation(obs)

return X, U
2 changes: 1 addition & 1 deletion donk/samples/state_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, mean: np.ndarray, covar: np.ndarray) -> None:
dX = mean.shape[-1]

# Check shapes
assert covar.shape[-2:] == (dX, dX), f"{covar.shape[-2:]} != {(dX, dX )}"
assert covar.shape[-2:] == (dX, dX), f"{covar.shape[-2:]} != {(dX, dX)}"
assert mean.shape[:-1] == covar.shape[:-2], f"{mean.shape[:-1]} != {covar.shape[:-2]}"

self.mean = mean
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
ignore = E203,E741,W503,D100,D104,D105,PL123,ANN101
ignore = E203,E741,W503,D100,D104,D105,PL123,ANN101,ANN102
per-file-ignores =
tests/*:D101,D102,ANN001,ANN201,ANN202
tests/*:D101,D102,D103,ANN201,ABS101
max-line-length = 120
docstring-convention = google
known-modules = donk.ai:[donk,tests]
Expand Down

0 comments on commit fd05168

Please sign in to comment.