Skip to content

Commit

Permalink
Add pre-commit hook for black and flake8 (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
as51340 authored Sep 25, 2024
1 parent f28751a commit 83d411c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-yaml

- repo: https://github.com/psf/black
rev: 22.3.0 # Should be the same as in python/tests/requirements.txt
hooks:
- id: black
args: [--quiet]
files: ^python/

- repo: https://github.com/pycqa/flake8
rev: 3.9.2 # Should be the same as in python/tests/requirements.txt
hooks:
- id: flake8
args: [--config=python/.flake8]
files: ^python/
12 changes: 2 additions & 10 deletions python/mage/tgn/definitions/tgn.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,7 @@ def _form_computation_graph(

node_arr = []
for v, t in cur_arr:
(
neighbors,
edge_idxs,
timestamps,
) = (
(neighbors, edge_idxs, timestamps,) = (
self.temporal_neighborhood.get_neighborhood(
v, t, self.num_neighbors
)
Expand All @@ -448,11 +444,7 @@ def _form_computation_graph(
global_edge_indexes = []
global_timestamps = []
for v, t in node_layers[0]:
(
neighbors,
edge_idxs,
timestamps,
) = (
(neighbors, edge_idxs, timestamps,) = (
self.temporal_neighborhood.get_neighborhood(v, t, self.num_neighbors)
if (v, t) not in sampled_neighborhood
else sampled_neighborhood[(v, t)]
Expand Down

0 comments on commit 83d411c

Please sign in to comment.